| @@ 316-411 (lines=96) @@ | ||
| 313 | $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j,$i-$j),0,0,'',0,$link); |
|
| 314 | } |
|
| 315 | ||
| 316 | function _putfonts() |
|
| 317 | { |
|
| 318 | $nf=$this->n; |
|
| 319 | foreach($this->diffs as $diff) |
|
| 320 | { |
|
| 321 | //Encodings |
|
| 322 | $this->_newobj(); |
|
| 323 | $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>'); |
|
| 324 | $this->_out('endobj'); |
|
| 325 | } |
|
| 326 | $mqr=get_magic_quotes_runtime(); |
|
| 327 | set_magic_quotes_runtime(0); |
|
| 328 | foreach($this->FontFiles as $file=>$info) |
|
| 329 | { |
|
| 330 | //Font file embedding |
|
| 331 | $this->_newobj(); |
|
| 332 | $this->FontFiles[$file]['n']=$this->n; |
|
| 333 | if(defined('FPDF_FONTPATH')) |
|
| 334 | $file=FPDF_FONTPATH.$file; |
|
| 335 | $size=filesize($file); |
|
| 336 | if(!$size) |
|
| 337 | $this->Error('Font file not found'); |
|
| 338 | $this->_out('<</Length '.$size); |
|
| 339 | if(substr($file,-2)=='.z') |
|
| 340 | $this->_out('/Filter /FlateDecode'); |
|
| 341 | $this->_out('/Length1 '.$info['length1']); |
|
| 342 | if(isset($info['length2'])) |
|
| 343 | $this->_out('/Length2 '.$info['length2'].' /Length3 0'); |
|
| 344 | $this->_out('>>'); |
|
| 345 | $f=fopen($file,'rb'); |
|
| 346 | $this->_putstream(fread($f,$size)); |
|
| 347 | fclose($f); |
|
| 348 | $this->_out('endobj'); |
|
| 349 | } |
|
| 350 | set_magic_quotes_runtime($mqr); |
|
| 351 | foreach($this->fonts as $k=>$font) |
|
| 352 | { |
|
| 353 | //Font objects |
|
| 354 | $this->_newobj(); |
|
| 355 | $this->fonts[$k]['n']=$this->n; |
|
| 356 | $this->_out('<</Type /Font'); |
|
| 357 | if($font['type']=='Type0') |
|
| 358 | $this->_putType0($font); |
|
| 359 | else |
|
| 360 | { |
|
| 361 | $name=$font['name']; |
|
| 362 | $this->_out('/BaseFont /'.$name); |
|
| 363 | if($font['type']=='core') |
|
| 364 | { |
|
| 365 | //Standard font |
|
| 366 | $this->_out('/Subtype /Type1'); |
|
| 367 | if($name!='Symbol' and $name!='ZapfDingbats') |
|
| 368 | $this->_out('/Encoding /WinAnsiEncoding'); |
|
| 369 | } |
|
| 370 | else |
|
| 371 | { |
|
| 372 | //Additional font |
|
| 373 | $this->_out('/Subtype /'.$font['type']); |
|
| 374 | $this->_out('/FirstChar 32'); |
|
| 375 | $this->_out('/LastChar 255'); |
|
| 376 | $this->_out('/Widths '.($this->n+1).' 0 R'); |
|
| 377 | $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); |
|
| 378 | if($font['enc']) |
|
| 379 | { |
|
| 380 | if(isset($font['diff'])) |
|
| 381 | $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); |
|
| 382 | else |
|
| 383 | $this->_out('/Encoding /WinAnsiEncoding'); |
|
| 384 | } |
|
| 385 | } |
|
| 386 | $this->_out('>>'); |
|
| 387 | $this->_out('endobj'); |
|
| 388 | if($font['type']!='core') |
|
| 389 | { |
|
| 390 | //Widths |
|
| 391 | $this->_newobj(); |
|
| 392 | $cw=&$font['cw']; |
|
| 393 | $s='['; |
|
| 394 | for($i=32;$i<=255;$i++) |
|
| 395 | $s.=$cw[chr($i)].' '; |
|
| 396 | $this->_out($s.']'); |
|
| 397 | $this->_out('endobj'); |
|
| 398 | //Descriptor |
|
| 399 | $this->_newobj(); |
|
| 400 | $s='<</Type /FontDescriptor /FontName /'.$name; |
|
| 401 | foreach($font['desc'] as $k=>$v) |
|
| 402 | $s.=' /'.$k.' '.$v; |
|
| 403 | $file=$font['file']; |
|
| 404 | if($file) |
|
| 405 | $s.=' /FontFile'.($font['type']=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; |
|
| 406 | $this->_out($s.'>>'); |
|
| 407 | $this->_out('endobj'); |
|
| 408 | } |
|
| 409 | } |
|
| 410 | } |
|
| 411 | } |
|
| 412 | ||
| 413 | function _putType0($font) |
|
| 414 | { |
|
| @@ 332-427 (lines=96) @@ | ||
| 329 | $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j,$i-$j),0,0,'',0,$link); |
|
| 330 | } |
|
| 331 | ||
| 332 | function _putfonts() |
|
| 333 | { |
|
| 334 | $nf=$this->n; |
|
| 335 | foreach($this->diffs as $diff) |
|
| 336 | { |
|
| 337 | //Encodings |
|
| 338 | $this->_newobj(); |
|
| 339 | $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>'); |
|
| 340 | $this->_out('endobj'); |
|
| 341 | } |
|
| 342 | $mqr=get_magic_quotes_runtime(); |
|
| 343 | set_magic_quotes_runtime(0); |
|
| 344 | foreach($this->FontFiles as $file=>$info) |
|
| 345 | { |
|
| 346 | //Font file embedding |
|
| 347 | $this->_newobj(); |
|
| 348 | $this->FontFiles[$file]['n']=$this->n; |
|
| 349 | if(defined('FPDF_FONTPATH')) |
|
| 350 | $file=FPDF_FONTPATH.$file; |
|
| 351 | $size=filesize($file); |
|
| 352 | if(!$size) |
|
| 353 | $this->Error('Font file not found'); |
|
| 354 | $this->_out('<</Length '.$size); |
|
| 355 | if(substr($file,-2)=='.z') |
|
| 356 | $this->_out('/Filter /FlateDecode'); |
|
| 357 | $this->_out('/Length1 '.$info['length1']); |
|
| 358 | if(isset($info['length2'])) |
|
| 359 | $this->_out('/Length2 '.$info['length2'].' /Length3 0'); |
|
| 360 | $this->_out('>>'); |
|
| 361 | $f=fopen($file,'rb'); |
|
| 362 | $this->_putstream(fread($f,$size)); |
|
| 363 | fclose($f); |
|
| 364 | $this->_out('endobj'); |
|
| 365 | } |
|
| 366 | set_magic_quotes_runtime($mqr); |
|
| 367 | foreach($this->fonts as $k=>$font) |
|
| 368 | { |
|
| 369 | //Font objects |
|
| 370 | $this->_newobj(); |
|
| 371 | $this->fonts[$k]['n']=$this->n; |
|
| 372 | $this->_out('<</Type /Font'); |
|
| 373 | if($font['type']=='Type0') |
|
| 374 | $this->_putType0($font); |
|
| 375 | else |
|
| 376 | { |
|
| 377 | $name=$font['name']; |
|
| 378 | $this->_out('/BaseFont /'.$name); |
|
| 379 | if($font['type']=='core') |
|
| 380 | { |
|
| 381 | //Standard font |
|
| 382 | $this->_out('/Subtype /Type1'); |
|
| 383 | if($name!='Symbol' and $name!='ZapfDingbats') |
|
| 384 | $this->_out('/Encoding /WinAnsiEncoding'); |
|
| 385 | } |
|
| 386 | else |
|
| 387 | { |
|
| 388 | //Additional font |
|
| 389 | $this->_out('/Subtype /'.$font['type']); |
|
| 390 | $this->_out('/FirstChar 32'); |
|
| 391 | $this->_out('/LastChar 255'); |
|
| 392 | $this->_out('/Widths '.($this->n+1).' 0 R'); |
|
| 393 | $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); |
|
| 394 | if($font['enc']) |
|
| 395 | { |
|
| 396 | if(isset($font['diff'])) |
|
| 397 | $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); |
|
| 398 | else |
|
| 399 | $this->_out('/Encoding /WinAnsiEncoding'); |
|
| 400 | } |
|
| 401 | } |
|
| 402 | $this->_out('>>'); |
|
| 403 | $this->_out('endobj'); |
|
| 404 | if($font['type']!='core') |
|
| 405 | { |
|
| 406 | //Widths |
|
| 407 | $this->_newobj(); |
|
| 408 | $cw=&$font['cw']; |
|
| 409 | $s='['; |
|
| 410 | for($i=32;$i<=255;$i++) |
|
| 411 | $s.=$cw[chr($i)].' '; |
|
| 412 | $this->_out($s.']'); |
|
| 413 | $this->_out('endobj'); |
|
| 414 | //Descriptor |
|
| 415 | $this->_newobj(); |
|
| 416 | $s='<</Type /FontDescriptor /FontName /'.$name; |
|
| 417 | foreach($font['desc'] as $k=>$v) |
|
| 418 | $s.=' /'.$k.' '.$v; |
|
| 419 | $file=$font['file']; |
|
| 420 | if($file) |
|
| 421 | $s.=' /FontFile'.($font['type']=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; |
|
| 422 | $this->_out($s.'>>'); |
|
| 423 | $this->_out('endobj'); |
|
| 424 | } |
|
| 425 | } |
|
| 426 | } |
|
| 427 | } |
|
| 428 | ||
| 429 | function _putType0($font) |
|
| 430 | { |
|
| @@ 286-381 (lines=96) @@ | ||
| 283 | $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j,$i-$j),0,0,'',0,$link); |
|
| 284 | } |
|
| 285 | ||
| 286 | function _putfonts() |
|
| 287 | { |
|
| 288 | $nf=$this->n; |
|
| 289 | foreach($this->diffs as $diff) |
|
| 290 | { |
|
| 291 | //Encodings |
|
| 292 | $this->_newobj(); |
|
| 293 | $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>'); |
|
| 294 | $this->_out('endobj'); |
|
| 295 | } |
|
| 296 | $mqr=get_magic_quotes_runtime(); |
|
| 297 | set_magic_quotes_runtime(0); |
|
| 298 | foreach($this->FontFiles as $file=>$info) |
|
| 299 | { |
|
| 300 | //Font file embedding |
|
| 301 | $this->_newobj(); |
|
| 302 | $this->FontFiles[$file]['n']=$this->n; |
|
| 303 | if(defined('FPDF_FONTPATH')) |
|
| 304 | $file=FPDF_FONTPATH.$file; |
|
| 305 | $size=filesize($file); |
|
| 306 | if(!$size) |
|
| 307 | $this->Error('Font file not found'); |
|
| 308 | $this->_out('<</Length '.$size); |
|
| 309 | if(substr($file,-2)=='.z') |
|
| 310 | $this->_out('/Filter /FlateDecode'); |
|
| 311 | $this->_out('/Length1 '.$info['length1']); |
|
| 312 | if(isset($info['length2'])) |
|
| 313 | $this->_out('/Length2 '.$info['length2'].' /Length3 0'); |
|
| 314 | $this->_out('>>'); |
|
| 315 | $f=fopen($file,'rb'); |
|
| 316 | $this->_putstream(fread($f,$size)); |
|
| 317 | fclose($f); |
|
| 318 | $this->_out('endobj'); |
|
| 319 | } |
|
| 320 | set_magic_quotes_runtime($mqr); |
|
| 321 | foreach($this->fonts as $k=>$font) |
|
| 322 | { |
|
| 323 | //Font objects |
|
| 324 | $this->_newobj(); |
|
| 325 | $this->fonts[$k]['n']=$this->n; |
|
| 326 | $this->_out('<</Type /Font'); |
|
| 327 | if($font['type']=='Type0') |
|
| 328 | $this->_putType0($font); |
|
| 329 | else |
|
| 330 | { |
|
| 331 | $name=$font['name']; |
|
| 332 | $this->_out('/BaseFont /'.$name); |
|
| 333 | if($font['type']=='core') |
|
| 334 | { |
|
| 335 | //Standard font |
|
| 336 | $this->_out('/Subtype /Type1'); |
|
| 337 | if($name!='Symbol' and $name!='ZapfDingbats') |
|
| 338 | $this->_out('/Encoding /WinAnsiEncoding'); |
|
| 339 | } |
|
| 340 | else |
|
| 341 | { |
|
| 342 | //Additional font |
|
| 343 | $this->_out('/Subtype /'.$font['type']); |
|
| 344 | $this->_out('/FirstChar 32'); |
|
| 345 | $this->_out('/LastChar 255'); |
|
| 346 | $this->_out('/Widths '.($this->n+1).' 0 R'); |
|
| 347 | $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); |
|
| 348 | if($font['enc']) |
|
| 349 | { |
|
| 350 | if(isset($font['diff'])) |
|
| 351 | $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); |
|
| 352 | else |
|
| 353 | $this->_out('/Encoding /WinAnsiEncoding'); |
|
| 354 | } |
|
| 355 | } |
|
| 356 | $this->_out('>>'); |
|
| 357 | $this->_out('endobj'); |
|
| 358 | if($font['type']!='core') |
|
| 359 | { |
|
| 360 | //Widths |
|
| 361 | $this->_newobj(); |
|
| 362 | $cw=&$font['cw']; |
|
| 363 | $s='['; |
|
| 364 | for($i=32;$i<=255;$i++) |
|
| 365 | $s.=$cw[chr($i)].' '; |
|
| 366 | $this->_out($s.']'); |
|
| 367 | $this->_out('endobj'); |
|
| 368 | //Descriptor |
|
| 369 | $this->_newobj(); |
|
| 370 | $s='<</Type /FontDescriptor /FontName /'.$name; |
|
| 371 | foreach($font['desc'] as $k=>$v) |
|
| 372 | $s.=' /'.$k.' '.$v; |
|
| 373 | $file=$font['file']; |
|
| 374 | if($file) |
|
| 375 | $s.=' /FontFile'.($font['type']=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; |
|
| 376 | $this->_out($s.'>>'); |
|
| 377 | $this->_out('endobj'); |
|
| 378 | } |
|
| 379 | } |
|
| 380 | } |
|
| 381 | } |
|
| 382 | ||
| 383 | function _putType0($font) |
|
| 384 | { |
|