function pBarcode128::getSize in Visitors 7.2
Same name and namespace in other branches
- 7 pChart/class/pBarcode128.class.php \pBarcode128::getSize()
File
- pChart/
class/ pBarcode128.class.php, line 51
Class
Code
function getSize($TextString, $Format = "") {
$Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0;
$ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE;
$LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
$DrawArea = isset($Format["DrawArea"]) ? $Format["DrawArea"] : FALSE;
$FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : 12;
$Height = isset($Format["Height"]) ? $Format["Height"] : 30;
$TextString = $this
->encode128($TextString);
$BarcodeLength = strlen($this->Result);
if ($DrawArea) {
$WOffset = 20;
}
else {
$WOffset = 0;
}
if ($ShowLegend) {
$HOffset = $FontSize + $LegendOffset + $WOffset;
}
else {
$HOffset = 0;
}
$X1 = cos($Angle * PI / 180) * ($WOffset + $BarcodeLength);
$Y1 = sin($Angle * PI / 180) * ($WOffset + $BarcodeLength);
$X2 = $X1 + cos(($Angle + 90) * PI / 180) * ($HOffset + $Height);
$Y2 = $Y1 + sin(($Angle + 90) * PI / 180) * ($HOffset + $Height);
$AreaWidth = max(abs($X1), abs($X2));
$AreaHeight = max(abs($Y1), abs($Y2));
return array(
"Width" => $AreaWidth,
"Height" => $AreaHeight,
);
}