PluginProbe
Welcart e-Commerce / 2.12.4
Welcart e-Commerce v2.12.4
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
← All changes | classes/fpdf/mbfpdi.php +620 -620 1.4.122.12.4 View file →
@@ -1,620 +1,620 @@
1 -<?php
2 -//-------------------------------------------------------------------------
3 -// Multi-Byte FPDF version: 1.0b
4 -//-------------------------------------------------------------------------
5 -// Usage: AddMBFont(FontName,Encoding);
6 -//
7 -// Example:
8 -// Chinese: AddMBFont(BIG5 ,'BIG5');
9 -// Japanese: AddMBFont(GOTHIC,'SJIS');
10 -
11 -require(USCES_PLUGIN_DIR.'/classes/fpdf/fpdi.php'); // Original Class
12 -require(USCES_PLUGIN_DIR.'/classes/fpdf/font/mbttfdef.php'); // Multi-Byte TrueType Font Define
13 -
14 -// FPDF Version Check
15 -if ((float) FPDF_VERSION < 1.51) die("You need FPDF version 1.51");
16 -
17 -// Encoding & CMap List (CMap information from Acrobat Reader Resource/CMap folder)
18 -$MBCMAP['BIG5'] = array ('CMap'=>'ETenms-B5-H' ,'Ordering'=>'CNS1' ,'Supplement'=>0);
19 -$MBCMAP['GB'] = array ('CMap'=>'GBKp-EUC-H' ,'Ordering'=>'GB1' ,'Supplement'=>2);
20 -$MBCMAP['SJIS'] = array ('CMap'=>'90msp-RKSJ-H' ,'Ordering'=>'Japan1','Supplement'=>2);
21 -$MBCMAP['UNIJIS'] = array ('CMap'=>'UniJIS-UTF16-H','Ordering'=>'Japan1','Supplement'=>5);
22 -$MBCMAP['EUC-JP'] = array ('CMap'=>'EUC-H' ,'Ordering'=>'Japan1','Supplement'=>1);
23 -// EUC-JP has *problem* of underline and not support half-pitch characters.
24 -
25 -// if you want convert encoding to SJIS from EUC-JP, you must change $EUC2SJIS to true.
26 -$EUC2SJIS = false;
27 -
28 -// Short Font Name ------------------------------------------------------------
29 -// For Acrobat Reader (Windows, MacOS, Linux, Solaris etc)
30 -if(!defined("BIG5"))
31 - DEFINE("BIG5", 'MSungStd-Light-Acro');
32 -if(!defined("GB"))
33 - DEFINE("GB", 'STSongStd-Light-Acro');
34 -if(!defined("KOZMIN"))
35 - DEFINE("KOZMIN", 'KozMinPro-Regular-Acro');
36 -// For Japanese Windows Only
37 -if(!defined("GOTHIC"))
38 - DEFINE("GOTHIC", 'MS-Gothic');
39 -if(!defined("PGOTHIC"))
40 - DEFINE("PGOTHIC", 'MS-PGothic');
41 -if(!defined("UIGOTHIC"))
42 - DEFINE("UIGOTHIC",'MS-UIGothic');
43 -if(!defined("MINCHO"))
44 - DEFINE("MINCHO", 'MS-Mincho');
45 -if(!defined("PMINCHO"))
46 - DEFINE("PMINCHO", 'MS-PMincho');
47 -
48 -class MBfpdi extends fpdi
49 -{
50 -
51 -// For Outline, Title, Sub-Title and ETC Multi-Byte Encoding
52 -function _unicode($txt)
53 -{
54 - if (function_exists('mb_detect_encoding')) {
55 - if (mb_detect_encoding($txt) != "ASCII") {
56 - $txt = chr(254).chr(255).mb_convert_encoding($txt,"UTF-16","auto");
57 - }
58 - }
59 - return $txt;
60 -}
61 -
62 -function AddCIDFont($family,$style,$name,$cw,$CMap,$registry,$ut,$up)
63 -{
64 - $i=count($this->fonts)+1;
65 - $fontkey=strtolower($family).strtoupper($style);
66 - $this->fonts[$fontkey] =
67 - array('i'=>$i,'type'=>'Type0','name'=>$name,'up'=>$up,'ut'=>$ut,'cw'=>$cw,'CMap'=>$CMap,'registry'=>$registry);
68 -}
69 -
70 -function AddMBFont($family='',$enc='')
71 -{
72 -// global $MBTTFDEF,$MBCMAP;
73 -// $gt=$MBTTFDEF;
74 -// $gc=$MBCMAP;
75 - $gt=$this->setMBTTFDEF();
76 - $gc=$this->setMBCMAP();
77 -
78 - if ($enc == '' || isset($gc[$enc]) == false) {
79 - die("AddMBFont: ERROR Encoding [$enc] Undefine.");
80 - }
81 - if (isset($gt[$family])) {
82 - $ut=$gt[$family]['ut'];
83 - $up=$gt[$family]['up'];
84 - $cw=$gt[$family]['cw'];
85 - $cm=$gc[$enc]['CMap'];
86 - $od=$gc[$enc]['Ordering'];
87 - $sp=$gc[$enc]['Supplement'];
88 - $registry=array('ordering'=>$od,'supplement'=>$sp);
89 - $this->AddCIDFont($family,'' ,"$family" ,$cw,$cm,$registry,$ut,$up);
90 - $this->AddCIDFont($family,'B' ,"$family,Bold" ,$cw,$cm,$registry,$ut,$up);
91 - $this->AddCIDFont($family,'I' ,"$family,Italic" ,$cw,$cm,$registry,$ut,$up);
92 - $this->AddCIDFont($family,'BI',"$family,BoldItalic",$cw,$cm,$registry,$ut,$up);
93 - } else {
94 - die("AddMBFont: ERROR FontName [$family] Undefine.");
95 - }
96 -}
97 -
98 -function GetStringWidth($s)
99 -{
100 - if($this->CurrentFont['type']=='Type0')
101 - return $this->GetMBStringWidth($s);
102 - else
103 - return parent::GetStringWidth($s);
104 -}
105 -
106 -function GetMBStringWidth($s)
107 -{
108 - //Multi-byte version of GetStringWidth()
109 - $l=0;
110 - $cw=&$this->CurrentFont['cw'];
111 - $japanese = ($this->CurrentFont['registry']['ordering'] == 'Japan1');
112 - $nb=strlen($s);
113 - $i=0;
114 - while($i<$nb)
115 - {
116 - $c=$s[$i];
117 - if(ord($c)<128)
118 - {
119 - $l+=$cw[$c];
120 - $i++;
121 - }
122 - else
123 - {
124 - $hwkana = ($japanese && ord($c)==142);
125 - $l+=$hwkana ? 500 : 1000;
126 - $i+=2;
127 - }
128 - }
129 - return $l*$this->FontSize/1000;
130 -}
131 -
132 -// Function Cell override for Encode Change.
133 -function Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '')
134 -{
135 -
136 - $k = $this->k;
137 -
138 - if ($this->y + $h > $this->PageBreakTrigger
139 - && !$this->InFooter
140 - && $this->AcceptPageBreak()) {
141 - $x = $this->x;
142 - $ws = $this->ws;
143 - if ($ws > 0) {
144 - $this->ws = 0;
145 - $this->_out('0 Tw');
146 - }
147 - $this->AddPage($this->CurOrientation);
148 - $this->x = $x;
149 - if ($ws > 0) {
150 - $this->ws = $ws;
151 - $this->_out(sprintf('%.3f Tw', $ws * $k));
152 - }
153 - } // end if
154 -
155 - if ($w == 0) {
156 - $w = $this->w - $this->rMargin - $this->x;
157 - }
158 -
159 - $s = '';
160 - if ($fill == 1 || $border == 1) {
161 - if ($fill == 1) {
162 - $op = ($border == 1) ? 'B' : 'f';
163 - } else {
164 - $op = 'S';
165 - }
166 - $s = sprintf('%.2f %.2f %.2f %.2f re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op);
167 - } // end if
168 -
169 - if (is_string($border)) {
170 - $x = $this->x;
171 - $y = $this->y;
172 - if (strpos(' ' . $border, 'L')) {
173 - $s .= sprintf('%.2f %.2f m %.2f %.2f l S ', $x * $k, ($this->h - $y) * $k, $x * $k, ($this->h - ($y+$h)) * $k);
174 - }
175 - if (strpos(' ' . $border, 'T')) {
176 - $s .= sprintf('%.2f %.2f m %.2f %.2f l S ', $x * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - $y) * $k);
177 - }
178 - if (strpos(' ' . $border, 'R')) {
179 - $s .= sprintf('%.2f %.2f m %.2f %.2f l S ', ($x + $w) * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - ($y + $h)) * $k);
180 - }
181 - if (strpos(' ' . $border, 'B')) {
182 - $s .= sprintf('%.2f %.2f m %.2f %.2f l S ', $x * $k, ($this->h - ($y + $h)) * $k, ($x + $w) * $k, ($this->h - ($y + $h)) * $k);
183 - }
184 - } // end if
185 -
186 - if ($txt != '') {
187 - if ($align == 'R') {
188 - $dx = $w - $this->cMargin - $this->GetStringWidth($txt);
189 - }
190 - else if ($align == 'C') {
191 - $dx = ($w - $this->GetStringWidth($txt)) / 2;
192 - }
193 - else {
194 - $dx = $this->cMargin;
195 - }
196 - // For Japanese Encode Change
197 - global $EUC2SJIS;
198 - if ($EUC2SJIS && function_exists('mb_convert_encoding')) {
199 - $txt = mb_convert_encoding($txt,"SJIS","EUC-JP");
200 - }
201 - $txt = str_replace(')', '\\)', str_replace('(', '\\(', str_replace('\\', '\\\\', $txt)));
202 - if ($this->ColorFlag) {
203 - $s .= 'q ' . $this->TextColor . ' ';
204 - }
205 - $s .= sprintf('BT %.2f %.2f Td (%s) Tj ET', ($this->x + $dx) * $k, ($this->h - ($this->y + .5 * $h + .3 * $this->FontSize)) * $k, $txt);
206 - $txt = stripslashes($txt);
207 - if ($this->underline) {
208 - $s .= ' ' . $this->_dounderline($this->x+$dx, $this->y + .5 * $h + .3 * $this->FontSize, $txt);
209 - }
210 - if ($this->ColorFlag) {
211 - $s .= ' Q';
212 - }
213 - if ($link) {
214 - $this->Link($this->x + $dx, $this->y + .5 * $h - .5 * $this->FontSize, $this->GetStringWidth($txt), $this->FontSize, $link);
215 - }
216 - } // end if
217 -
218 - if ($s) {
219 - $this->_out($s);
220 - }
221 - $this->lasth = $h;
222 -
223 - if ($ln > 0) {
224 - // Go to next line
225 - $this->y += $h;
226 - if ($ln == 1) {
227 - $this->x = $this->lMargin;
228 - }
229 - } else {
230 - $this->x += $w;
231 - }
232 -} // end of the "Cell()" method
233 -
234 -function MultiCell($w,$h,$txt,$border=0,$align='L',$fill=0)
235 -{
236 - if($this->CurrentFont['type']=='Type0')
237 - $this->MBMultiCell($w,$h,$txt,$border,$align,$fill);
238 - else
239 - parent::MultiCell($w,$h,$txt,$border,$align,$fill);
240 -}
241 -
242 -function MBMultiCell($w,$h,$txt,$border=0,$align='L',$fill=0)
243 -{
244 - //Multi-byte version of MultiCell()
245 - $cw=&$this->CurrentFont['cw'];
246 - $japanese = ($this->CurrentFont['registry']['ordering'] == 'Japan1');
247 - if($w==0)
248 - $w=$this->w-$this->rMargin-$this->x;
249 - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
250 - $s=str_replace("\r",'',$txt);
251 - $nb=strlen($s);
252 - if($nb>0 and $s[$nb-1]=="\n")
253 - $nb--;
254 - $b=0;
255 - if($border)
256 - {
257 - if($border==1)
258 - {
259 - $border='LTRB';
260 - $b='LRT';
261 - $b2='LR';
262 - }
263 - else
264 - {
265 - $b2='';
266 - if(is_int(strpos($border,'L')))
267 - $b2.='L';
268 - if(is_int(strpos($border,'R')))
269 - $b2.='R';
270 - $b=is_int(strpos($border,'T')) ? $b2.'T' : $b2;
271 - }
272 - }
273 - $sep=-1;
274 - $i=0;
275 - $j=0;
276 - $l=0;
277 - $ns=0;
278 - $nl=1;
279 - $ascii=true;
280 - while($i<$nb)
281 - {
282 - //Get next character
283 - $c=$s[$i];
284 - //Check if ASCII or MB
285 - $prev_ascii=$ascii;
286 - $ascii=(ord($c)<128);
287 - $hwkana = ($japanese && ord($c)==142);
288 - if($c=="\n")
289 - {
290 - //Explicit line break
291 - if($this->ws>0)
292 - {
293 - $this->ws=0;
294 - $this->_out('0 Tw');
295 - }
296 - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
297 - $i++;
298 - $sep=-1;
299 - $j=$i;
300 - $l=0;
301 - $ns=0;
302 - $nl++;
303 - if($border and $nl==2)
304 - $b=$b2;
305 - continue;
306 - }
307 - if(!($ascii && $prev_ascii) && $i != $j)
308 - {
309 - $sep=$i;
310 - $ls=$l;
311 - }
312 - elseif($c==' ')
313 - {
314 - $sep=$i;
315 - $ls=$l;
316 - $ns++;
317 - }
318 - $l+=$ascii ? $cw[$c] : $hwkana ? 500 : 1000;
319 - if($l>$wmax)
320 - {
321 - //Automatic line break
322 - if($sep==-1)
323 - {
324 - if($i==$j)
325 - $i+=$ascii ? 1 : 2;
326 - if($this->ws>0)
327 - {
328 - $this->ws=0;
329 - $this->_out('0 Tw');
330 - }
331 - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
332 - }
333 - else
334 - {
335 - if($align=='J')
336 - {
337 - if($s[$sep]==' ')
338 - $ns--;
339 - if($s[$i-1]==' ')
340 - {
341 - $ns--;
342 - $ls-=$cw[' '];
343 - }
344 - $this->ws=($ns>0) ? ($wmax-$ls)/1000*$this->FontSize/$ns : 0;
345 - $this->_out(sprintf('%.3f Tw',$this->ws*$this->k));
346 - }
347 - $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
348 - $i=($s[$sep]==' ') ? $sep+1 : $sep;
349 - }
350 - $sep=-1;
351 - $j=$i;
352 - $l=0;
353 - $ns=0;
354 - $nl++;
355 - if($border and $nl==2)
356 - $b=$b2;
357 - }
358 - else
359 - $i+=$ascii ? 1 : 2;
360 - }
361 - //Last chunk
362 - if($this->ws>0)
363 - {
364 - $this->ws=0;
365 - $this->_out('0 Tw');
366 - }
367 - if($border and is_int(strpos($border,'B')))
368 - $b.='B';
369 - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
370 - $this->x=$this->lMargin;
371 -}
372 -
373 -function Write($h,$txt,$link='')
374 -{
375 - if($this->CurrentFont['type']=='Type0')
376 - $this->MBWrite($h,$txt,$link);
377 - else
378 - parent::Write($h,$txt,$link);
379 -}
380 -
381 -function MBWrite($h,$txt,$link)
382 -{
383 - //Multi-byte version of Write()
384 - $cw=&$this->CurrentFont['cw'];
385 - $japanese = ($this->CurrentFont['registry']['ordering'] == 'Japan1');
386 - $w=$this->w-$this->rMargin-$this->x;
387 - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
388 - $s=str_replace("\r",'',$txt);
389 - $nb=strlen($s);
390 - $sep=-1;
391 - $i=0;
392 - $j=0;
393 - $l=0;
394 - $nl=1;
395 - while($i<$nb)
396 - {
397 - //Get next character
398 - $c=$s[$i];
399 - //Check if ASCII or MB
400 - $ascii=(ord($c)<128);
401 - $hwkana = ($japanese && ord($c)==142);
402 - if($c=="\n")
403 - {
404 - //Explicit line break
405 - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
406 - $i++;
407 - $sep=-1;
408 - $j=$i;
409 - $l=0;
410 - if($nl==1)
411 - {
412 - $this->x=$this->lMargin;
413 - $w=$this->w-$this->rMargin-$this->x;
414 - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
415 - }
416 - $nl++;
417 - continue;
418 - }
419 - if(!$ascii or $c==' ')
420 - $sep=$i;
421 - $l+=$ascii ? $cw[$c] : $hwkana ? 500 : 1000;
422 - if($l>$wmax)
423 - {
424 - //Automatic line break
425 - if($sep==-1 or $i==$j)
426 - {
427 - if($this->x>$this->lMargin)
428 - {
429 - //Move to next line
430 - $this->x=$this->lMargin;
431 - $this->y+=$h;
432 - $w=$this->w-$this->rMargin-$this->x;
433 - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
434 - $i++;
435 - $nl++;
436 - continue;
437 - }
438 - if($i==$j)
439 - $i+=$ascii ? 1 : 2;
440 - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
441 - }
442 - else
443 - {
444 - $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link);
445 - $i=($s[$sep]==' ') ? $sep+1 : $sep;
446 - }
447 - $sep=-1;
448 - $j=$i;
449 - $l=0;
450 - if($nl==1)
451 - {
452 - $this->x=$this->lMargin;
453 - $w=$this->w-$this->rMargin-$this->x;
454 - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
455 - }
456 - $nl++;
457 - }
458 - else
459 - $i+=$ascii ? 1 : 2;
460 - }
461 - //Last chunk
462 - if($i!=$j)
463 - $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j,$i-$j),0,0,'',0,$link);
464 -}
465 -
466 -function _putfonts()
467 -{
468 - $nf=$this->n;
469 - foreach($this->diffs as $diff)
470 - {
471 - //Encodings
472 - $this->_newobj();
473 - $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
474 - $this->_out('endobj');
475 - }
476 -// $mqr=get_magic_quotes_runtime();
477 -// set_magic_quotes_runtime(0);
478 - foreach($this->FontFiles as $file=>$info)
479 - {
480 - //Font file embedding
481 - $this->_newobj();
482 - $this->FontFiles[$file]['n']=$this->n;
483 - if(defined('FPDF_FONTPATH'))
484 - $file=FPDF_FONTPATH.$file;
485 - $size=filesize($file);
486 - if(!$size)
487 - $this->Error('Font file not found');
488 - $this->_out('<</Length '.$size);
489 - if(substr($file,-2)=='.z')
490 - $this->_out('/Filter /FlateDecode');
491 - $this->_out('/Length1 '.$info['length1']);
492 - if(isset($info['length2']))
493 - $this->_out('/Length2 '.$info['length2'].' /Length3 0');
494 - $this->_out('>>');
495 - $f=fopen($file,'rb');
496 - $this->_putstream(fread($f,$size));
497 - fclose($f);
498 - $this->_out('endobj');
499 - }
500 -// set_magic_quotes_runtime($mqr);
501 - foreach($this->fonts as $k=>$font)
502 - {
503 - //Font objects
504 - $this->_newobj();
505 - $this->fonts[$k]['n']=$this->n;
506 - $this->_out('<</Type /Font');
507 - if($font['type']=='Type0')
508 - $this->_putType0($font);
509 - else
510 - {
511 - $name=$font['name'];
512 - $this->_out('/BaseFont /'.$name);
513 - if($font['type']=='core')
514 - {
515 - //Standard font
516 - $this->_out('/Subtype /Type1');
517 - if($name!='Symbol' and $name!='ZapfDingbats')
518 - $this->_out('/Encoding /WinAnsiEncoding');
519 - }
520 - else
521 - {
522 - //Additional font
523 - $this->_out('/Subtype /'.$font['type']);
524 - $this->_out('/FirstChar 32');
525 - $this->_out('/LastChar 255');
526 - $this->_out('/Widths '.($this->n+1).' 0 R');
527 - $this->_out('/FontDescriptor '.($this->n+2).' 0 R');
528 - if($font['enc'])
529 - {
530 - if(isset($font['diff']))
531 - $this->_out('/Encoding '.($nf+$font['diff']).' 0 R');
532 - else
533 - $this->_out('/Encoding /WinAnsiEncoding');
534 - }
535 - }
536 - $this->_out('>>');
537 - $this->_out('endobj');
538 - if($font['type']!='core')
539 - {
540 - //Widths
541 - $this->_newobj();
542 - $cw=&$font['cw'];
543 - $s='[';
544 - for($i=32;$i<=255;$i++)
545 - $s.=$cw[chr($i)].' ';
546 - $this->_out($s.']');
547 - $this->_out('endobj');
548 - //Descriptor
549 - $this->_newobj();
550 - $s='<</Type /FontDescriptor /FontName /'.$name;
551 - foreach($font['desc'] as $k=>$v)
552 - $s.=' /'.$k.' '.$v;
553 - $file=$font['file'];
554 - if($file)
555 - $s.=' /FontFile'.($font['type']=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R';
556 - $this->_out($s.'>>');
557 - $this->_out('endobj');
558 - }
559 - }
560 - }
561 -}
562 -
563 -function _putType0($font)
564 -{
565 - //Type0
566 - $this->_out('/Subtype /Type0');
567 - $this->_out('/BaseFont /'.$font['name'].'-'.$font['CMap']);
568 - $this->_out('/Encoding /'.$font['CMap']);
569 - $this->_out('/DescendantFonts ['.($this->n+1).' 0 R]');
570 - $this->_out('>>');
571 - $this->_out('endobj');
572 - //CIDFont
573 - $this->_newobj();
574 - $this->_out('<</Type /Font');
575 - $this->_out('/Subtype /CIDFontType0');
576 - $this->_out('/BaseFont /'.$font['name']);
577 - $this->_out('/CIDSystemInfo <</Registry (Adobe) /Ordering ('.$font['registry']['ordering'].') /Supplement '.$font['registry']['supplement'].'>>');
578 - $this->_out('/FontDescriptor '.($this->n+1).' 0 R');
579 - $W='/W [1 [';
580 - foreach($font['cw'] as $w)
581 - $W.=$w.' ';
582 - $this->_out($W.']');
583 - if($font['registry']['ordering'] == 'Japan1')
584 - $this->_out(' 231 325 500 631 [500] 326 389 500');
585 - $this->_out(']');
586 - $this->_out('>>');
587 - $this->_out('endobj');
588 - //Font descriptor
589 - $this->_newobj();
590 - $this->_out('<</Type /FontDescriptor');
591 - $this->_out('/FontName /'.$font['name']);
592 - $this->_out('/Flags 6');
593 - $this->_out('/FontBBox [0 0 1000 1000]');
594 - $this->_out('/ItalicAngle 0');
595 - $this->_out('/Ascent 1000');
596 - $this->_out('/Descent 0');
597 - $this->_out('/CapHeight 1000');
598 - $this->_out('/StemV 10');
599 - $this->_out('>>');
600 - $this->_out('endobj');
601 -}
602 -
603 - function setMBTTFDEF(){
604 - require(USCES_PLUGIN_DIR.'/classes/fpdf/font/mbttfdef.php'); // Multi-Byte TrueType Font Define
605 - return $MBTTFDEF;
606 -
607 - }
608 -
609 - function setMBCMAP(){
610 - // Encoding & CMap List (CMap information from Acrobat Reader Resource/CMap folder)
611 - $MBCMAP['BIG5'] = array ('CMap'=>'ETenms-B5-H' ,'Ordering'=>'CNS1' ,'Supplement'=>0);
612 - $MBCMAP['GB'] = array ('CMap'=>'GBKp-EUC-H' ,'Ordering'=>'GB1' ,'Supplement'=>2);
613 - $MBCMAP['SJIS'] = array ('CMap'=>'90msp-RKSJ-H' ,'Ordering'=>'Japan1','Supplement'=>2);
614 - $MBCMAP['UNIJIS'] = array ('CMap'=>'UniJIS-UTF16-H','Ordering'=>'Japan1','Supplement'=>5);
615 - $MBCMAP['EUC-JP'] = array ('CMap'=>'EUC-H' ,'Ordering'=>'Japan1','Supplement'=>1);
616 - return $MBCMAP;
617 - }
618 -
619 -}
620 -?>
1 +<?php
2 +//-------------------------------------------------------------------------
3 +// Multi-Byte FPDF version: 1.0b
4 +//-------------------------------------------------------------------------
5 +// Usage: AddMBFont(FontName,Encoding);
6 +//
7 +// Example:
8 +// Chinese: AddMBFont(BIG5 ,'BIG5');
9 +// Japanese: AddMBFont(GOTHIC,'SJIS');
10 +
11 +require(USCES_PLUGIN_DIR.'/classes/fpdf/fpdi.php'); // Original Class
12 +require(USCES_PLUGIN_DIR.'/classes/fpdf/font/mbttfdef.php'); // Multi-Byte TrueType Font Define
13 +
14 +// FPDF Version Check
15 +if ((float) FPDF_VERSION < 1.51) die("You need FPDF version 1.51");
16 +
17 +// Encoding & CMap List (CMap information from Acrobat Reader Resource/CMap folder)
18 +$MBCMAP['BIG5'] = array ('CMap'=>'ETenms-B5-H' ,'Ordering'=>'CNS1' ,'Supplement'=>0);
19 +$MBCMAP['GB'] = array ('CMap'=>'GBKp-EUC-H' ,'Ordering'=>'GB1' ,'Supplement'=>2);
20 +$MBCMAP['SJIS'] = array ('CMap'=>'90msp-RKSJ-H' ,'Ordering'=>'Japan1','Supplement'=>2);
21 +$MBCMAP['UNIJIS'] = array ('CMap'=>'UniJIS-UTF16-H','Ordering'=>'Japan1','Supplement'=>5);
22 +$MBCMAP['EUC-JP'] = array ('CMap'=>'EUC-H' ,'Ordering'=>'Japan1','Supplement'=>1);
23 +// EUC-JP has *problem* of underline and not support half-pitch characters.
24 +
25 +// if you want convert encoding to SJIS from EUC-JP, you must change $EUC2SJIS to true.
26 +$EUC2SJIS = false;
27 +
28 +// Short Font Name ------------------------------------------------------------
29 +// For Acrobat Reader (Windows, MacOS, Linux, Solaris etc)
30 +if(!defined("BIG5"))
31 + DEFINE("BIG5", 'MSungStd-Light-Acro');
32 +if(!defined("GB"))
33 + DEFINE("GB", 'STSongStd-Light-Acro');
34 +if(!defined("KOZMIN"))
35 + DEFINE("KOZMIN", 'KozMinPro-Regular-Acro');
36 +// For Japanese Windows Only
37 +if(!defined("GOTHIC"))
38 + DEFINE("GOTHIC", 'MS-Gothic');
39 +if(!defined("PGOTHIC"))
40 + DEFINE("PGOTHIC", 'MS-PGothic');
41 +if(!defined("UIGOTHIC"))
42 + DEFINE("UIGOTHIC",'MS-UIGothic');
43 +if(!defined("MINCHO"))
44 + DEFINE("MINCHO", 'MS-Mincho');
45 +if(!defined("PMINCHO"))
46 + DEFINE("PMINCHO", 'MS-PMincho');
47 +
48 +class MBfpdi extends fpdi
49 +{
50 +
51 +// For Outline, Title, Sub-Title and ETC Multi-Byte Encoding
52 +function _unicode($txt)
53 +{
54 + if (function_exists('mb_detect_encoding')) {
55 + if (mb_detect_encoding($txt) != "ASCII") {
56 + $txt = chr(254).chr(255).mb_convert_encoding($txt,"UTF-16","auto");
57 + }
58 + }
59 + return $txt;
60 +}
61 +
62 +function AddCIDFont($family,$style,$name,$cw,$CMap,$registry,$ut,$up)
63 +{
64 + $i=count($this->fonts)+1;
65 + $fontkey=strtolower($family).strtoupper($style);
66 + $this->fonts[$fontkey] =
67 + array('i'=>$i,'type'=>'Type0','name'=>$name,'up'=>$up,'ut'=>$ut,'cw'=>$cw,'CMap'=>$CMap,'registry'=>$registry);
68 +}
69 +
70 +function AddMBFont($family='',$enc='')
71 +{
72 +// global $MBTTFDEF,$MBCMAP;
73 +// $gt=$MBTTFDEF;
74 +// $gc=$MBCMAP;
75 + $gt=$this->setMBTTFDEF();
76 + $gc=$this->setMBCMAP();
77 +
78 + if ($enc == '' || isset($gc[$enc]) == false) {
79 + die("AddMBFont: ERROR Encoding [$enc] Undefine.");
80 + }
81 + if (isset($gt[$family])) {
82 + $ut=$gt[$family]['ut'];
83 + $up=$gt[$family]['up'];
84 + $cw=$gt[$family]['cw'];
85 + $cm=$gc[$enc]['CMap'];
86 + $od=$gc[$enc]['Ordering'];
87 + $sp=$gc[$enc]['Supplement'];
88 + $registry=array('ordering'=>$od,'supplement'=>$sp);
89 + $this->AddCIDFont($family,'' ,"$family" ,$cw,$cm,$registry,$ut,$up);
90 + $this->AddCIDFont($family,'B' ,"$family,Bold" ,$cw,$cm,$registry,$ut,$up);
91 + $this->AddCIDFont($family,'I' ,"$family,Italic" ,$cw,$cm,$registry,$ut,$up);
92 + $this->AddCIDFont($family,'BI',"$family,BoldItalic",$cw,$cm,$registry,$ut,$up);
93 + } else {
94 + die("AddMBFont: ERROR FontName [$family] Undefine.");
95 + }
96 +}
97 +
98 +function GetStringWidth($s)
99 +{
100 + if($this->CurrentFont['type']=='Type0')
101 + return $this->GetMBStringWidth($s);
102 + else
103 + return parent::GetStringWidth($s);
104 +}
105 +
106 +function GetMBStringWidth($s)
107 +{
108 + //Multi-byte version of GetStringWidth()
109 + $l=0;
110 + $cw=&$this->CurrentFont['cw'];
111 + $japanese = ($this->CurrentFont['registry']['ordering'] == 'Japan1');
112 + $nb=strlen($s);
113 + $i=0;
114 + while($i<$nb)
115 + {
116 + $c=$s[$i];
117 + if(ord($c)<128)
118 + {
119 + $l+=$cw[$c];
120 + $i++;
121 + }
122 + else
123 + {
124 + $hwkana = ($japanese && ord($c)==142);
125 + $l+=$hwkana ? 500 : 1000;
126 + $i+=2;
127 + }
128 + }
129 + return $l*$this->FontSize/1000;
130 +}
131 +
132 +// Function Cell override for Encode Change.
133 +function Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '')
134 +{
135 +
136 + $k = $this->k;
137 +
138 + if ($this->y + $h > $this->PageBreakTrigger
139 + && !$this->InFooter
140 + && $this->AcceptPageBreak()) {
141 + $x = $this->x;
142 + $ws = $this->ws;
143 + if ($ws > 0) {
144 + $this->ws = 0;
145 + $this->_out('0 Tw');
146 + }
147 + $this->AddPage($this->CurOrientation);
148 + $this->x = $x;
149 + if ($ws > 0) {
150 + $this->ws = $ws;
151 + $this->_out(sprintf('%.3f Tw', $ws * $k));
152 + }
153 + } // end if
154 +
155 + if ($w == 0) {
156 + $w = $this->w - $this->rMargin - $this->x;
157 + }
158 +
159 + $s = '';
160 + if ($fill == 1 || $border == 1) {
161 + if ($fill == 1) {
162 + $op = ($border == 1) ? 'B' : 'f';
163 + } else {
164 + $op = 'S';
165 + }
166 + $s = sprintf('%.2f %.2f %.2f %.2f re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op);
167 + } // end if
168 +
169 + if (is_string($border)) {
170 + $x = $this->x;
171 + $y = $this->y;
172 + if (strpos(' ' . $border, 'L')) {
173 + $s .= sprintf('%.2f %.2f m %.2f %.2f l S ', $x * $k, ($this->h - $y) * $k, $x * $k, ($this->h - ($y+$h)) * $k);
174 + }
175 + if (strpos(' ' . $border, 'T')) {
176 + $s .= sprintf('%.2f %.2f m %.2f %.2f l S ', $x * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - $y) * $k);
177 + }
178 + if (strpos(' ' . $border, 'R')) {
179 + $s .= sprintf('%.2f %.2f m %.2f %.2f l S ', ($x + $w) * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - ($y + $h)) * $k);
180 + }
181 + if (strpos(' ' . $border, 'B')) {
182 + $s .= sprintf('%.2f %.2f m %.2f %.2f l S ', $x * $k, ($this->h - ($y + $h)) * $k, ($x + $w) * $k, ($this->h - ($y + $h)) * $k);
183 + }
184 + } // end if
185 +
186 + if ($txt != '') {
187 + if ($align == 'R') {
188 + $dx = $w - $this->cMargin - $this->GetStringWidth($txt);
189 + }
190 + else if ($align == 'C') {
191 + $dx = ($w - $this->GetStringWidth($txt)) / 2;
192 + }
193 + else {
194 + $dx = $this->cMargin;
195 + }
196 + // For Japanese Encode Change
197 + global $EUC2SJIS;
198 + if ($EUC2SJIS && function_exists('mb_convert_encoding')) {
199 + $txt = mb_convert_encoding($txt,"SJIS","EUC-JP");
200 + }
201 + $txt = str_replace(')', '\\)', str_replace('(', '\\(', str_replace('\\', '\\\\', $txt)));
202 + if ($this->ColorFlag) {
203 + $s .= 'q ' . $this->TextColor . ' ';
204 + }
205 + $s .= sprintf('BT %.2f %.2f Td (%s) Tj ET', ($this->x + $dx) * $k, ($this->h - ($this->y + .5 * $h + .3 * $this->FontSize)) * $k, $txt);
206 + $txt = stripslashes($txt);
207 + if ($this->underline) {
208 + $s .= ' ' . $this->_dounderline($this->x+$dx, $this->y + .5 * $h + .3 * $this->FontSize, $txt);
209 + }
210 + if ($this->ColorFlag) {
211 + $s .= ' Q';
212 + }
213 + if ($link) {
214 + $this->Link($this->x + $dx, $this->y + .5 * $h - .5 * $this->FontSize, $this->GetStringWidth($txt), $this->FontSize, $link);
215 + }
216 + } // end if
217 +
218 + if ($s) {
219 + $this->_out($s);
220 + }
221 + $this->lasth = $h;
222 +
223 + if ($ln > 0) {
224 + // Go to next line
225 + $this->y += $h;
226 + if ($ln == 1) {
227 + $this->x = $this->lMargin;
228 + }
229 + } else {
230 + $this->x += $w;
231 + }
232 +} // end of the "Cell()" method
233 +
234 +function MultiCell($w,$h,$txt,$border=0,$align='L',$fill=0)
235 +{
236 + if($this->CurrentFont['type']=='Type0')
237 + $this->MBMultiCell($w,$h,$txt,$border,$align,$fill);
238 + else
239 + parent::MultiCell($w,$h,$txt,$border,$align,$fill);
240 +}
241 +
242 +function MBMultiCell($w,$h,$txt,$border=0,$align='L',$fill=0)
243 +{
244 + //Multi-byte version of MultiCell()
245 + $cw=&$this->CurrentFont['cw'];
246 + $japanese = ($this->CurrentFont['registry']['ordering'] == 'Japan1');
247 + if($w==0)
248 + $w=$this->w-$this->rMargin-$this->x;
249 + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
250 + $s=str_replace("\r",'',$txt);
251 + $nb=strlen($s);
252 + if($nb>0 and $s[$nb-1]=="\n")
253 + $nb--;
254 + $b=0;
255 + if($border)
256 + {
257 + if($border==1)
258 + {
259 + $border='LTRB';
260 + $b='LRT';
261 + $b2='LR';
262 + }
263 + else
264 + {
265 + $b2='';
266 + if(is_int(strpos($border,'L')))
267 + $b2.='L';
268 + if(is_int(strpos($border,'R')))
269 + $b2.='R';
270 + $b=is_int(strpos($border,'T')) ? $b2.'T' : $b2;
271 + }
272 + }
273 + $sep=-1;
274 + $i=0;
275 + $j=0;
276 + $l=0;
277 + $ns=0;
278 + $nl=1;
279 + $ascii=true;
280 + while($i<$nb)
281 + {
282 + //Get next character
283 + $c=$s[$i];
284 + //Check if ASCII or MB
285 + $prev_ascii=$ascii;
286 + $ascii=(ord($c)<128);
287 + $hwkana = ($japanese && ord($c)==142);
288 + if($c=="\n")
289 + {
290 + //Explicit line break
291 + if($this->ws>0)
292 + {
293 + $this->ws=0;
294 + $this->_out('0 Tw');
295 + }
296 + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
297 + $i++;
298 + $sep=-1;
299 + $j=$i;
300 + $l=0;
301 + $ns=0;
302 + $nl++;
303 + if($border and $nl==2)
304 + $b=$b2;
305 + continue;
306 + }
307 + if(!($ascii && $prev_ascii) && $i != $j)
308 + {
309 + $sep=$i;
310 + $ls=$l;
311 + }
312 + elseif($c==' ')
313 + {
314 + $sep=$i;
315 + $ls=$l;
316 + $ns++;
317 + }
318 + $l+=$ascii ? $cw[$c] : $hwkana ? 500 : 1000;
319 + if($l>$wmax)
320 + {
321 + //Automatic line break
322 + if($sep==-1)
323 + {
324 + if($i==$j)
325 + $i+=$ascii ? 1 : 2;
326 + if($this->ws>0)
327 + {
328 + $this->ws=0;
329 + $this->_out('0 Tw');
330 + }
331 + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
332 + }
333 + else
334 + {
335 + if($align=='J')
336 + {
337 + if($s[$sep]==' ')
338 + $ns--;
339 + if($s[$i-1]==' ')
340 + {
341 + $ns--;
342 + $ls-=$cw[' '];
343 + }
344 + $this->ws=($ns>0) ? ($wmax-$ls)/1000*$this->FontSize/$ns : 0;
345 + $this->_out(sprintf('%.3f Tw',$this->ws*$this->k));
346 + }
347 + $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
348 + $i=($s[$sep]==' ') ? $sep+1 : $sep;
349 + }
350 + $sep=-1;
351 + $j=$i;
352 + $l=0;
353 + $ns=0;
354 + $nl++;
355 + if($border and $nl==2)
356 + $b=$b2;
357 + }
358 + else
359 + $i+=$ascii ? 1 : 2;
360 + }
361 + //Last chunk
362 + if($this->ws>0)
363 + {
364 + $this->ws=0;
365 + $this->_out('0 Tw');
366 + }
367 + if($border and is_int(strpos($border,'B')))
368 + $b.='B';
369 + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
370 + $this->x=$this->lMargin;
371 +}
372 +
373 +function Write($h,$txt,$link='')
374 +{
375 + if($this->CurrentFont['type']=='Type0')
376 + $this->MBWrite($h,$txt,$link);
377 + else
378 + parent::Write($h,$txt,$link);
379 +}
380 +
381 +function MBWrite($h,$txt,$link)
382 +{
383 + //Multi-byte version of Write()
384 + $cw=&$this->CurrentFont['cw'];
385 + $japanese = ($this->CurrentFont['registry']['ordering'] == 'Japan1');
386 + $w=$this->w-$this->rMargin-$this->x;
387 + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
388 + $s=str_replace("\r",'',$txt);
389 + $nb=strlen($s);
390 + $sep=-1;
391 + $i=0;
392 + $j=0;
393 + $l=0;
394 + $nl=1;
395 + while($i<$nb)
396 + {
397 + //Get next character
398 + $c=$s[$i];
399 + //Check if ASCII or MB
400 + $ascii=(ord($c)<128);
401 + $hwkana = ($japanese && ord($c)==142);
402 + if($c=="\n")
403 + {
404 + //Explicit line break
405 + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
406 + $i++;
407 + $sep=-1;
408 + $j=$i;
409 + $l=0;
410 + if($nl==1)
411 + {
412 + $this->x=$this->lMargin;
413 + $w=$this->w-$this->rMargin-$this->x;
414 + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
415 + }
416 + $nl++;
417 + continue;
418 + }
419 + if(!$ascii or $c==' ')
420 + $sep=$i;
421 + $l+=$ascii ? $cw[$c] : $hwkana ? 500 : 1000;
422 + if($l>$wmax)
423 + {
424 + //Automatic line break
425 + if($sep==-1 or $i==$j)
426 + {
427 + if($this->x>$this->lMargin)
428 + {
429 + //Move to next line
430 + $this->x=$this->lMargin;
431 + $this->y+=$h;
432 + $w=$this->w-$this->rMargin-$this->x;
433 + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
434 + $i++;
435 + $nl++;
436 + continue;
437 + }
438 + if($i==$j)
439 + $i+=$ascii ? 1 : 2;
440 + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
441 + }
442 + else
443 + {
444 + $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link);
445 + $i=($s[$sep]==' ') ? $sep+1 : $sep;
446 + }
447 + $sep=-1;
448 + $j=$i;
449 + $l=0;
450 + if($nl==1)
451 + {
452 + $this->x=$this->lMargin;
453 + $w=$this->w-$this->rMargin-$this->x;
454 + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
455 + }
456 + $nl++;
457 + }
458 + else
459 + $i+=$ascii ? 1 : 2;
460 + }
461 + //Last chunk
462 + if($i!=$j)
463 + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j,$i-$j),0,0,'',0,$link);
464 +}
465 +
466 +function _putfonts()
467 +{
468 + $nf=$this->n;
469 + foreach($this->diffs as $diff)
470 + {
471 + //Encodings
472 + $this->_newobj();
473 + $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
474 + $this->_out('endobj');
475 + }
476 +// $mqr=get_magic_quotes_runtime();
477 +// set_magic_quotes_runtime(0);
478 + foreach($this->FontFiles as $file=>$info)
479 + {
480 + //Font file embedding
481 + $this->_newobj();
482 + $this->FontFiles[$file]['n']=$this->n;
483 + if(defined('FPDF_FONTPATH'))
484 + $file=FPDF_FONTPATH.$file;
485 + $size=filesize($file);
486 + if(!$size)
487 + $this->Error('Font file not found');
488 + $this->_out('<</Length '.$size);
489 + if(substr($file,-2)=='.z')
490 + $this->_out('/Filter /FlateDecode');
491 + $this->_out('/Length1 '.$info['length1']);
492 + if(isset($info['length2']))
493 + $this->_out('/Length2 '.$info['length2'].' /Length3 0');
494 + $this->_out('>>');
495 + $f=fopen($file,'rb');
496 + $this->_putstream(fread($f,$size));
497 + fclose($f);
498 + $this->_out('endobj');
499 + }
500 +// set_magic_quotes_runtime($mqr);
501 + foreach($this->fonts as $k=>$font)
502 + {
503 + //Font objects
504 + $this->_newobj();
505 + $this->fonts[$k]['n']=$this->n;
506 + $this->_out('<</Type /Font');
507 + if($font['type']=='Type0')
508 + $this->_putType0($font);
509 + else
510 + {
511 + $name=$font['name'];
512 + $this->_out('/BaseFont /'.$name);
513 + if($font['type']=='core')
514 + {
515 + //Standard font
516 + $this->_out('/Subtype /Type1');
517 + if($name!='Symbol' and $name!='ZapfDingbats')
518 + $this->_out('/Encoding /WinAnsiEncoding');
519 + }
520 + else
521 + {
522 + //Additional font
523 + $this->_out('/Subtype /'.$font['type']);
524 + $this->_out('/FirstChar 32');
525 + $this->_out('/LastChar 255');
526 + $this->_out('/Widths '.($this->n+1).' 0 R');
527 + $this->_out('/FontDescriptor '.($this->n+2).' 0 R');
528 + if($font['enc'])
529 + {
530 + if(isset($font['diff']))
531 + $this->_out('/Encoding '.($nf+$font['diff']).' 0 R');
532 + else
533 + $this->_out('/Encoding /WinAnsiEncoding');
534 + }
535 + }
536 + $this->_out('>>');
537 + $this->_out('endobj');
538 + if($font['type']!='core')
539 + {
540 + //Widths
541 + $this->_newobj();
542 + $cw=&$font['cw'];
543 + $s='[';
544 + for($i=32;$i<=255;$i++)
545 + $s.=$cw[chr($i)].' ';
546 + $this->_out($s.']');
547 + $this->_out('endobj');
548 + //Descriptor
549 + $this->_newobj();
550 + $s='<</Type /FontDescriptor /FontName /'.$name;
551 + foreach($font['desc'] as $k=>$v)
552 + $s.=' /'.$k.' '.$v;
553 + $file=$font['file'];
554 + if($file)
555 + $s.=' /FontFile'.($font['type']=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R';
556 + $this->_out($s.'>>');
557 + $this->_out('endobj');
558 + }
559 + }
560 + }
561 +}
562 +
563 +function _putType0($font)
564 +{
565 + //Type0
566 + $this->_out('/Subtype /Type0');
567 + $this->_out('/BaseFont /'.$font['name'].'-'.$font['CMap']);
568 + $this->_out('/Encoding /'.$font['CMap']);
569 + $this->_out('/DescendantFonts ['.($this->n+1).' 0 R]');
570 + $this->_out('>>');
571 + $this->_out('endobj');
572 + //CIDFont
573 + $this->_newobj();
574 + $this->_out('<</Type /Font');
575 + $this->_out('/Subtype /CIDFontType0');
576 + $this->_out('/BaseFont /'.$font['name']);
577 + $this->_out('/CIDSystemInfo <</Registry (Adobe) /Ordering ('.$font['registry']['ordering'].') /Supplement '.$font['registry']['supplement'].'>>');
578 + $this->_out('/FontDescriptor '.($this->n+1).' 0 R');
579 + $W='/W [1 [';
580 + foreach($font['cw'] as $w)
581 + $W.=$w.' ';
582 + $this->_out($W.']');
583 + if($font['registry']['ordering'] == 'Japan1')
584 + $this->_out(' 231 325 500 631 [500] 326 389 500');
585 + $this->_out(']');
586 + $this->_out('>>');
587 + $this->_out('endobj');
588 + //Font descriptor
589 + $this->_newobj();
590 + $this->_out('<</Type /FontDescriptor');
591 + $this->_out('/FontName /'.$font['name']);
592 + $this->_out('/Flags 6');
593 + $this->_out('/FontBBox [0 0 1000 1000]');
594 + $this->_out('/ItalicAngle 0');
595 + $this->_out('/Ascent 1000');
596 + $this->_out('/Descent 0');
597 + $this->_out('/CapHeight 1000');
598 + $this->_out('/StemV 10');
599 + $this->_out('>>');
600 + $this->_out('endobj');
601 +}
602 +
603 + function setMBTTFDEF(){
604 + require(USCES_PLUGIN_DIR.'/classes/fpdf/font/mbttfdef.php'); // Multi-Byte TrueType Font Define
605 + return $MBTTFDEF;
606 +
607 + }
608 +
609 + function setMBCMAP(){
610 + // Encoding & CMap List (CMap information from Acrobat Reader Resource/CMap folder)
611 + $MBCMAP['BIG5'] = array ('CMap'=>'ETenms-B5-H' ,'Ordering'=>'CNS1' ,'Supplement'=>0);
612 + $MBCMAP['GB'] = array ('CMap'=>'GBKp-EUC-H' ,'Ordering'=>'GB1' ,'Supplement'=>2);
613 + $MBCMAP['SJIS'] = array ('CMap'=>'90msp-RKSJ-H' ,'Ordering'=>'Japan1','Supplement'=>2);
614 + $MBCMAP['UNIJIS'] = array ('CMap'=>'UniJIS-UTF16-H','Ordering'=>'Japan1','Supplement'=>5);
615 + $MBCMAP['EUC-JP'] = array ('CMap'=>'EUC-H' ,'Ordering'=>'Japan1','Supplement'=>1);
616 + return $MBCMAP;
617 + }
618 +
619 +}
620 +?>