| @@ -223,24 +223,17 @@ | ||
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | |
| 227 | -function CircularText($x, $y, $r, $text, $align='top', $fontfamily='', $fontsizePt=0, $fontstyle='', $kerning=120, $fontwidth=100, $divider='') { // mPDF 5.5.23 | |
| 227 | +function CircularText($x, $y, $r, $text, $align='top', $fontfamily='', $fontsizePt=0, $fontstyle='', $kerning=120, $fontwidth=100) { | |
| 228 | 228 | if ($font || $fontstyle || $fontsizePt) $this->mpdf->SetFont($fontfamily,$fontstyle,$fontsizePt); |
| 229 | 229 | $kerning/=100; |
| 230 | 230 | $fontwidth/=100; |
| 231 | 231 | if($kerning==0) $this->mpdf->Error('Please use values unequal to zero for kerning (CircularText)'); |
| 232 | - if($fontwidth==0) $this->mpdf->Error('Please use values unequal to zero for font width (CircularText)'); | |
| 232 | + if($fontwidth==0) $this->mpdf->Error('Please use values unequal to zero for font width (CircularText)'); | |
| 233 | + $t=0; | |
| 233 | 234 | $text=str_replace("\r",'',$text); |
| 234 | - //circumference | |
| 235 | - $u=($r*2)*M_PI; | |
| 236 | - // mPDF 5.5.23 | |
| 237 | - $checking = true; | |
| 238 | - $autoset = false; | |
| 239 | - while($checking) { | |
| 240 | - $t=0; | |
| 241 | - $w = array(); | |
| 242 | - if ($this->mpdf->usingCoreFont) { | |
| 235 | + if ($this->mpdf->usingCoreFont) { | |
| 243 | 236 | $nb=strlen($text); |
| 244 | 237 | for($i=0; $i<$nb; $i++){ |
| 245 | 238 | $w[$i]=$this->mpdf->GetStringWidth($text[$i]); |
| 246 | 239 | $w[$i]*=$kerning*$fontwidth; |
| @@ -245,10 +238,10 @@ | ||
| 245 | 238 | $w[$i]=$this->mpdf->GetStringWidth($text[$i]); |
| 246 | 239 | $w[$i]*=$kerning*$fontwidth; |
| 247 | 240 | $t+=$w[$i]; |
| 248 | 241 | } |
| 249 | - } | |
| 250 | - else { | |
| 242 | + } | |
| 243 | + else { | |
| 251 | 244 | $nb=mb_strlen($text, $this->mpdf->mb_enc ); |
| 252 | 245 | $lastchar = ''; |
| 253 | 246 | $unicode = $this->mpdf->UTF8StringToArray($text); |
| 254 | 247 | for($i=0; $i<$nb; $i++){ |
| @@ -266,23 +259,11 @@ | ||
| 266 | 259 | } |
| 267 | 260 | $lastchar = $char; |
| 268 | 261 | $t+=$w[$i]; |
| 269 | 262 | } |
| 270 | - } | |
| 271 | - if ($fontsizePt>=0 || $autoset) { $checking = false; } | |
| 272 | - else { | |
| 273 | - $t+=$this->mpdf->GetStringWidth(' '); | |
| 274 | - if ($divider) | |
| 275 | - $t+=$this->mpdf->GetStringWidth(' '); | |
| 276 | - if ($fontsizePt==-2) | |
| 277 | - $fontsizePt = $this->mpdf->FontSizePt * 0.5 * $u/$t; | |
| 278 | - else | |
| 279 | - $fontsizePt = $this->mpdf->FontSizePt * $u/$t; | |
| 280 | - $this->mpdf->SetFontSize($fontsizePt); | |
| 281 | - $autoset = true; | |
| 282 | - } | |
| 283 | 263 | } |
| 284 | - | |
| 264 | + //circumference | |
| 265 | + $u=($r*2)*M_PI; | |
| 285 | 266 | //total width of string in degrees |
| 286 | 267 | $d=($t/$u)*360; |
| 287 | 268 | |
| 288 | 269 | $this->mpdf->StartTransform(); |
| @@ -331,26 +312,8 @@ | ||
| 331 | 312 | $this->mpdf->StopTransform(); |
| 332 | 313 | } |
| 333 | 314 | } |
| 334 | 315 | $this->mpdf->StopTransform(); |
| 335 | - | |
| 336 | - // mPDF 5.5.23 | |
| 337 | - if($align=='top' && $divider!=''){ | |
| 338 | - $wc=$this->mpdf->GetStringWidth($divider); | |
| 339 | - $wc*=$kerning*$fontwidth; | |
| 340 | - | |
| 341 | - $this->mpdf->StartTransform(); | |
| 342 | - $this->mpdf->transformRotate(90, $x, $y); | |
| 343 | - $this->mpdf->SetXY($x-$wc/2, $y-$r); | |
| 344 | - $this->mpdf->Cell(($wc),$this->mpdf->FontSize,$divider,0,0,'C'); | |
| 345 | - $this->mpdf->StopTransform(); | |
| 346 | - | |
| 347 | - $this->mpdf->StartTransform(); | |
| 348 | - $this->mpdf->transformRotate(-90, $x, $y); | |
| 349 | - $this->mpdf->SetXY($x-$wc/2, $y-$r); | |
| 350 | - $this->mpdf->Cell(($wc),$this->mpdf->FontSize,$divider,0,0,'C'); | |
| 351 | - $this->mpdf->StopTransform(); | |
| 352 | - } | |
| 353 | 316 | } |
| 354 | 317 | |
| 355 | 318 | function Shaded_box( $text,$font='',$fontstyle='B',$szfont='',$width='70%',$style='DF',$radius=2.5,$fill='#FFFFFF',$color='#000000',$pad=2 ) |
| 356 | 319 | { |