From 8fe4baf97c090f918309275f294d39f9cdffaf73 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 27 Feb 2024 14:10:34 +0800 Subject: [PATCH] Fix #8052 - fixing pdf --- Fpdf/Chinese.php | 14 +- Fpdf/{Chinese-unicode.php => Unicode.php} | 5 +- Fpdf/font/unifont/ttfonts.php | 3 +- FpdfAlt.php | 1592 +++++++++++++ FpdfAlt/Chinese.php | 455 ++++ FpdfAlt/ImageAlpha.php | 314 +++ FpdfAlt/courier.php | 7 + FpdfAlt/helvetica.php | 15 + FpdfAlt/helveticab.php | 15 + FpdfAlt/helveticabi.php | 15 + FpdfAlt/helveticai.php | 15 + FpdfAlt/symbol.php | 15 + FpdfAlt/times.php | 15 + FpdfAlt/timesb.php | 15 + FpdfAlt/timesbi.php | 15 + FpdfAlt/timesi.php | 15 + FpdfAlt/zapfdingbats.php | 15 + Text/ZhDetect.php | 2646 +++++++++++++++++++++ XML/Parser.php | 31 +- XML/SvgToPdf.php | 111 +- XML/SvgToPdf/Base.php | 122 +- XML/SvgToPdf/G.php | 6 +- XML/SvgToPdf/Path.php | 14 +- XML/SvgToPdf/Rect.php | 1 + XML/SvgToPdf/Text.php | 63 +- XML/SvgToPdf/Tspan.php | 21 +- XML/SvgToPdfAlt.php | 204 ++ XML/SvgToPdfAlt/Base.php | 266 +++ XML/SvgToPdfAlt/G.php | 160 ++ XML/SvgToPdfAlt/Image.php | 20 + XML/SvgToPdfAlt/Path.php | 146 ++ XML/SvgToPdfAlt/Rect.php | 50 + XML/SvgToPdfAlt/Text.php | 343 +++ XML/SvgToPdfAlt/Tspan.php | 62 + XML/Tree.php | 35 +- XML/Tree/Morph.php | 31 +- XML/Tree/Node.php | 54 +- 37 files changed, 6734 insertions(+), 192 deletions(-) rename Fpdf/{Chinese-unicode.php => Unicode.php} (99%) create mode 100644 FpdfAlt.php create mode 100644 FpdfAlt/Chinese.php create mode 100644 FpdfAlt/ImageAlpha.php create mode 100644 FpdfAlt/courier.php create mode 100644 FpdfAlt/helvetica.php create mode 100644 FpdfAlt/helveticab.php create mode 100644 FpdfAlt/helveticabi.php create mode 100644 FpdfAlt/helveticai.php create mode 100644 FpdfAlt/symbol.php create mode 100644 FpdfAlt/times.php create mode 100644 FpdfAlt/timesb.php create mode 100644 FpdfAlt/timesbi.php create mode 100644 FpdfAlt/timesi.php create mode 100644 FpdfAlt/zapfdingbats.php create mode 100644 Text/ZhDetect.php create mode 100644 XML/SvgToPdfAlt.php create mode 100644 XML/SvgToPdfAlt/Base.php create mode 100644 XML/SvgToPdfAlt/G.php create mode 100644 XML/SvgToPdfAlt/Image.php create mode 100644 XML/SvgToPdfAlt/Path.php create mode 100644 XML/SvgToPdfAlt/Rect.php create mode 100644 XML/SvgToPdfAlt/Text.php create mode 100644 XML/SvgToPdfAlt/Tspan.php diff --git a/Fpdf/Chinese.php b/Fpdf/Chinese.php index a59302bc..3be672ed 100644 --- a/Fpdf/Chinese.php +++ b/Fpdf/Chinese.php @@ -1,5 +1,5 @@ 250,'!'=>300,'"'=>410,'#'=>668,'$'=>490,'%'=>875,'&'=>700,'\''=>250, '('=>240,')'=>240,'*'=>417,'+'=>667,','=>250,'-'=>313,'.'=>250,'/'=>520,'0'=>550,'1'=>500, @@ -34,7 +34,7 @@ $GLOBALS['GB_widths']=array(' '=>207,'!'=>270,'"'=>342,'#'=>467,'$'=>462,'%'=>79 'n'=>527,'o'=>524,'p'=>524,'q'=>504,'r'=>338,'s'=>336,'t'=>277,'u'=>517,'v'=>450,'w'=>652, 'x'=>466,'y'=>452,'z'=>407,'{'=>370,'|'=>258,'}'=>370,'~'=>605); -class PDF_Chinese extends FPDF +class FPDF_Chinese extends tFPDF { function AddCIDFont($family,$style,$name,$cw,$CMap,$registry) { @@ -112,6 +112,10 @@ function GetMBStringWidth($s) $c=$s[$i]; if(ord($c)<128) { + if (!isset($cw[$c])) { + $cw[$c] = 240;//print_R($cw);exit; + } + $l+=$cw[$c]; $i++; } @@ -329,8 +333,7 @@ function _putfonts() $this->_out('<>'); $this->_out('endobj'); } - $mqr=get_magic_quotes_runtime(); - //set_magic_quotes_runtime(0); + foreach($this->FontFiles as $file=>$info) { //Font file embedding @@ -353,8 +356,7 @@ function _putfonts() fclose($f); $this->_out('endobj'); } -// set_magic_quotes_runtime($mqr); - foreach($this->fonts as $k=>$font) + foreach($this->fonts as $k=>$font) { //Font objects $this->_newobj(); diff --git a/Fpdf/Chinese-unicode.php b/Fpdf/Unicode.php similarity index 99% rename from Fpdf/Chinese-unicode.php rename to Fpdf/Unicode.php index a3f0dd59..cd5dae91 100644 --- a/Fpdf/Chinese-unicode.php +++ b/Fpdf/Unicode.php @@ -1,9 +1,9 @@ - \ No newline at end of file diff --git a/Fpdf/font/unifont/ttfonts.php b/Fpdf/font/unifont/ttfonts.php index ce695c7c..058509ed 100644 --- a/Fpdf/font/unifont/ttfonts.php +++ b/Fpdf/font/unifont/ttfonts.php @@ -862,5 +862,4 @@ class TTFontFile { } - -?> \ No newline at end of file + \ No newline at end of file diff --git a/FpdfAlt.php b/FpdfAlt.php new file mode 100644 index 00000000..58866333 --- /dev/null +++ b/FpdfAlt.php @@ -0,0 +1,1592 @@ +Error('Don\'t alter the locale before including class file'); + //Initialization of properties + $this->page=0; + $this->n=2; + $this->buffer=''; + $this->pages=array(); + $this->OrientationChanges=array(); + $this->state=0; + $this->fonts=array(); + $this->FontFiles=array(); + $this->diffs=array(); + $this->images=array(); + $this->links=array(); + $this->InFooter=false; + $this->FontFamily=''; + $this->FontStyle=''; + $this->FontSizePt=12; + $this->underline=false; + $this->DrawColor='0 G'; + $this->FillColor='0 g'; + $this->TextColor='0 g'; + $this->ColorFlag=false; + $this->ws=0; + //Standard fonts + $this->CoreFonts['courier']='Courier'; + $this->CoreFonts['courierB']='Courier-Bold'; + $this->CoreFonts['courierI']='Courier-Oblique'; + $this->CoreFonts['courierBI']='Courier-BoldOblique'; + $this->CoreFonts['helvetica']='Helvetica'; + $this->CoreFonts['helveticaB']='Helvetica-Bold'; + $this->CoreFonts['helveticaI']='Helvetica-Oblique'; + $this->CoreFonts['helveticaBI']='Helvetica-BoldOblique'; + $this->CoreFonts['times']='Times-Roman'; + $this->CoreFonts['timesB']='Times-Bold'; + $this->CoreFonts['timesI']='Times-Italic'; + $this->CoreFonts['timesBI']='Times-BoldItalic'; + $this->CoreFonts['symbol']='Symbol'; + $this->CoreFonts['zapfdingbats']='ZapfDingbats'; + //Scale factor + if($unit=='pt') + $this->k=1; + elseif($unit=='mm') + $this->k=72/25.4; + elseif($unit=='cm') + $this->k=72/2.54; + elseif($unit=='in') + $this->k=72; + else + $this->Error('Incorrect unit: '.$unit); + //Page format + if(is_string($format)) + { + $format=strtolower($format); + if($format=='a3') + $format=array(841.89,1190.55); + elseif($format=='a4') + $format=array(595.28,841.89); + elseif($format=='a5') + $format=array(420.94,595.28); + elseif($format=='letter') + $format=array(612,792); + elseif($format=='legal') + $format=array(612,1008); + else + $this->Error('Unknown page format: '.$format); + $this->fwPt=$format[0]; + $this->fhPt=$format[1]; + } + else + { + $this->fwPt=$format[0]*$this->k; + $this->fhPt=$format[1]*$this->k; + } + $this->CurPageFormat = $format; //FC with 1.6... + + + + $this->fw=$this->fwPt/$this->k; + $this->fh=$this->fhPt/$this->k; + //Page orientation + $orientation=strtolower($orientation); + if($orientation=='p' or $orientation=='portrait') + { + $this->DefOrientation='P'; + $this->wPt=$this->fwPt; + $this->hPt=$this->fhPt; + } + elseif($orientation=='l' or $orientation=='landscape') + { + $this->DefOrientation='L'; + $this->wPt=$this->fhPt; + $this->hPt=$this->fwPt; + } + else + $this->Error('Incorrect orientation: '.$orientation); + $this->CurOrientation=$this->DefOrientation; + $this->w=$this->wPt/$this->k; + $this->h=$this->hPt/$this->k; + //Page margins (1 cm) + $margin=28.35/$this->k; + $this->SetMargins($margin,$margin); + //Interior cell margin (1 mm) + $this->cMargin=$margin/10; + //Line width (0.2 mm) + $this->LineWidth=.567/$this->k; + //Automatic page break + $this->SetAutoPageBreak(true,2*$margin); + //Full width display mode + $this->SetDisplayMode('fullwidth'); + //Compression + $this->SetCompression(true); + + $this->PDFVersion = '1.4'; +} + +function SetMargins($left,$top,$right=-1) +{ + //Set left, top and right margins + $this->lMargin=$left; + $this->tMargin=$top; + if($right==-1) + $right=$left; + $this->rMargin=$right; +} + +function SetLeftMargin($margin) +{ + //Set left margin + $this->lMargin=$margin; + if($this->page>0 and $this->x<$margin) + $this->x=$margin; +} + +function SetTopMargin($margin) +{ + //Set top margin + $this->tMargin=$margin; +} + +function SetRightMargin($margin) +{ + //Set right margin + $this->rMargin=$margin; +} + +function SetAutoPageBreak($auto,$margin=0) +{ + //Set auto page break mode and triggering margin + $this->AutoPageBreak=$auto; + $this->bMargin=$margin; + $this->PageBreakTrigger=$this->h-$margin; +} + +function SetDisplayMode($zoom,$layout='continuous') +{ + //Set display mode in viewer + if($zoom=='fullpage' or $zoom=='fullwidth' or $zoom=='real' or $zoom=='default' or !is_string($zoom)) + $this->ZoomMode=$zoom; + elseif($zoom=='zoom') + $this->ZoomMode=$layout; + else + $this->Error('Incorrect zoom display mode: '.$zoom); + if($layout=='single' or $layout=='continuous' or $layout=='two' or $layout=='default') + $this->LayoutMode=$layout; + elseif($zoom!='zoom') + $this->Error('Incorrect layout display mode: '.$layout); +} + +function SetCompression($compress) +{ + //Set page compression + if(function_exists('gzcompress')) + $this->compress=$compress; + else + $this->compress=false; +} + +function SetTitle($title) +{ + //Title of document + $this->title=$title; +} + +function SetSubject($subject) +{ + //Subject of document + $this->subject=$subject; +} + +function SetAuthor($author) +{ + //Author of document + $this->author=$author; +} + +function SetKeywords($keywords) +{ + //Keywords of document + $this->keywords=$keywords; +} + +function SetCreator($creator) +{ + //Creator of document + $this->creator=$creator; +} + +function AliasNbPages($alias='{nb}') +{ + //Define an alias for total number of pages + $this->AliasNbPages=$alias; +} + +function Error($msg) +{ + //Fatal error + die('FPDF error: '.$msg); +} + +function Open() +{ + //Begin document + $this->_begindoc(); +} + +function Close() +{ + //Terminate document + if($this->page==0) + $this->AddPage(); + //Page footer + $this->InFooter=true; + $this->Footer(); + $this->InFooter=false; + //Close page + $this->_endpage(); + //Close document + $this->_enddoc(); +} + +function AddPage($orientation='') +{ + //Start a new page + $family=$this->FontFamily; + $style=$this->FontStyle.($this->underline ? 'U' : ''); + $size=$this->FontSizePt; + $lw=$this->LineWidth; + $dc=$this->DrawColor; + $fc=$this->FillColor; + $tc=$this->TextColor; + $cf=$this->ColorFlag; + if($this->page>0) + { + //Page footer + $this->InFooter=true; + $this->Footer(); + $this->InFooter=false; + //Close page + $this->_endpage(); + } + //Start new page + $this->_beginpage($orientation); + //Set line cap style to square + $this->_out('2 J'); + //Set line width + $this->LineWidth=$lw; + $this->_out(sprintf('%.2f w',$lw*$this->k)); + //Set font + if($family) + $this->SetFont($family,$style,$size); + //Set colors + $this->DrawColor=$dc; + if($dc!='0 G') + $this->_out($dc); + $this->FillColor=$fc; + if($fc!='0 g') + $this->_out($fc); + $this->TextColor=$tc; + $this->ColorFlag=$cf; + //Page header + $this->Header(); + //Restore line width + if($this->LineWidth!=$lw) + { + $this->LineWidth=$lw; + $this->_out(sprintf('%.2f w',$lw*$this->k)); + } + //Restore font + if($family) + $this->SetFont($family,$style,$size); + //Restore colors + if($this->DrawColor!=$dc) + { + $this->DrawColor=$dc; + $this->_out($dc); + } + if($this->FillColor!=$fc) + { + $this->FillColor=$fc; + $this->_out($fc); + } + $this->TextColor=$tc; + $this->ColorFlag=$cf; +} + +function Header() +{ + //To be implemented in your own inherited class +} + +function Footer() +{ + //To be implemented in your own inherited class +} + +function PageNo() +{ + //Get current page number + return $this->page; +} + +function SetDrawColor($r,$g=-1,$b=-1) +{ + //Set color for all stroking operations + if(($r==0 and $g==0 and $b==0) or $g==-1) + $this->DrawColor=sprintf('%.3f G',$r/255); + else + $this->DrawColor=sprintf('%.3f %.3f %.3f RG',$r/255,$g/255,$b/255); + if($this->page>0) + $this->_out($this->DrawColor); +} + +function SetFillColor($r,$g=-1,$b=-1) +{ + //Set color for all filling operations + if(($r==0 and $g==0 and $b==0) or $g==-1) + $this->FillColor=sprintf('%.3f g',$r/255); + else + $this->FillColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255); + $this->ColorFlag=($this->FillColor!=$this->TextColor); + if($this->page>0) + $this->_out($this->FillColor); +} + +function SetTextColor($r,$g=-1,$b=-1) +{ + //Set color for text + if(($r==0 and $g==0 and $b==0) or $g==-1) + $this->TextColor=sprintf('%.3f g',$r/255); + else + $this->TextColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255); + $this->ColorFlag=($this->FillColor!=$this->TextColor); +} + +function GetStringWidth($s) +{ + //Get width of a string in the current font + $s=(string)$s; + $cw=&$this->CurrentFont['cw']; + $w=0; + $l=strlen($s); + for($i=0;$i<$l;$i++) + $w+=$cw[$s[$i]]; + return $w*$this->FontSize/1000; +} + +function SetLineWidth($width) +{ + //Set line width + $this->LineWidth=$width; + if($this->page>0) + $this->_out(sprintf('%.2f w',$width*$this->k)); +} + +function Line($x1,$y1,$x2,$y2) +{ + //Draw a line + if (!is_array($x1)) { + $this->_out( + sprintf('%.2f %.2f m %.2f %.2f l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k)); + return; + } + $type= 'm';$out=''; + for ($i=0;$ik,($this->h-$x1[$i+1])*$this->k,$type); + $type = 'l'; + } + $this->_out(ltrim($out) . ' f'); + + +} + +function Rect($x,$y,$w,$h,$style='') +{ + //Draw a rectangle + if($style=='F') + $op='f'; + elseif($style=='FD' or $style=='DF') + $op='B'; + else + $op='S'; + $this->_out(sprintf('%.2f %.2f %.2f %.2f re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); +} + +function AddFont($family,$style='',$file='') +{ + //Add a TrueType or Type1 font + $family=strtolower($family); + if($family=='arial') + $family='helvetica'; + $style=strtoupper($style); + if($style=='IB') + $style='BI'; + if(isset($this->fonts[$family.$style])) + $this->Error('Font already added: '.$family.' '.$style); + if($file=='') + $file=str_replace(' ','',$family).strtolower($style).'.php'; + + if (file_exists(dirname(__FILE__) .'/FpdfAlt/'.$file)) { + include 'FpdfAlt/'.$file; + } + if(!isset($name)) { + $this->Error('Could not include font definition file'); + } + $i=count($this->fonts)+1; + $this->fonts[$family.$style]=array('i'=>$i,'type'=>$type,'name'=>$name,'desc'=>$desc,'up'=>$up,'ut'=>$ut,'cw'=>$cw,'enc'=>$enc,'file'=>$file); + if($diff) + { + //Search existing encodings + $d=0; + $nb=count($this->diffs); + for($i=1;$i<=$nb;$i++) + if($this->diffs[$i]==$diff) + { + $d=$i; + break; + } + if($d==0) + { + $d=$nb+1; + $this->diffs[$d]=$diff; + } + $this->fonts[$family.$style]['diff']=$d; + } + if($file) + { + if($type=='TrueType') + $this->FontFiles[$file]=array('length1'=>$originalsize); + else + $this->FontFiles[$file]=array('length1'=>$size1,'length2'=>$size2); + } +} + +function SetFont($family,$style='',$size=0) +{ + //Select a font; size given in points + global $fpdf_charwidths; + + $family=strtolower($family); + if($family=='') + $family=$this->FontFamily; + if($family=='arial') + $family='helvetica'; + elseif($family=='symbol' or $family=='zapfdingbats') + $style=''; + $style=strtoupper($style); + if(is_int(strpos($style,'U'))) + { + $this->underline=true; + $style=str_replace('U','',$style); + } + else + $this->underline=false; + if($style=='IB') + $style='BI'; + if($size==0) + $size=$this->FontSizePt; + //Test if font is already selected + if($this->FontFamily==$family and $this->FontStyle==$style and $this->FontSizePt==$size) + return; + //Test if used for the first time + $fontkey=$family.$style; + if(!isset($this->fonts[$fontkey])) + { + //Check if one of the standard fonts + if(isset($this->CoreFonts[$fontkey])) + { + if(!isset($fpdf_charwidths[$fontkey])) + { + //Load metric file + $file=$family; + if($family=='times' or $family=='helvetica') + $file.=strtolower($style); + $file.='.php'; + if (file_exists(dirname(__FILE__) .'/FpdfAlt/'.$file)) { + include 'FpdfAlt/'.$file; + } + if(!isset($fpdf_charwidths[$fontkey])) + $this->Error('Could not include font metric file'); + } + $i=count($this->fonts)+1; + $this->fonts[$fontkey]=array('i'=>$i,'type'=>'core','name'=>$this->CoreFonts[$fontkey],'up'=>-100,'ut'=>50,'cw'=>$fpdf_charwidths[$fontkey]); + } + else + $this->Error('Undefined font: '.$family.' '.$style); + } + //Select it + $this->FontFamily=$family; + $this->FontStyle=$style; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + $this->CurrentFont=&$this->fonts[$fontkey]; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); +} + +function SetFontSize($size) +{ + //Set font size in points + if($this->FontSizePt==$size) + return; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); +} + +function AddLink() +{ + //Create a new internal link + $n=count($this->links)+1; + $this->links[$n]=array(0,0); + return $n; +} + +function SetLink($link,$y=0,$page=-1) +{ + //Set destination of internal link + if($y==-1) + $y=$this->y; + if($page==-1) + $page=$this->page; + $this->links[$link]=array($page,$y); +} + +function Link($x,$y,$w,$h,$link) +{ + //Put a link on the page + $this->PageLinks[$this->page][]=array($x*$this->k,$this->hPt-$y*$this->k,$w*$this->k,$h*$this->k,$link); +} + +function Text($x,$y,$txt) +{ + //Output a string + $txt=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); + $s=sprintf('BT %.2f %.2f Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$txt); + if($this->underline and $txt!='') + $s.=' '.$this->_dounderline($x,$y,$txt); + if($this->ColorFlag) + $s='q '.$this->TextColor.' '.$s.' Q'; + $this->_out($s); +} + +function AcceptPageBreak() +{ + //Accept automatic page break or not + return $this->AutoPageBreak; +} + +function Cell($w,$h=0,$txt='',$border=0,$ln=0,$align='',$fill=0,$link='') +{ + //Output a cell + $k=$this->k; + if($this->y+$h>$this->PageBreakTrigger and !$this->InFooter and $this->AcceptPageBreak()) + { + $x=$this->x; + $ws=$this->ws; + if($ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->AddPage($this->CurOrientation); + $this->x=$x; + if($ws>0) + { + $this->ws=$ws; + $this->_out(sprintf('%.3f Tw',$ws*$k)); + } + } + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $s=''; + if($fill==1 or $border==1) + { + if($fill==1) + $op=($border==1) ? 'B' : 'f'; + else + $op='S'; + $s=sprintf('%.2f %.2f %.2f %.2f re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); + } + if(is_string($border)) + { + $x=$this->x; + $y=$this->y; + if(is_int(strpos($border,'L'))) + $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); + if(is_int(strpos($border,'T'))) + $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); + if(is_int(strpos($border,'R'))) + $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + if(is_int(strpos($border,'B'))) + $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + } + if($txt!='') + { + if($align=='R') + $dx=$w-$this->cMargin-$this->GetStringWidth($txt); + elseif($align=='C') + $dx=($w-$this->GetStringWidth($txt))/2; + else + $dx=$this->cMargin; + $txt=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); + if($this->ColorFlag) + $s.='q '.$this->TextColor.' '; + $s.=sprintf('BT %.2f %.2f Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt); + if($this->underline) + $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); + if($this->ColorFlag) + $s.=' Q'; + if($link) + $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); + } + if($s) + $this->_out($s); + $this->lasth=$h; + if($ln>0) + { + //Go to next line + $this->y+=$h; + if($ln==1) + $this->x=$this->lMargin; + } + else + $this->x+=$w; +} + +function MultiCell($w,$h,$txt,$border=0,$align='J',$fill=0) +{ + //Output text with automatic or explicit line breaks + $cw=&$this->CurrentFont['cw']; + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + if($nb>0 and $s[$nb-1]=="\n") + $nb--; + $b=0; + if($border) + { + if($border==1) + { + $border='LTRB'; + $b='LRT'; + $b2='LR'; + } + else + { + $b2=''; + if(is_int(strpos($border,'L'))) + $b2.='L'; + if(is_int(strpos($border,'R'))) + $b2.='R'; + $b=is_int(strpos($border,'T')) ? $b2.'T' : $b2; + } + } + $sep=-1; + $i=0; + $j=0; + $l=0; + $ns=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s[$i]; + if($c=="\n") + { + //Explicit line break + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $i++; + $sep=-1; + $j=$i; + $l=0; + $ns=0; + $nl++; + if($border and $nl==2) + $b=$b2; + continue; + } + if($c==' ') + { + $sep=$i; + $ls=$l; + $ns++; + } + $l+=$cw[$c]; + if($l>$wmax) + { + //Automatic line break + if($sep==-1) + { + if($i==$j) + $i++; + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + } + else + { + if($align=='J') + { + $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; + $this->_out(sprintf('%.3f Tw',$this->ws*$this->k)); + } + $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); + $i=$sep+1; + } + $sep=-1; + $j=$i; + $l=0; + $ns=0; + $nl++; + if($border and $nl==2) + $b=$b2; + } + else + $i++; + } + //Last chunk + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + if($border and is_int(strpos($border,'B'))) + $b.='B'; + $this->Cell($w,$h,substr($s,$j,$i),$b,2,$align,$fill); + $this->x=$this->lMargin; +} + +function Write($h,$txt,$link='') +{ + //Output text in flowing mode + $cw=&$this->CurrentFont['cw']; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + $sep=-1; + $i=0; + $j=0; + $l=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s[$i]; + if($c=="\n") + { + //Explicit line break + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + $i++; + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + continue; + } + if($c==' ') + { + $sep=$i; + $ls=$l; + } + $l+=$cw[$c]; + if($l>$wmax) + { + //Automatic line break + if($sep==-1) + { + if($this->x>$this->lMargin) + { + //Move to next line + $this->x=$this->lMargin; + $this->y+=$h; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $i++; + $nl++; + continue; + } + if($i==$j) + $i++; + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + } + else + { + $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); + $i=$sep+1; + } + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + } + else + $i++; + } + //Last chunk + if($i!=$j) + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j,$i),0,0,'',0,$link); +} + +function Image($file,$x,$y,$w,$h=0,$type='',$link='') +{ + //Put an image on the page + if(!isset($this->images[$file])) + { + //First use of image, get info + if($type=='') + { + $pos=strrpos($file,'.'); + if(!$pos) + $this->Error('Image file has no extension and no type was specified: '.$file); + $type=substr($file,$pos+1); + } + $type=strtolower($type); + //$mqr=get_magic_quotes_runtime(); +// set_magic_quotes_runtime(0); + if($type=='jpg' or $type=='jpeg') + $info=$this->_parsejpg($file); + elseif($type=='png') + $info=$this->_parsepng($file); + else + $this->Error('Unsupported image file type: '.$type); + //set_magic_quotes_runtime($mqr); + $info['i']=count($this->images)+1; + $this->images[$file]=$info; + } + else + $info=$this->images[$file]; + //Automatic width or height calculation + if($w==0) + $w=$h*$info['w']/$info['h']; + if($h==0) + $h=$w*$info['h']/$info['w']; + $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); + if($link) + $this->Link($x,$y,$w,$h,$link); +} + +function Ln($h='') +{ + //Line feed; default value is last cell height + $this->x=$this->lMargin; + if(is_string($h)) + $this->y+=$this->lasth; + else + $this->y+=$h; +} + +function GetX() +{ + //Get x position + return $this->x; +} + +function SetX($x) +{ + //Set x position + if($x>=0) + $this->x=$x; + else + $this->x=$this->w+$x; +} + +function GetY() +{ + //Get y position + return $this->y; +} + +function SetY($y) +{ + //Set y position and reset x + $this->x=$this->lMargin; + if($y>=0) + $this->y=$y; + else + $this->y=$this->h+$y; +} + +function SetXY($x,$y) +{ + //Set x and y positions + $this->SetY($y); + $this->SetX($x); +} + +function Output($file='',$download=false) +{ + //Output PDF to file or browser + global $HTTP_ENV_VARS; + + if($this->state<3) + $this->Close(); + if($file=='') + { + //Send to browser + Header('Content-Type: application/pdf'); + if(headers_sent()) + $this->Error('Some data has already been output to browser, can\'t send PDF file'); + Header('Content-Length: '.strlen($this->buffer)); + Header('Content-disposition: inline; filename=doc.pdf'); + echo $this->buffer; + } + else + { + if($download) + { + //Download file + if(isset($HTTP_ENV_VARS['HTTP_USER_AGENT']) and strpos($HTTP_ENV_VARS['HTTP_USER_AGENT'],'MSIE 5.5')) + Header('Content-Type: application/dummy'); + else + Header('Content-Type: application/octet-stream'); + if(headers_sent()) + $this->Error('Some data has already been output to browser, can\'t send PDF file'); + Header('Content-Length: '.strlen($this->buffer)); + Header('Content-disposition: attachment; filename='.$file); + echo $this->buffer; + } + else + { + //Save file locally + $f=fopen($file,'wb'); + if(!$f) + $this->Error('Unable to create output file: '.$file); + fwrite($f,$this->buffer,strlen($this->buffer)); + fclose($f); + } + } +} + +/**************************************************************************** +* * +* Private methods * +* * +****************************************************************************/ +function _begindoc() +{ + //Start document + $this->state=1; + $this->_out('%PDF-1.3'); +} + +function _putpages() +{ + $nb=$this->page; + if(!empty($this->AliasNbPages)) + { + //Replace number of pages + for($n=1;$n<=$nb;$n++) + $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]); + } + if($this->DefOrientation=='P') + { + $wPt=$this->fwPt; + $hPt=$this->fhPt; + } + else + { + $wPt=$this->fhPt; + $hPt=$this->fwPt; + } + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + for($n=1;$n<=$nb;$n++) + { + //Page + $this->_newobj(); + $this->_out('<_out('/Parent 1 0 R'); + if(isset($this->OrientationChanges[$n])) + $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$hPt,$wPt)); + $this->_out('/Resources 2 0 R'); + if(isset($this->PageLinks[$n])) + { + //Links + $annots='/Annots ['; + foreach($this->PageLinks[$n] as $pl) + { + $rect=sprintf('%.2f %.2f %.2f %.2f',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); + $annots.='<_textstring($pl[4]).'>>>>'; + else + { + $l=$this->links[$pl[4]]; + $h=isset($this->OrientationChanges[$l[0]]) ? $wPt : $hPt; + $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2f null]>>',1+2*$l[0],$h-$l[1]*$this->k); + } + } + $this->_out($annots.']'); + } + $this->_out('/Group <>'); + $this->_out('/Contents '.($this->n+1).' 0 R>>'); + $this->_out('endobj'); + //Page content + $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; + $this->_newobj(); + $this->_out('<<'.$filter.'/Length '.strlen($p).'>>'); + $this->_putstream($p); + $this->_out('endobj'); + } + //Pages root + $this->offsets[1]=strlen($this->buffer); + $this->_out('1 0 obj'); + $this->_out('<_out($kids.']'); + $this->_out('/Count '.$nb); + $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$wPt,$hPt)); + $this->_out('>>'); + $this->_out('endobj'); +} + +function _putfonts() +{ + $nf=$this->n; + foreach($this->diffs as $diff) + { + //Encodings + $this->_newobj(); + $this->_out('<>'); + $this->_out('endobj'); + } + $mqr=get_magic_quotes_runtime(); + //set_magic_quotes_runtime(0); + foreach($this->FontFiles as $file=>$info) + { + //Font file embedding + $this->_newobj(); + $this->FontFiles[$file]['n']=$this->n; + if(defined('FPDF_FONTPATH')) + $file=FPDF_FONTPATH.$file; + $size=filesize($file); + if(!$size) + $this->Error('Font file not found'); + $this->_out('<_out('/Filter /FlateDecode'); + $this->_out('/Length1 '.$info['length1']); + if(isset($info['length2'])) + $this->_out('/Length2 '.$info['length2'].' /Length3 0'); + $this->_out('>>'); + $f=fopen($file,'rb'); + $this->_putstream(fread($f,$size)); + fclose($f); + $this->_out('endobj'); + } + //set_magic_quotes_runtime($mqr); + foreach($this->fonts as $k=>$font) + { + //Font objects + $this->_newobj(); + $this->fonts[$k]['n']=$this->n; + $name=$font['name']; + $this->_out('<_out('/BaseFont /'.$name); + if($font['type']=='core') + { + //Standard font + $this->_out('/Subtype /Type1'); + if($name!='Symbol' and $name!='ZapfDingbats') + $this->_out('/Encoding /WinAnsiEncoding'); + } + else + { + //Additional font + $this->_out('/Subtype /'.$font['type']); + $this->_out('/FirstChar 32'); + $this->_out('/LastChar 255'); + $this->_out('/Widths '.($this->n+1).' 0 R'); + $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); + if($font['enc']) + { + if(isset($font['diff'])) + $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); + else + $this->_out('/Encoding /WinAnsiEncoding'); + } + } + $this->_out('>>'); + $this->_out('endobj'); + if($font['type']!='core') + { + //Widths + $this->_newobj(); + $cw=&$font['cw']; + $s='['; + for($i=32;$i<=255;$i++) + $s.=$cw[chr($i)].' '; + $this->_out($s.']'); + $this->_out('endobj'); + //Descriptor + $this->_newobj(); + $s='<$v) + $s.=' /'.$k.' '.$v; + $file=$font['file']; + if($file) + $s.=' /FontFile'.($font['type']=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; + $this->_out($s.'>>'); + $this->_out('endobj'); + } + } +} + +function _putimages() +{ + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + foreach($this->images as $file=>$info) + { + $this->_newobj(); + $this->images[$file]['n']=$this->n; + $this->_out('<_out('/Subtype /Image'); + $this->_out('/Width '.$info['w']); + $this->_out('/Height '.$info['h']); + if($info['cs']=='Indexed') + $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); + else + { + $this->_out('/ColorSpace /'.$info['cs']); + if($info['cs']=='DeviceCMYK') + $this->_out('/Decode [1 0 1 0 1 0 1 0]'); + } + $this->_out('/BitsPerComponent '.$info['bpc']); + $this->_out('/Filter /'.$info['f']); + if(isset($info['parms'])) + $this->_out($info['parms']); + if(isset($info['trns']) and is_array($info['trns'])) + { + $trns=''; + for($i=0;$i_out('/Mask ['.$trns.']'); + } + $this->_out('/Length '.strlen($info['data']).'>>'); + $this->_putstream($info['data']); + $this->_out('endobj'); + //Palette + if($info['cs']=='Indexed') + { + $this->_newobj(); + $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; + $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); + $this->_putstream($pal); + $this->_out('endobj'); + } + } +} + +function _putresources() +{ + $this->_putfonts(); + $this->_putimages(); + //Resource dictionary + $this->offsets[2]=strlen($this->buffer); + $this->_out('2 0 obj'); + $this->_out('<_out('/Font <<'); + foreach($this->fonts as $font) + $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + if(count($this->images)) + { + $this->_out('/XObject <<'); + foreach($this->images as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); + $this->_out('>>'); + } + $this->_out('>>'); + $this->_out('endobj'); +} + +function _putinfo() +{ + $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION)); + if(!empty($this->title)) + $this->_out('/Title '.$this->_textstring($this->title)); + if(!empty($this->subject)) + $this->_out('/Subject '.$this->_textstring($this->subject)); + if(!empty($this->author)) + $this->_out('/Author '.$this->_textstring($this->author)); + if(!empty($this->keywords)) + $this->_out('/Keywords '.$this->_textstring($this->keywords)); + if(!empty($this->creator)) + $this->_out('/Creator '.$this->_textstring($this->creator)); + $this->_out('/CreationDate '.$this->_textstring('D:'.date('YmdHis'))); +} + +function _putcatalog() +{ + $this->_out('/Type /Catalog'); + $this->_out('/Pages 1 0 R'); + if($this->ZoomMode=='fullpage') + $this->_out('/OpenAction [3 0 R /Fit]'); + elseif($this->ZoomMode=='fullwidth') + $this->_out('/OpenAction [3 0 R /FitH null]'); + elseif($this->ZoomMode=='real') + $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); + elseif(!is_string($this->ZoomMode)) + $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); + if($this->LayoutMode=='single') + $this->_out('/PageLayout /SinglePage'); + elseif($this->LayoutMode=='continuous') + $this->_out('/PageLayout /OneColumn'); + elseif($this->LayoutMode=='two') + $this->_out('/PageLayout /TwoColumnLeft'); +} + +function _putheader() +{ + $this->_out('%PDF-'.$this->PDFVersion); +} + + +function _puttrailer() +{ + $this->_out('/Size '.($this->n+1)); + $this->_out('/Root '.$this->n.' 0 R'); + $this->_out('/Info '.($this->n-1).' 0 R'); +} + +function _enddoc() +{ + $this->_putheader(); + $this->_putpages(); + $this->_putresources(); + //Info + $this->_newobj(); + $this->_out('<<'); + $this->_putinfo(); + $this->_out('>>'); + $this->_out('endobj'); + //Catalog + $this->_newobj(); + $this->_out('<<'); + $this->_putcatalog(); + $this->_out('>>'); + $this->_out('endobj'); + //Cross-ref + $o=strlen($this->buffer); + $this->_out('xref'); + $this->_out('0 '.($this->n+1)); + $this->_out('0000000000 65535 f '); + for($i=1;$i<=$this->n;$i++) + $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); + //Trailer + $this->_out('trailer'); + $this->_out('<<'); + $this->_puttrailer(); + $this->_out('>>'); + $this->_out('startxref'); + $this->_out($o); + $this->_out('%%EOF'); + $this->state=3; +} + +function _beginpage($orientation) +{ + $this->page++; + $this->pages[$this->page]=''; + $this->state=2; + $this->x=$this->lMargin; + $this->y=$this->tMargin; + $this->lasth=0; + $this->FontFamily=''; + //Page orientation + if(!$orientation) + $orientation=$this->DefOrientation; + else + { + $orientation=strtoupper($orientation[0]); + if($orientation!=$this->DefOrientation) + $this->OrientationChanges[$this->page]=true; + } + if($orientation!=$this->CurOrientation) + { + //Change orientation + if($orientation=='P') + { + $this->wPt=$this->fwPt; + $this->hPt=$this->fhPt; + $this->w=$this->fw; + $this->h=$this->fh; + } + else + { + $this->wPt=$this->fhPt; + $this->hPt=$this->fwPt; + $this->w=$this->fh; + $this->h=$this->fw; + } + $this->PageBreakTrigger=$this->h-$this->bMargin; + $this->CurOrientation=$orientation; + } +} + +function _endpage() +{ + //End of page contents + $this->state=1; +} + +function _newobj() +{ + //Begin a new object + $this->n++; + $this->offsets[$this->n]=strlen($this->buffer); + $this->_out($this->n.' 0 obj'); +} + +function _dounderline($x,$y,$txt) +{ + //Underline text + $up=$this->CurrentFont['up']; + $ut=$this->CurrentFont['ut']; + $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '); + return sprintf('%.2f %.2f %.2f %.2f re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt); +} + +function _parsejpg($file) +{ + //Extract info from a JPEG file + $a=GetImageSize($file); + if(!$a) + $this->Error('Missing or incorrect image file: '.$file); + if($a[2]!=2) + $this->Error('Not a JPEG file: '.$file); + if(!isset($a['channels']) or $a['channels']==3) + $colspace='DeviceRGB'; + elseif($a['channels']==4) + $colspace='DeviceCMYK'; + else + $colspace='DeviceGray'; + $bpc=isset($a['bits']) ? $a['bits'] : 8; + //Read whole file + $f=fopen($file,'rb'); + $data=fread($f,filesize($file)); + fclose($f); + return array('w'=>$a[0],'h'=>$a[1],'cs'=>$colspace,'bpc'=>$bpc,'f'=>'DCTDecode','data'=>$data); +} + +function _parsepng($file) +{ + //Extract info from a PNG file + $f=fopen($file,'rb'); + if(!$f) + $this->Error('Can\'t open image file: '.$file); + //Check signature + if(fread($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) + $this->Error('Not a PNG file: '.$file); + //Read header chunk + fread($f,4); + if(fread($f,4)!='IHDR') + $this->Error('Incorrect PNG file: '.$file); + $w=$this->_freadint($f); + $h=$this->_freadint($f); + $bpc=ord(fread($f,1)); + if($bpc>8) + $this->Error('16-bit depth not supported: '.$file); + $ct=ord(fread($f,1)); + if($ct==0) + $colspace='DeviceGray'; + elseif($ct==2) + $colspace='DeviceRGB'; + elseif($ct==3) + $colspace='Indexed'; + else + $this->Error("Alpha channel not supported: $ct ".$file); + if(ord(fread($f,1))!=0) + $this->Error('Unknown compression method: '.$file); + if(ord(fread($f,1))!=0) + $this->Error('Unknown filter method: '.$file); + if(ord(fread($f,1))!=0) + $this->Error('Interlacing not supported: '.$file); + fread($f,4); + $parms='/DecodeParms <>'; + //Scan chunks looking for palette, transparency and image data + $pal=''; + $trns=''; + $data=''; + do + { + $n=$this->_freadint($f); + $type=fread($f,4); + if($type=='PLTE') + { + //Read palette + $pal=fread($f,$n); + fread($f,4); + } + elseif($type=='tRNS') + { + //Read transparency info + $t=fread($f,$n); + if($ct==0) + $trns=array(ord(substr($t,1,1))); + elseif($ct==2) + $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1))); + else + { + $pos=strpos($t,chr(0)); + if(is_int($pos)) + $trns=array($pos); + } + fread($f,4); + } + elseif($type=='IDAT') + { + //Read image data block + $data.=fread($f,$n); + fread($f,4); + } + elseif($type=='IEND') + break; + else + fread($f,$n+4); + } + while($n); + if($colspace=='Indexed' and empty($pal)) + $this->Error('Missing palette in '.$file); + fclose($f); + return array('w'=>$w,'h'=>$h,'cs'=>$colspace,'bpc'=>$bpc,'f'=>'FlateDecode','parms'=>$parms,'pal'=>$pal,'trns'=>$trns,'data'=>$data); +} + +function _freadint($f) +{ + //Read a 4-byte integer from file + $i=ord(fread($f,1))<<24; + $i+=ord(fread($f,1))<<16; + $i+=ord(fread($f,1))<<8; + $i+=ord(fread($f,1)); + return $i; +} + +function _textstring($s) +{ + //Format a text string + return '('.$this->_escape($s).')'; +} + +function _escape($s) +{ + //Add \ before \, ( and ) + return str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$s))); +} + +function _putstream($s) +{ + $this->_out('stream'); + $this->_out($s); + $this->_out('endstream'); +} + +function _out($s) +{ + //Add a line to the document + if($this->state==2) + $this->pages[$this->page].=$s."\n"; + else + $this->buffer.=$s."\n"; +} +//End of class +} + +//Handle silly IE contype request + diff --git a/FpdfAlt/Chinese.php b/FpdfAlt/Chinese.php new file mode 100644 index 00000000..909e06b3 --- /dev/null +++ b/FpdfAlt/Chinese.php @@ -0,0 +1,455 @@ +250,'!'=>250,'"'=>408,'#'=>668,'$'=>490,'%'=>875,'&'=>698,'\''=>250, + '('=>240,')'=>240,'*'=>417,'+'=>667,','=>250,'-'=>313,'.'=>250,'/'=>520,'0'=>500,'1'=>500, + '2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>250,';'=>250, + '<'=>667,'='=>667,'>'=>667,'?'=>396,'@'=>921,'A'=>677,'B'=>615,'C'=>719,'D'=>760,'E'=>625, + 'F'=>552,'G'=>771,'H'=>802,'I'=>354,'J'=>354,'K'=>781,'L'=>604,'M'=>927,'N'=>750,'O'=>823, + 'P'=>563,'Q'=>823,'R'=>729,'S'=>542,'T'=>698,'U'=>771,'V'=>729,'W'=>948,'X'=>771,'Y'=>677, + 'Z'=>635,'['=>344,'\\'=>520,']'=>344,'^'=>469,'_'=>500,'`'=>250,'a'=>469,'b'=>521,'c'=>427, + 'd'=>521,'e'=>438,'f'=>271,'g'=>469,'h'=>531,'i'=>250,'j'=>250,'k'=>458,'l'=>240,'m'=>802, + 'n'=>531,'o'=>500,'p'=>521,'q'=>521,'r'=>365,'s'=>333,'t'=>292,'u'=>521,'v'=>458,'w'=>677, + 'x'=>479,'y'=>458,'z'=>427,'{'=>480,'|'=>496,'}'=>480,'~'=>667); + +$GLOBALS['GB_widths']=array(' '=>207,'!'=>270,'"'=>342,'#'=>467,'$'=>462,'%'=>797,'&'=>710,'\''=>239, + '('=>374,')'=>374,'*'=>423,'+'=>605,','=>238,'-'=>375,'.'=>238,'/'=>334,'0'=>462,'1'=>462, + '2'=>462,'3'=>462,'4'=>462,'5'=>462,'6'=>462,'7'=>462,'8'=>462,'9'=>462,':'=>238,';'=>238, + '<'=>605,'='=>605,'>'=>605,'?'=>344,'@'=>748,'A'=>684,'B'=>560,'C'=>695,'D'=>739,'E'=>563, + 'F'=>511,'G'=>729,'H'=>793,'I'=>318,'J'=>312,'K'=>666,'L'=>526,'M'=>896,'N'=>758,'O'=>772, + 'P'=>544,'Q'=>772,'R'=>628,'S'=>465,'T'=>607,'U'=>753,'V'=>711,'W'=>972,'X'=>647,'Y'=>620, + 'Z'=>607,'['=>374,'\\'=>333,']'=>374,'^'=>606,'_'=>500,'`'=>239,'a'=>417,'b'=>503,'c'=>427, + 'd'=>529,'e'=>415,'f'=>264,'g'=>444,'h'=>518,'i'=>241,'j'=>230,'k'=>495,'l'=>228,'m'=>793, + 'n'=>527,'o'=>524,'p'=>524,'q'=>504,'r'=>338,'s'=>336,'t'=>277,'u'=>517,'v'=>450,'w'=>652, + 'x'=>466,'y'=>452,'z'=>407,'{'=>370,'|'=>258,'}'=>370,'~'=>605); + +class FpdfAlt_Chinese extends FpdfAlt +{ + function AddCIDFont($family,$style,$name,$cw,$CMap,$registry) + { + $fontkey=strtolower($family).strtoupper($style); + if(isset($this->fonts[$fontkey])) + $this->Error("Font already added: $family $style"); + $i=count($this->fonts)+1; + $name=str_replace(' ','',$name); + $this->fonts[$fontkey]=array('i'=>$i,'type'=>'Type0','name'=>$name,'up'=>-130,'ut'=>40,'cw'=>$cw,'CMap'=>$CMap,'registry'=>$registry); + } + + function AddCIDFonts($family,$name,$cw,$CMap,$registry) + { + $this->AddCIDFont($family,'',$name,$cw,$CMap,$registry); + $this->AddCIDFont($family,'B',$name.',Bold',$cw,$CMap,$registry); + $this->AddCIDFont($family,'I',$name.',Italic',$cw,$CMap,$registry); + $this->AddCIDFont($family,'BI',$name.',BoldItalic',$cw,$CMap,$registry); + } + + function AddBig5Font($family='Big5',$name='MSungStd-Light-Acro') + { + //Add Big5 font with proportional Latin + $cw=$GLOBALS['Big5_widths']; + $CMap='ETenms-B5-H'; + $registry=array('ordering'=>'CNS1','supplement'=>0); + $this->AddCIDFonts($family,$name,$cw,$CMap,$registry); + } + + function AddBig5hwFont($family='Big5-hw',$name='MMingStd-Light-Acro') + { + //Add Big5 font with half-witdh Latin + for($i=32;$i<=126;$i++) + $cw[chr($i)]=500; + $CMap='ETen-B5-H'; + $registry=array('ordering'=>'CNS1','supplement'=>0); + $this->AddCIDFonts($family,$name,$cw,$CMap,$registry); + } + function AddUniCNShwFont($family='Uni-hw',$name='PMingLiU') + { + //Add Unicode font with half-witdh Latin + for($i=32;$i<=126;$i++) + $cw[chr($i)]=500; + $CMap='UniCNS-UTF16-H'; + $registry=array('ordering'=>'CNS1','supplement'=>4); + $this->AddCIDFonts($family,$name,$cw,$CMap,$registry); + } + + + function AddGBFont($family='GB',$name='STSongStd-Light-Acro') + { + //Add GB font with proportional Latin + $cw=$GLOBALS['GB_widths']; + $CMap='GBKp-EUC-H'; + $registry=array('ordering'=>'GB1','supplement'=>2); + $this->AddCIDFonts($family,$name,$cw,$CMap,$registry); + } + + function AddGBhwFont($family='GB-hw',$name='STSongStd-Light-Acro') + { + //Add GB font with half-width Latin + for($i=32;$i<=126;$i++) + $cw[chr($i)]=500; + $CMap='GBK-EUC-H'; + $registry=array('ordering'=>'GB1','supplement'=>2); + $this->AddCIDFonts($family,$name,$cw,$CMap,$registry); + } + + function GetStringWidth($s) + { + if($this->CurrentFont['type']=='Type0') + return $this->GetMBStringWidth($s); + else + return parent::GetStringWidth($s); + } + + function GetMBStringWidth($s) + { + //Multi-byte version of GetStringWidth() + $l=0; + $cw=&$this->CurrentFont['cw']; + $nb=strlen($s); + $i=0; + while($i<$nb) + { + $c=$s[$i]; + if(ord($c)<128) + { + $l+=$cw[$c]; + $i++; + } + else + { + $l+=1000; + $i+=2; + } + } + return $l*$this->FontSize/1000; + } + + function MultiCell($w,$h,$txt,$border=0,$align='L',$fill=0) + { + if($this->CurrentFont['type']=='Type0') + $this->MBMultiCell($w,$h,$txt,$border,$align,$fill); + else + parent::MultiCell($w,$h,$txt,$border,$align,$fill); + } + + function MBMultiCell($w,$h,$txt,$border=0,$align='L',$fill=0) + { + //Multi-byte version of MultiCell() + $cw=&$this->CurrentFont['cw']; + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + if($nb>0 and $s[$nb-1]=="\n") + $nb--; + $b=0; + if($border) + { + if($border==1) + { + $border='LTRB'; + $b='LRT'; + $b2='LR'; + } + else + { + $b2=''; + if(is_int(strpos($border,'L'))) + $b2.='L'; + if(is_int(strpos($border,'R'))) + $b2.='R'; + $b=is_int(strpos($border,'T')) ? $b2.'T' : $b2; + } + } + $sep=-1; + $i=0; + $j=0; + $l=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s[$i]; + //Check if ASCII or MB + $ascii=(ord($c)<128); + if($c=="\n") + { + //Explicit line break + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $i++; + $sep=-1; + $j=$i; + $l=0; + $nl++; + if($border and $nl==2) + $b=$b2; + continue; + } + if(!$ascii) + { + $sep=$i; + $ls=$l; + } + elseif($c==' ') + { + $sep=$i; + $ls=$l; + } + $l+=$ascii ? $cw[$c] : 1000; + if($l>$wmax) + { + //Automatic line break + if($sep==-1 or $i==$j) + { + if($i==$j) + $i+=$ascii ? 1 : 2; + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + } + else + { + $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); + $i=($s[$sep]==' ') ? $sep+1 : $sep; + } + $sep=-1; + $j=$i; + $l=0; + $nl++; + if($border and $nl==2) + $b=$b2; + } + else + $i+=$ascii ? 1 : 2; + } + //Last chunk + if($border and is_int(strpos($border,'B'))) + $b.='B'; + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $this->x=$this->lMargin; + } + + function Write($h,$txt,$link='') + { + if($this->CurrentFont['type']=='Type0') + $this->MBWrite($h,$txt,$link); + else + parent::Write($h,$txt,$link); + } + + function MBWrite($h,$txt,$link) + { + //Multi-byte version of Write() + $cw=&$this->CurrentFont['cw']; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + $sep=-1; + $i=0; + $j=0; + $l=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s[$i]; + //Check if ASCII or MB + $ascii=(ord($c)<128); + if($c=="\n") + { + //Explicit line break + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + $i++; + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + continue; + } + if(!$ascii or $c==' ') + $sep=$i; + $l+=$ascii ? $cw[$c] : 1000; + if($l>$wmax) + { + //Automatic line break + if($sep==-1 or $i==$j) + { + if($this->x>$this->lMargin) + { + //Move to next line + $this->x=$this->lMargin; + $this->y+=$h; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $i++; + $nl++; + continue; + } + if($i==$j) + $i+=$ascii ? 1 : 2; + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + } + else + { + $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); + $i=($s[$sep]==' ') ? $sep+1 : $sep; + } + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + } + else + $i+=$ascii ? 1 : 2; + } + //Last chunk + if($i!=$j) + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j,$i-$j),0,0,'',0,$link); + } + + function _putfonts() + { + $nf=$this->n; + foreach($this->diffs as $diff) + { + //Encodings + $this->_newobj(); + $this->_out('<>'); + $this->_out('endobj'); + } + foreach($this->FontFiles as $file=>$info) + { + //Font file embedding + $this->_newobj(); + $this->FontFiles[$file]['n']=$this->n; + if(defined('FPDF_FONTPATH')) + $file=FPDF_FONTPATH.$file; + $size=filesize($file); + if(!$size) + $this->Error('Font file not found'); + $this->_out('<_out('/Filter /FlateDecode'); + $this->_out('/Length1 '.$info['length1']); + if(isset($info['length2'])) + $this->_out('/Length2 '.$info['length2'].' /Length3 0'); + $this->_out('>>'); + $f=fopen($file,'rb'); + $this->_putstream(fread($f,$size)); + fclose($f); + $this->_out('endobj'); + } + foreach($this->fonts as $k=>$font) + { + //Font objects + $this->_newobj(); + $this->fonts[$k]['n']=$this->n; + $this->_out('<_putType0($font); + else + { + $name=$font['name']; + $this->_out('/BaseFont /'.$name); + if($font['type']=='core') + { + //Standard font + $this->_out('/Subtype /Type1'); + if($name!='Symbol' and $name!='ZapfDingbats') + $this->_out('/Encoding /WinAnsiEncoding'); + } + else + { + //Additional font + $this->_out('/Subtype /'.$font['type']); + $this->_out('/FirstChar 32'); + $this->_out('/LastChar 255'); + $this->_out('/Widths '.($this->n+1).' 0 R'); + $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); + if($font['enc']) + { + if(isset($font['diff'])) + $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); + else + $this->_out('/Encoding /WinAnsiEncoding'); + } + } + $this->_out('>>'); + $this->_out('endobj'); + if($font['type']!='core') + { + //Widths + $this->_newobj(); + $cw=&$font['cw']; + $s='['; + for($i=32;$i<=255;$i++) + $s.=$cw[chr($i)].' '; + $this->_out($s.']'); + $this->_out('endobj'); + //Descriptor + $this->_newobj(); + $s='<$v) + $s.=' /'.$k.' '.$v; + $file=$font['file']; + if($file) + $s.=' /FontFile'.($font['type']=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; + $this->_out($s.'>>'); + $this->_out('endobj'); + } + } + } + } + + function _putType0($font) +{ + //Type0 + $this->_out('/Subtype /Type0'); + $this->_out('/BaseFont /'.$font['name'].'-'.$font['CMap']); + $this->_out('/Encoding /'.$font['CMap']); + $this->_out('/DescendantFonts ['.($this->n+1).' 0 R]'); + $this->_out('>>'); + $this->_out('endobj'); + //CIDFont + $this->_newobj(); + $this->_out('<_out('/Subtype /CIDFontType0'); + $this->_out('/BaseFont /'.$font['name']); + $this->_out('/CIDSystemInfo <>'); + $this->_out('/FontDescriptor '.($this->n+1).' 0 R'); + if($font['CMap']=='ETen-B5-H') + $W='13648 13742 500'; + elseif($font['CMap']=='GBK-EUC-H') + $W='814 907 500 7716 [500]'; + else + //print_r( $font['cw']);exit; + $W='1 ['.implode(' ',$font['cw']).']'; + $this->_out('/W ['.$W.']>>'); + $this->_out('endobj'); + //Font descriptor + $this->_newobj(); + $this->_out('<_out('/FontName /'.$font['name']); + $this->_out('/Flags 6'); + $this->_out('/FontBBox [0 -200 1000 900]'); + $this->_out('/ItalicAngle 0'); + $this->_out('/Ascent 800'); + $this->_out('/Descent -200'); + $this->_out('/CapHeight 800'); + $this->_out('/StemV 50'); + $this->_out('>>'); + $this->_out('endobj'); +} +} +?> diff --git a/FpdfAlt/ImageAlpha.php b/FpdfAlt/ImageAlpha.php new file mode 100644 index 00000000..f7e6de4d --- /dev/null +++ b/FpdfAlt/ImageAlpha.php @@ -0,0 +1,314 @@ + images[$file])) + { + //First use of image, get info + if($type=='') + { + $pos=strrpos($file,'.'); + if(!$pos) + $this->Error('Image file has no extension and no type was specified: '.$file); + $type=substr($file,$pos+1); + } + $type=strtolower($type); + //$mqr=get_magic_quotes_runtime(); + //@set_magic_quotes_runtime(0); + if($type=='jpg' || $type=='jpeg') + $info=$this->_parsejpg($file); + elseif($type=='png'){ + $info=$this->_parsepng($file); + if ($info=='alpha') return $this->ImagePngWithAlpha($file,$x,$y,$w,$h,$link); + } + else + { + //Allow for additional formats + $mtd='_parse'.$type; + if(!method_exists($this,$mtd)) + $this->Error('Unsupported image type: '.$type); + $info=$this->$mtd($file); + } + //set_magic_quotes_runtime($mqr); + + if ($isMask){ + $info['cs']="DeviceGray"; // try to force grayscale (instead of indexed) + } + $info['i']=count($this->images)+1; + if ($maskImg>0) $info['masked'] = $maskImg;### + $this->images[$file]=$info; + } + else + $info=$this->images[$file]; + //Automatic width and height calculation if needed + if($w==0 && $h==0) + { + //Put image at 72 dpi + $w=$info['w']/$this->k; + $h=$info['h']/$this->k; + } + if($w==0) + $w=$h*$info['w']/$info['h']; + if($h==0) + $h=$w*$info['h']/$info['w']; + + // embed hidden, ouside the canvas + if ((float)FPDF_VERSION>=1.7){ + if ($isMask) $x = ($this->CurOrientation=='P'?$this->CurPageSize[0]:$this->CurPageSize[1]) + 10; + }else{ + if ($isMask) $x = ($this->CurOrientation=='P'?$this->CurPageFormat[0]:$this->CurPageFormat[1]) + 10; + } + + $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); + if($link) + $this->Link($x,$y,$w,$h,$link); + + return $info['i']; +} + +// needs GD 2.x extension +// pixel-wise operation, not very fast +function ImagePngWithAlpha($file,$x,$y,$w=0,$h=0,$link='') +{ + $tmp_alpha = tempnam('.', 'mska'); + $this->tmpFiles[] = $tmp_alpha; + $tmp_plain = tempnam('.', 'mskp'); + $this->tmpFiles[] = $tmp_plain; + + list($wpx, $hpx) = getimagesize($file); + $img = imagecreatefrompng($file); + $alpha_img = imagecreate( $wpx, $hpx ); + + // generate gray scale pallete + for($c=0;$c<256;$c++) ImageColorAllocate($alpha_img, $c, $c, $c); + + // extract alpha channel + $xpx=0; + while ($xpx<$wpx){ + $ypx = 0; + while ($ypx<$hpx){ + $color_index = imagecolorat($img, $xpx, $ypx); + $alpha = 255-($color_index>>24)*255/127; // GD alpha component: 7 bit only, 0..127! + imagesetpixel($alpha_img, $xpx, $ypx, $alpha); + ++$ypx; + } + ++$xpx; + } + + imagepng($alpha_img, $tmp_alpha); + imagedestroy($alpha_img); + + // extract image without alpha channel + $plain_img = imagecreatetruecolor ( $wpx, $hpx ); + imagecopy ($plain_img, $img, 0, 0, 0, 0, $wpx, $hpx ); + imagepng($plain_img, $tmp_plain); + imagedestroy($plain_img); + + //first embed mask image (w, h, x, will be ignored) + $maskImg = $this->Image($tmp_alpha, 0,0,0,0, 'PNG', '', true); + + //embed image, masked with previously embedded mask + $this->Image($tmp_plain,$x,$y,$w,$h,'PNG',$link, false, $maskImg); +} + +function Close() +{ + parent::Close(); + // clean up tmp files + foreach($this->tmpFiles as $tmp) @unlink($tmp); +} + +/******************************************************************************* +* * +* Private methods * +* * +*******************************************************************************/ +function _putimages() +{ + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->images); + while(list($file,$info)=each($this->images)) + { + $this->_newobj(); + $this->images[$file]['n']=$this->n; + $this->_out('<_out('/Subtype /Image'); + $this->_out('/Width '.$info['w']); + $this->_out('/Height '.$info['h']); + + if (isset($info["masked"])) $this->_out('/SMask '.($this->n-1).' 0 R'); ### + + if($info['cs']=='Indexed') + $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); + else + { + $this->_out('/ColorSpace /'.$info['cs']); + if($info['cs']=='DeviceCMYK') + $this->_out('/Decode [1 0 1 0 1 0 1 0]'); + } + $this->_out('/BitsPerComponent '.$info['bpc']); + if(isset($info['f'])) + $this->_out('/Filter /'.$info['f']); + if(isset($info['parms'])) + $this->_out($info['parms']); + if(isset($info['trns']) && is_array($info['trns'])) + { + $trns=''; + for($i=0;$i_out('/Mask ['.$trns.']'); + } + $this->_out('/Length '.strlen($info['data']).'>>'); + $this->_putstream($info['data']); + unset($this->images[$file]['data']); + $this->_out('endobj'); + //Palette + if($info['cs']=='Indexed') + { + $this->_newobj(); + $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; + $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); + $this->_putstream($pal); + $this->_out('endobj'); + } + } +} + +// this method overwriing the original version is only needed to make the Image method support PNGs with alpha channels. +// if you only use the ImagePngWithAlpha method for such PNGs, you can remove it from this script. +function _parsepng($file) +{ + //Extract info from a PNG file + $f=fopen($file,'rb'); + if(!$f) + $this->Error('Can\'t open image file: '.$file); + //Check signature + if(fread($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) + $this->Error('Not a PNG file: '.$file); + //Read header chunk + fread($f,4); + if(fread($f,4)!='IHDR') + $this->Error('Incorrect PNG file: '.$file); + $w=$this->_readint($f); + $h=$this->_readint($f); + $bpc=ord(fread($f,1)); + if($bpc>8) + $this->Error('16-bit depth not supported: '.$file); + $ct=ord(fread($f,1)); + if($ct==0) + $colspace='DeviceGray'; + elseif($ct==2) + $colspace='DeviceRGB'; + elseif($ct==3) + $colspace='Indexed'; + else { + fclose($f); // the only changes are + return 'alpha'; // made in those 2 lines + } + if(ord(fread($f,1))!=0) + $this->Error('Unknown compression method: '.$file); + if(ord(fread($f,1))!=0) + $this->Error('Unknown filter method: '.$file); + if(ord(fread($f,1))!=0) + $this->Error('Interlacing not supported: '.$file); + fread($f,4); + $parms='/DecodeParms <>'; + //Scan chunks looking for palette, transparency and image data + $pal=''; + $trns=''; + $data=''; + do + { + $n=$this->_readint($f); + $type=fread($f,4); + if($type=='PLTE') + { + //Read palette + $pal=fread($f,$n); + fread($f,4); + } + elseif($type=='tRNS') + { + //Read transparency info + $t=fread($f,$n); + if($ct==0) + $trns=array(ord(substr($t,1,1))); + elseif($ct==2) + $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1))); + else + { + $pos=strpos($t,chr(0)); + if($pos!==false) + $trns=array($pos); + } + fread($f,4); + } + elseif($type=='IDAT') + { + //Read image data block + $data.=fread($f,$n); + fread($f,4); + } + elseif($type=='IEND') + break; + else + fread($f,$n+4); + } + while($n); + if($colspace=='Indexed' && empty($pal)) + $this->Error('Missing palette in '.$file); + fclose($f); + return array('w'=>$w,'h'=>$h,'cs'=>$colspace,'bpc'=>$bpc,'f'=>'FlateDecode','parms'=>$parms,'pal'=>$pal,'trns'=>$trns,'data'=>$data); +} + +function _readstream($f, $n) +{ + // Read n bytes from stream + $res = ''; + while($n>0 && !feof($f)) + { + $s = fread($f,$n); + if($s===false) + $this->Error('Error while reading stream'); + $n -= strlen($s); + $res .= $s; + } + if($n>0) + $this->Error('Unexpected end of stream'); + return $res; +} + +function _readint($f) +{ + // Read a 4-byte integer from stream + $a = unpack('Ni',$this->_readstream($f,4)); + return $a['i']; +} +} + \ No newline at end of file diff --git a/FpdfAlt/courier.php b/FpdfAlt/courier.php new file mode 100644 index 00000000..913f9a45 --- /dev/null +++ b/FpdfAlt/courier.php @@ -0,0 +1,7 @@ + diff --git a/FpdfAlt/helvetica.php b/FpdfAlt/helvetica.php new file mode 100644 index 00000000..ca94cdf2 --- /dev/null +++ b/FpdfAlt/helvetica.php @@ -0,0 +1,15 @@ +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/FpdfAlt/helveticab.php b/FpdfAlt/helveticab.php new file mode 100644 index 00000000..276cfa8c --- /dev/null +++ b/FpdfAlt/helveticab.php @@ -0,0 +1,15 @@ +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +?> diff --git a/FpdfAlt/helveticabi.php b/FpdfAlt/helveticabi.php new file mode 100644 index 00000000..8d217743 --- /dev/null +++ b/FpdfAlt/helveticabi.php @@ -0,0 +1,15 @@ +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +?> diff --git a/FpdfAlt/helveticai.php b/FpdfAlt/helveticai.php new file mode 100644 index 00000000..88bf4371 --- /dev/null +++ b/FpdfAlt/helveticai.php @@ -0,0 +1,15 @@ +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/FpdfAlt/symbol.php b/FpdfAlt/symbol.php new file mode 100644 index 00000000..43b50e45 --- /dev/null +++ b/FpdfAlt/symbol.php @@ -0,0 +1,15 @@ +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549, + ','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722, + 'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768, + 'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576, + 'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0, + chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, + chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603, + chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768, + chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042, + chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329, + chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0); +?> diff --git a/FpdfAlt/times.php b/FpdfAlt/times.php new file mode 100644 index 00000000..837c706e --- /dev/null +++ b/FpdfAlt/times.php @@ -0,0 +1,15 @@ +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, + 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, + 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, + 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, + chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); +?> diff --git a/FpdfAlt/timesb.php b/FpdfAlt/timesb.php new file mode 100644 index 00000000..09cff86a --- /dev/null +++ b/FpdfAlt/timesb.php @@ -0,0 +1,15 @@ +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, + 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, + 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, + chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/FpdfAlt/timesbi.php b/FpdfAlt/timesbi.php new file mode 100644 index 00000000..b4e38d76 --- /dev/null +++ b/FpdfAlt/timesbi.php @@ -0,0 +1,15 @@ +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667, + 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889, + 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, + 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333, + chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444); +?> diff --git a/FpdfAlt/timesi.php b/FpdfAlt/timesi.php new file mode 100644 index 00000000..0ba2b777 --- /dev/null +++ b/FpdfAlt/timesi.php @@ -0,0 +1,15 @@ +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, + 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, + 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, + 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, + chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, + chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, + chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); +?> diff --git a/FpdfAlt/zapfdingbats.php b/FpdfAlt/zapfdingbats.php new file mode 100644 index 00000000..1f926a8c --- /dev/null +++ b/FpdfAlt/zapfdingbats.php @@ -0,0 +1,15 @@ +0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, + chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939, + ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692, + 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776, + 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873, + 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317, + chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, + chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788, + chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788, + chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, + chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, + chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); +?> diff --git a/Text/ZhDetect.php b/Text/ZhDetect.php new file mode 100644 index 00000000..71a0662f --- /dev/null +++ b/Text/ZhDetect.php @@ -0,0 +1,2646 @@ + $value1) { + $out[$value1] = $arr2[$key1]; + } + return $out; + } + } +$GLOBALS['Text_zhDetect']['t2smap'] = array( + 23586 => 23588, + 20839 => 20869, + 21243 => 21248, + 24340 => 21514, + 25142 => 25143, + 20874 => 20876, + 26414 => 26415, + 27710 => 27867, + 19999 => 20002, + 20121 => 20120, + 20235 => 27762, + 20807 => 20982, + 27737 => 27745, + 27726 => 27867, + 20295 => 20267, + 20308 => 21344, + 20296 => 24067, + 20812 => 20817, + 21029 => 21035, + 21034 => 21024, + 21555 => 21556, + 21570 => 21525, + 21558 => 21584, + 22250 => 22257, + 22767 => 22766, + 22846 => 22841, + 22941 => 22918, + 24439 => 20223, + 27784 => 27785, + 27770 => 20915, + 27798 => 20914, + 27794 => 27809, + 27789 => 20913, + 28797 => 28798, + 29280 => 23427, + 31167 => 31171, + 35211 => 35265, + 35997 => 36125, + 36554 => 36710, + 36806 => 36836, + 20006 => 24182, + 20126 => 20122, + 20358 => 26469, + 20341 => 24182, + 20374 => 20177, + 20818 => 20799, + 20841 => 20004, + 21332 => 21327, + 21369 => 24676, + 22989 => 22999, + 23622 => 23626, + 23713 => 20872, + 24447 => 20315, + 25291 => 25243, + 25306 => 25340, + 26044 => 20110, + 26119 => 21319, + 26481 => 19996, + 27519 => 27521, + 27841 => 20917, + 29229 => 20105, + 29376 => 29366, + 31176 => 31868, + 31998 => 32416, + 32651 => 33416, + 33253 => 21351, + 36555 => 36711, + 38263 => 38271, + 38272 => 38376, + 20448 => 20384, + 20406 => 20387, + 20418 => 31995, + 20407 => 23616, + 20823 => 20822, + 20881 => 32964, + 21070 => 21049, + 21067 => 20811, + 21063 => 21017, + 21185 => 21170, + 21371 => 21364, + 22864 => 22850, + 23014 => 22904, + 23629 => 23608, + 24101 => 24069, + 24421 => 24422, + 24460 => 21518, + 24646 => 24658, + 26613 => 26629, + 26548 => 25296, + 27958 => 27769, + 27945 => 27844, + 28858 => 20026, + 30403 => 26479, + 31047 => 21482, + 32002 => 32419, + 32005 => 32418, + 32000 => 32426, + 32009 => 32427, + 32007 => 32421, + 32004 => 32422, + 32006 => 32417, + 33511 => 33486, + 35284 => 31563, + 35336 => 35745, + 35330 => 35746, + 35331 => 35747, + 35998 => 36126, + 36000 => 36127, + 36557 => 20891, + 36556 => 36712, + 38274 => 38377, + 38859 => 38886, + 38913 => 39029, + 39080 => 39118, + 39131 => 39134, + 20515 => 20223, + 20502 => 24184, + 20486 => 20457, + 20497 => 20204, + 20480 => 20261, + 20491 => 20010, + 20523 => 20262, + 20489 => 20179, + 20941 => 20923, + 21083 => 21018, + 21085 => 21093, + 21729 => 21592, + 23067 => 23089, + 23403 => 23385, + 23470 => 23467, + 23805 => 23777, + 23798 => 23707, + 23796 => 23704, + 24107 => 24072, + 24235 => 24211, + 24465 => 24452, + 24677 => 32827, + 24709 => 24742, + 25406 => 25375, + 26178 => 26102, + 26185 => 26187, + 26360 => 20070, + 27683 => 27668, + 28039 => 27902, + 28025 => 27971, + 28879 => 20044, + 29433 => 29421, + 29437 => 29384, + 29574 => 20857, + 30045 => 20137, + 30384 => 30129, + 30770 => 28846, + 31061 => 31192, + 31056 => 20305, + 32033 => 32442, + 32023 => 32433, + 32011 => 32441, + 32020 => 32431, + 32016 => 32445, + 32021 => 32432, + 32026 => 32423, + 32028 => 32429, + 32013 => 32435, + 32025 => 32440, + 32027 => 32439, + 33029 => 32961, + 33032 => 33033, + 33467 => 21005, + 33610 => 33606, + 33586 => 20857, + 34937 => 21482, + 35352 => 35760, + 35344 => 35750, + 35342 => 35752, + 35340 => 35751, + 35349 => 35754, + 35338 => 35759, + 35351 => 25176, + 35347 => 35757, + 35350 => 35755, + 35912 => 23682, + 36001 => 36130, + 36002 => 36129, + 36562 => 36713, + 36564 => 36715, + 36852 => 22238, + 37336 => 38025, + 37341 => 38024, + 37335 => 38026, + 37337 => 38027, + 38275 => 38378, + 38499 => 38453, + 38493 => 38485, + 38488 => 38473, + 38494 => 21319, + 38587 => 21482, + 39138 => 39269, + 39340 => 39532, + 39717 => 26007, + 20094 => 24178, + 20602 => 21681, + 20605 => 20266, + 20553 => 20255, + 20597 => 20390, + 20596 => 20391, + 21209 => 21153, + 21205 => 21160, + 21312 => 21306, + 21443 => 21442, + 21854 => 21713, + 21839 => 38382, + 21816 => 24565, + 21859 => 34900, + 21847 => 21846, + 22283 => 22269, + 22533 => 22362, + 22538 => 22441, + 22519 => 25191, + 22816 => 22815, + 23105 => 23044, + 23142 => 22919, + 23560 => 19987, + 23559 => 23558, + 23644 => 23625, + 23842 => 23781, + 23825 => 26118, + 23833 => 20177, + 23847 => 23913, + 23831 => 23703, + 24118 => 24102, + 24115 => 24080, + 24373 => 24352, + 24375 => 24378, + 24427 => 38613, + 24478 => 20174, + 24480 => 24469, + 24765 => 20932, + 24757 => 24581, + 25458 => 21367, + 25457 => 25384, + 25475 => 25195, + 25499 => 25346, + 25451 => 25194, + 25476 => 25249, + 25497 => 25379, + 25505 => 37319, + 25448 => 33293, + 25943 => 36133, + 21855 => 21551, + 25944 => 21465, + 26028 => 26025, + 26205 => 26172, + 21207 => 21206, + 26751 => 26438, + 26820 => 24323, + 26772 => 26624, + 26781 => 26465, + 26783 => 26541, + 27578 => 26432, + 27691 => 27682, + 28092 => 20937, + 28154 => 27973, + 28149 => 28170, + 28114 => 20932, + 28122 => 27882, + 28138 => 27814, + 28136 => 20928, + 29309 => 29301, + 29465 => 29424, + 29694 => 29616, + 29986 => 20135, + 30050 => 27605, + 30064 => 24322, + 30526 => 20247, + 30787 => 26417, + 32070 => 32458, + 32067 => 24358, + 32113 => 32479, + 32046 => 25166, + 32057 => 32461, + 32060 => 32459, + 32064 => 32460, + 32048 => 32454, + 32051 => 32453, + 32068 => 32452, + 32066 => 32456, + 32050 => 32449, + 32049 => 32450, + 32573 => 38069, + 32722 => 20064, + 33059 => 21767, + 33067 => 33073, + 33065 => 20462, + 33698 => 33626, + 33686 => 33550, + 33674 => 24196, + 33703 => 33483, + 34389 => 22788, + 34899 => 26415, + 34974 => 34926, + 35219 => 35269, + 35215 => 35268, + 35370 => 35775, + 35357 => 35766, + 35363 => 35776, + 35365 => 35767, + 35377 => 35768, + 35373 => 35774, + 35359 => 35772, + 35355 => 35769, + 35362 => 27427, + 36009 => 36137, + 36012 => 36131, + 36011 => 36143, + 36008 => 36135, + 36010 => 36138, + 36007 => 36139, + 36571 => 36717, + 36575 => 36719, + 36889 => 36825, + 36899 => 36830, + 36885 => 24452, + 37365 => 38039, + 37350 => 25187, + 37347 => 38035, + 37351 => 38031, + 37353 => 38034, + 38281 => 38381, + 38515 => 38472, + 38520 => 38470, + 38512 => 38452, + 38914 => 39030, + 38915 => 39031, + 39770 => 40060, + 40165 => 40479, + 40565 => 21348, + 40613 => 40614, + 20642 => 23478, + 20633 => 22791, + 20625 => 26480, + 20630 => 20263, + 20632 => 20254, + 20634 => 25928, + 20977 => 20975, + 21108 => 21056, + 21109 => 21019, + 21214 => 21171, + 21213 => 32988, + 21211 => 21195, + 21930 => 20007, + 21934 => 21333, + 21938 => 21727, + 21914 => 21796, + 21932 => 20052, + 21931 => 21507, + 22285 => 22260, + 22575 => 23591, + 22580 => 22330, + 22577 => 25253, + 22557 => 22490, + 22778 => 22774, + 23207 => 23090, + 23563 => 23547, + 23888 => 23706, + 24128 => 24103, + 24131 => 24079, + 24190 => 20960, + 24257 => 21397, + 24258 => 21410, + 24489 => 22797, + 24801 => 24694, + 24758 => 38391, + 24860 => 24812, + 24827 => 24699, + 24817 => 24700, + 25536 => 25315, + 25582 => 25381, + 25563 => 25442, + 25562 => 25196, + 25593 => 32972, + 26839 => 26531, + 26847 => 26635, + 26855 => 26632, + 26866 => 26646, + 27453 => 38054, + 27544 => 27531, + 27580 => 22771, + 27692 => 27689, + 28263 => 28044, + 28234 => 20945, + 28187 => 20943, + 28198 => 28065, + 28271 => 27748, + 28204 => 27979, + 28222 => 27985, + 28185 => 28067, + 28961 => 26080, + 29494 => 29369, + 29754 => 29648, + 29990 => 33487, + 30059 => 30011, + 30169 => 30153, + 30176 => 37240, + 30332 => 21457, + 30428 => 30423, + 30543 => 22256, + 30831 => 30746, + 31240 => 31174, + 31237 => 31246, + 31558 => 31508, + 31565 => 31499, + 32094 => 32478, + 32080 => 32467, + 32104 => 32466, + 32085 => 32477, + 32114 => 19997, + 32097 => 32476, + 32102 => 32473, + 32098 => 32474, + 32112 => 32470, + 32115 => 32475, + 32901 => 32899, + 33102 => 32958, + 33081 => 32960, + 33784 => 28895, + 33775 => 21326, + 33780 => 24245, + 33879 => 30528, + 33802 => 33713, + 33799 => 33484, + 34395 => 34394, + 35222 => 35270, + 35387 => 27880, + 35424 => 21647, + 35413 => 35780, + 35422 => 35789, + 35388 => 35777, + 35393 => 35778, + 35412 => 35791, + 35419 => 35781, + 35408 => 35784, + 35398 => 35787, + 35380 => 35785, + 35386 => 35786, + 35382 => 35779, + 36015 => 36142, + 36028 => 36148, + 36019 => 36144, + 36029 => 36155, + 36033 => 36146, + 36027 => 36153, + 36032 => 36154, + 36020 => 36149, + 36023 => 20080, + 36022 => 36140, + 36031 => 36152, + 36024 => 36151, + 36603 => 36722, + 36600 => 36724, + 36604 => 36726, + 36913 => 21608, + 36914 => 36827, + 37109 => 37038, + 37129 => 20065, + 37396 => 38046, + 37397 => 38062, + 37411 => 38041, + 37385 => 38048, + 37406 => 38055, + 37389 => 38045, + 37392 => 38052, + 37393 => 38051, + 38292 => 38389, + 38287 => 38384, + 38283 => 24320, + 38289 => 38386, + 38291 => 38388, + 38290 => 38386, + 38286 => 38387, + 38538 => 38431, + 38542 => 38454, + 38525 => 38451, + 38532 => 22564, + 38642 => 20113, + 38860 => 38887, + 38917 => 39033, + 38918 => 39034, + 38920 => 39035, + 39146 => 39274, + 39151 => 39277, + 39145 => 39272, + 39154 => 39278, + 39149 => 39276, + 39342 => 20911, + 39341 => 39533, + 40643 => 40644, + 20098 => 20081, + 20653 => 20323, + 20661 => 20538, + 20659 => 20256, + 20677 => 20165, + 20670 => 20542, + 20663 => 20260, + 20655 => 20588, + 20679 => 25134, + 21111 => 38130, + 21222 => 21119, + 21218 => 21183, + 21219 => 31215, + 21295 => 27719, + 21966 => 21527, + 21959 => 21868, + 21978 => 21596, + 21958 => 21595, + 22290 => 22253, + 22291 => 22278, + 22615 => 28034, + 22618 => 20898, + 22602 => 22359, + 22626 => 22366, + 22610 => 22488, + 22603 => 33556, + 22887 => 22885, + 23229 => 22920, + 23228 => 23210, + 24185 => 24178, + 24264 => 21414, + 24338 => 24337, + 24409 => 27719, + 24492 => 24439, + 24859 => 29233, + 24900 => 26647, + 24909 => 24864, + 24894 => 24574, + 24884 => 24582, + 24887 => 24698, + 25662 => 27048, + 25613 => 25439, + 25654 => 25250, + 25622 => 25671, + 25623 => 25443, + 25606 => 26500, + 26249 => 26198, + 26248 => 26197, + 26264 => 26104, + 26371 => 20250, + 26989 => 19994, + 26997 => 26497, + 26954 => 26472, + 26984 => 26722, + 26963 => 26539, + 27506 => 23681, + 27584 => 27585, + 28317 => 27807, + 28357 => 28781, + 28348 => 28287, + 28331 => 28201, + 28310 => 20934, + 28356 => 27815, + 29017 => 28895, + 29033 => 28902, + 29001 => 28860, + 29036 => 28800, + 29029 => 28949, + 29014 => 26262, + 29242 => 29239, + 29509 => 29422, + 29807 => 29701, + 29759 => 29682, + 30070 => 24403, + 30194 => 40635, + 30202 => 30201, + 30430 => 30415, + 30558 => 30544, + 30556 => 30529, + 31103 => 31108, + 33836 => 19975, + 31260 => 26865, + 31263 => 31104, + 31680 => 33410, + 31591 => 31509, + 31925 => 31908, + 32147 => 32463, + 32121 => 32482, + 32145 => 25414, + 32129 => 32465, + 32143 => 32485, + 32091 => 32486, + 32681 => 20041, + 32680 => 32673, + 32854 => 22307, + 33144 => 32928, + 33139 => 33050, + 33131 => 32959, + 33126 => 33041, + 33911 => 33636, + 33894 => 33479, + 33865 => 21494, + 33845 => 33716, + 34396 => 34383, + 34399 => 21495, + 34555 => 34581, + 34566 => 34476, + 35036 => 34917, + 35037 => 35013, + 35041 => 37324, + 35018 => 34949, + 35228 => 30522, + 35435 => 35815, + 35442 => 35813, + 35443 => 35814, + 35430 => 35797, + 35433 => 35799, + 35440 => 35800, + 35463 => 22840, + 35452 => 35801, + 35427 => 35811, + 35488 => 35802, + 35441 => 35805, + 35461 => 35803, + 35437 => 35809, + 35426 => 35810, + 35438 => 35808, + 35436 => 35807, + 36042 => 36156, + 36039 => 36164, + 36040 => 36158, + 36036 => 36159, + 36018 => 36160, + 36035 => 36161, + 36034 => 36162, + 36037 => 36165, + 36321 => 36857, + 36611 => 36739, + 36617 => 36733, + 36606 => 36732, + 36618 => 36734, + 36786 => 20892, + 36939 => 36816, + 36938 => 28216, + 36948 => 36798, + 36949 => 36829, + 36942 => 36807, + 37138 => 37049, + 37431 => 38068, + 37463 => 38067, + 37432 => 38073, + 37437 => 38072, + 37440 => 38078, + 37438 => 38080, + 37467 => 38085, + 37451 => 21032, + 37476 => 38057, + 37457 => 38082, + 37428 => 38083, + 37449 => 38089, + 37453 => 38091, + 37445 => 24040, + 37433 => 38093, + 37439 => 38079, + 37466 => 38086, + 38296 => 38392, + 38549 => 38504, + 38603 => 38589, + 38651 => 30005, + 38928 => 39044, + 38929 => 39037, + 38931 => 39039, + 38922 => 39036, + 38930 => 39041, + 38924 => 39042, + 39164 => 39282, + 39156 => 39284, + 39165 => 39281, + 39166 => 39280, + 39347 => 39536, + 39345 => 39534, + 39348 => 39535, + 40169 => 40480, + 20718 => 31461, + 20709 => 20389, + 20693 => 20166, + 20689 => 20392, + 20721 => 38599, + 21123 => 21010, + 21297 => 21294, + 21421 => 21388, + 22039 => 23581, + 22036 => 21589, + 22022 => 21497, + 22029 => 21949, + 22038 => 21863, + 22006 => 21716, + 22296 => 22242, + 22294 => 22270, + 22645 => 23576, + 22666 => 22443, + 22649 => 22545, + 22781 => 23551, + 22821 => 20249, + 22818 => 26790, + 22890 => 22842, + 22889 => 22849, + 23255 => 22954, + 23527 => 23425, + 23526 => 23454, + 23522 => 23517, + 23565 => 23545, + 23650 => 23649, + 23940 => 23853, + 23943 => 23702, + 24163 => 24065, + + 24151 => 24124, + 24390 => 21035, + 24505 => 24443, + 24903 => 27575, + 24907 => 24577, + 24931 => 24815, + 24927 => 24696, + 24922 => 24813, + 24920 => 24808, + 25695 => 25602, + 25722 => 25240, + 25681 => 25524, + 25723 => 25530, + 26274 => 30021, + 27054 => 33635, + 27091 => 26464, + 27083 => 26500, + 27085 => 26538, + 27046 => 24178, + 27699 => 27698, + 28414 => 28378, + 28460 => 28173, + 28450 => 27721, + 28415 => 28385, + 28399 => 28382, + 28472 => 28176, + 28466 => 28072, + 28451 => 28063, + 28396 => 27818, + 28417 => 28180, + 28402 => 28183, + 28364 => 28068, + 28407 => 21348, + 29074 => 33639, + 29246 => 23572, + 29334 => 33638, + 29508 => 29425, + 29796 => 29814, + 29795 => 29712, + 29802 => 29595, + 30247 => 30111, + 30221 => 30113, + 30219 => 30127, + 30217 => 24840, + 30227 => 30186, + 30433 => 23613, + 30435 => 30417, + 30889 => 30805, + 31118 => 31087, + 31117 => 31096, + 31278 => 31181, + 31281 => 31216, + 31402 => 27964, + 31401 => 31389, + 31627 => 31546, + 31645 => 38067, + 31631 => 31581, + 32187 => 32509, + 32176 => 32510, + 32156 => 32508, + 32189 => 32496, + 32190 => 32491, + 32160 => 32511, + 32202 => 32039, + 32180 => 32512, + 32178 => 32593, + 32177 => 32434, + 32186 => 32494, + 32162 => 32504, + 32191 => 32501, + 32181 => 24425, + 32184 => 32438, + 32173 => 32500, + 32210 => 32490, + 32199 => 32513, + 32172 => 32502, + 32624 => 32602, + 32862 => 38395, + 33274 => 21488, + 33287 => 19982, + 33990 => 24109, + 33950 => 33669, + 33995 => 30422, + 33984 => 33642, + 33936 => 25628, + 33980 => 33485, + 34645 => 34432, + 35069 => 21046, + 35494 => 35829, + 35468 => 24535, + 35486 => 35821, + 35491 => 35820, + 35469 => 35748, + 35489 => 35819, + 35492 => 35823, + 35498 => 35828, + 35493 => 35824, + 35496 => 35826, + 35480 => 35825, + 35473 => 35827, + 35482 => 35822, + 35981 => 29432, + 36051 => 23486, + 36049 => 36168, + 36050 => 36170, + 36249 => 36213, + 36245 => 36214, + 36628 => 36741, + 36626 => 36740, + 36629 => 36731, + 36627 => 25405, + 36960 => 36828, + 36956 => 36874, + 36953 => 36965, + 36958 => 36882, + 37496 => 38128, + 37504 => 38134, + 37509 => 38108, + 37528 => 38125, + 37526 => 38114, + 37499 => 38124, + 37523 => 38120, + 37532 => 34900, + 37544 => 38133, + 37521 => 38115, + 38305 => 38402, + 38312 => 38394, + 38313 => 38397, + 38307 => 38401, + 38309 => 38400, + 38308 => 21512, + 38555 => 38469, + 38935 => 39047, + 38936 => 39046, + 39087 => 39122, + 39089 => 21488, + 39171 => 39290, + 39173 => 39292, + 39180 => 39285, + 39177 => 39287, + 39361 => 39539, + 39599 => 32942, + 40180 => 40483, + 40182 => 40482, + 40179 => 20964, + 40636 => 20040, + 40778 => 40784, + 20740 => 20159, + 20736 => 20202, + 20729 => 20215, + 20738 => 20396, + 20744 => 20393, + 20745 => 20461, + 20741 => 24403, + 20956 => 20955, + 21127 => 21095, + 21129 => 21016, + 21133 => 21073, + 21130 => 21053, + 21426 => 21385, + 22062 => 21792, + 22057 => 21719, + 22099 => 22040, + 22132 => 21943, + 22063 => 21880, + 22064 => 21501, + 22707 => 22367, + 22684 => 22368, + 22702 => 22549, + 23291 => 23092, + 23307 => 23157, + 23285 => 22953, + 23308 => 23047, + 23304 => 23046, + 23532 => 23485, + 23529 => 23457, + 23531 => 20889, + 23652 => 23618, + 23956 => 23898, + 24159 => 24092, + 24290 => 24223, + 24282 => 21416, + 24287 => 24217, + 24285 => 21422, + 24291 => 24191, + 24288 => 21378, + 24392 => 24377, + 24501 => 24449, + 24950 => 24198, + 24942 => 34385, + 24962 => 24551, + 24956 => 25114, + 24939 => 24578, + 24958 => 27442, + 24976 => 24604, + 25003 => 24751, + 24986 => 24814, + 24996 => 24868, + 25006 => 24579, + 25711 => 25370, + 25778 => 25169, + 25736 => 25438, + 25744 => 25745, + 25765 => 25320, + 25747 => 25376, + 25771 => 25242, + 25754 => 25467, + 25779 => 25599, + 25973 => 25932, + 25976 => 25968, + 26283 => 26242, + 26289 => 26165, + 27171 => 26679, + 27112 => 26881, + 27137 => 26729, + 27166 => 26530, + 27161 => 26631, + 27155 => 27004, + 27123 => 26728, + 27138 => 20048, + 27141 => 26526, + 27153 => 26753, + 27472 => 27431, + 27470 => 21497, + 27556 => 27527, + 27590 => 27572, + 28479 => 27974, + 28497 => 27900, + 28500 => 27905, + 28550 => 27975, + 28507 => 28508, + 28528 => 28291, + 28516 => 28070, + 28567 => 28071, + 28527 => 27988, + 28511 => 27899, + 29105 => 28909, + 29339 => 29286, + 29518 => 22870, + 29801 => 33721, + 30241 => 30126, + 30362 => 30353, + 30394 => 30385, + 30436 => 30424, + 30599 => 30511, + 30906 => 30830, + 30908 => 30721, + 31296 => 35895, + 31407 => 31377, + 31406 => 31351, + 31684 => 33539, + 32224 => 32532, + 32244 => 32451, + 32239 => 32428, + 32251 => 33268, + 32216 => 32516, + 32236 => 32517, + 32221 => 32521, + 32232 => 32534, + 32227 => 32536, + 32218 => 32447, + 32222 => 32526, + 32233 => 32531, + 32158 => 32525, + 32217 => 32514, + 32242 => 32520, + 32249 => 32519, + 32629 => 39554, + 32631 => 32610, + 33184 => 33014, + 33178 => 32932, + 34030 => 33714, + 34093 => 33643, + 34083 => 33931, + 34068 => 21340, + 34085 => 33905, + 34054 => 33777, + 34662 => 34430, + 34680 => 34583, + 34664 => 34417, + 34907 => 21355, + 34909 => 20914, + 35079 => 22797, + 35516 => 35850, + 35538 => 35845, + 35527 => 35848, + 35524 => 35846, + 35477 => 35806, + 35531 => 35831, + 35576 => 35832, + 35506 => 35838, + 35529 => 35839, + 35522 => 35844, + 35519 => 35843, + 35504 => 35841, + 35542 => 35770, + 35533 => 35812, + 35510 => 35847, + 35513 => 35837, + 35547 => 35840, + 35918 => 31446, + 35948 => 29482, + 36064 => 36180, + 36062 => 36175, + 36070 => 36171, + 36068 => 36145, + 36076 => 36134, + 36077 => 36172, + 36066 => 36132, + 36067 => 21334, + 36060 => 36176, + 36074 => 36136, + 36065 => 36179, + 36368 => 36341, + 36385 => 34615, + 36637 => 36745, + 36635 => 36742, + 36639 => 36749, + 36649 => 36744, + 36646 => 36743, + 36650 => 36718, + 36636 => 36750, + 36638 => 36747, + 36645 => 36746, + 36969 => 36866, + 36983 => 36801, + 37168 => 37051, + 37165 => 37073, + 37159 => 37011, + 37251 => 33100, + 37573 => 38156, + 37563 => 38161, + 37559 => 38144, + 37610 => 38138, + 37548 => 38096, + 37604 => 38148, + 37569 => 38109, + 37555 => 38160, + 37564 => 38153, + 37586 => 38155, + 37575 => 38049, + 37616 => 38146, + 37554 => 28938, + 38317 => 38398, + 38321 => 38405, + 38799 => 24041, + 38945 => 39049, + 38955 => 20463, + 38940 => 39052, + 39091 => 21038, + 39178 => 20859, + 39187 => 39295, + 39186 => 39297, + 39192 => 20313, + 39389 => 39548, + 39376 => 39547, + 39391 => 39543, + 39387 => 39542, + 39377 => 39549, + 39381 => 39550, + 39378 => 39545, + 39385 => 39544, + 39662 => 21457, + 39719 => 38393, + 39799 => 40063, + 39791 => 40065, + 40198 => 40489, + 40201 => 40486, + 40617 => 40632, + 40786 => 40831, + 20760 => 23613, + 20756 => 20454, + 20752 => 20647, + 20757 => 20394, + 20906 => 24130, + 21137 => 21058, + 21235 => 21195, + 22137 => 24403, + 22136 => 21544, + 22117 => 21725, + 22127 => 22003, + 22718 => 22438, + 22727 => 22363, + 22894 => 22859, + 23325 => 34949, + 23416 => 23398, + 23566 => 23548, + 24394 => 24378, + 25010 => 23466, + 24977 => 20973, + 24970 => 24811, + 25037 => 25044, + 25014 => 24518, + 25136 => 25112, + 25793 => 25317, + 25803 => 25377, + 25787 => 25374, + 25818 => 25454, + 25796 => 25523, + 25799 => 25321, + 25791 => 25441, + 25812 => 25285, + 25790 => 25373, + 26310 => 21382, + 26313 => 26195, + 26308 => 26196, + 26311 => 26137, + 26296 => 20102, + 27192 => 26420, + 27194 => 26726, + 27243 => 27178, + 27193 => 26641, + 27234 => 26925, + 27211 => 26725, + 27231 => 26426, + 27208 => 26721, + 27511 => 21382, + 28593 => 28096, + 28611 => 27987, + 28580 => 27901, + 28609 => 27978, + 28582 => 28394, + 28576 => 28177, + 29118 => 28861, + 29129 => 28822, + 29138 => 28903, + 29128 => 28783, + 29145 => 28907, + 29148 => 28950, + 29124 => 28976, + 29544 => 29420, + 29859 => 29585, + 29964 => 29935, + 30266 => 30232, + 30439 => 21346, + 30622 => 30610, + 30938 => 30742, + 30951 => 30875, + 31142 => 24481, + 31309 => 31215, + 31310 => 39062, + 31308 => 31267, + 31418 => 31397, + 31761 => 34001, + 31689 => 31569, + 31716 => 31491, + 31721 => 31579, + 32266 => 32546, + 32273 => 32547, + 32264 => 33830, + 32283 => 32538, + 32291 => 21439, + 32286 => 32543, + 32285 => 32540, + 32265 => 32537, + 32272 => 32457, + 33193 => 33147, + 33288 => 20852, + 33369 => 33329, + 34153 => 33633, + 34157 => 33831, + 34154 => 33436, + 34718 => 34434, + 34722 => 33828, + 35122 => 35044, + 35242 => 20146, + 35238 => 35278, + 35558 => 35867, + 35578 => 35866, + 35563 => 35855, + 35569 => 35763, + 35584 => 35851, + 35548 => 35853, + 35559 => 35856, + 35566 => 21672, + 35582 => 35834, + 35585 => 35858, + 35586 => 35859, + 35575 => 35773, + 35565 => 35861, + 35571 => 35865, + 35574 => 35852, + 35580 => 35862, + 35987 => 29483, + 36084 => 36182, + 36404 => 36362, + 36667 => 36752, + 36655 => 36753, + 36664 => 36755, + 36659 => 36751, + 36774 => 21150, + 36984 => 36873, + 36978 => 36831, + 36988 => 36797, + 36986 => 36951, + 37172 => 37050, + 37664 => 38189, + 37686 => 34920, + 37624 => 38191, + 37683 => 38192, + 37679 => 38169, + 37666 => 38065, + 37628 => 38050, + 37675 => 38177, + 37636 => 24405, + 37658 => 38126, + 37648 => 38181, + 37670 => 38182, + 37665 => 38172, + 37653 => 38175, + 37678 => 38178, + 37657 => 38193, + 38331 => 38414, + 38568 => 38543, + 38570 => 38505, + 38673 => 27838, + 38748 => 38745, + 38758 => 33148, + 38960 => 39050, + 38968 => 39048, + 38971 => 39057, + 38967 => 39060, + 38957 => 22836, + 38969 => 39059, + 38948 => 39056, + 39208 => 39302, + 39198 => 39279, + 39195 => 39300, + 39201 => 39301, + 39194 => 32948, + 39405 => 39559, + 39394 => 39560, + 39409 => 39558, + 39720 => 21700, + 39825 => 40077, + 40213 => 40501, + 40227 => 40490, + 40230 => 40495, + 40232 => 40493, + 40210 => 40496, + 40219 => 40499, + 40845 => 40857, + 40860 => 40863, + 20778 => 20248, + 20767 => 20607, + 20786 => 20648, + 21237 => 21169, + 22144 => 21659, + 22160 => 23581, + 22151 => 21523, + 22739 => 21387, + 23344 => 23156, + 23338 => 23252, + 23332 => 23351, + 23607 => 23604, + 23656 => 23654, + 23996 => 23679, + 23994 => 23725, + 23997 => 23731, + 23992 => 23896, + 24171 => 24110, + 24396 => 24357, + 25033 => 24212, + 25031 => 24691, + 25138 => 25103, + 25802 => 20987, + 25824 => 25380, + 25840 => 25319, + 25836 => 25311, + 25841 => 25601, + 25986 => 25947, + 25987 => 27609, + 26326 => 26279, + 27284 => 26723, + 27298 => 26816, + 27292 => 26727, + 27355 => 26633, + 27299 => 27183, + 27566 => 27539, + 27656 => 27617, + 28632 => 27870, + 28657 => 28392, + 28639 => 27982, + 28635 => 33945, + 28644 => 28059, + 28651 => 28389, + 28544 => 28073, + 28652 => 27994, + 28629 => 28287, + 28656 => 28493, + 29151 => 33829, + 29158 => 28799, + 29165 => 28891, + 29164 => 27585, + 29172 => 28905, + 29254 => 22681, + 29552 => 29406, + 29554 => 33719, + 29872 => 29615, + 29862 => 29815, + 30278 => 30184, + 30274 => 30103, + 30442 => 33633, + 30637 => 20102, + 30703 => 30699, + 30959 => 30710, + 31146 => 31109, + 31757 => 31699, + 31712 => 31601, + 31966 => 31914, + 31970 => 27169, + 31965 => 31937, + 32302 => 32553, + 32318 => 32489, + 32326 => 32554, + 32311 => 32533, + 32306 => 32551, + 32323 => 32503, + 32299 => 32541, + 32317 => 24635, + 32305 => 32437, + 32325 => 32555, + 32308 => 32420, + 32313 => 32549, + 32328 => 35137, + 32309 => 32550, + 32303 => 28436, + 32882 => 22768, + 32880 => 32874, + 32879 => 32852, + 32883 => 32824, + 33215 => 33043, + 33213 => 32966, + 33225 => 33080, + 33214 => 33037, + 33256 => 20020, + 33289 => 20030, + 33393 => 33392, + 34193 => 23004, + 34196 => 34103, + 34186 => 34015, + 34407 => 20111, + 34747 => 34684, + 34760 => 34632, + 35131 => 20149, + 35128 => 35099, + 35244 => 35274, + 35598 => 35868, + 35607 => 35876, + 35609 => 35878, + 35611 => 35762, + 35594 => 35854, + 35616 => 35875, + 35613 => 35874, + 35588 => 35466, + 35600 => 35879, + 35903 => 28330, + 36090 => 36186, + 36093 => 36187, + 36092 => 36141, + 36088 => 21097, + 36091 => 36185, + 36264 => 36235, + 36676 => 36758, + 36670 => 36759, + 36674 => 27586, + 36677 => 36757, + 36671 => 33286, + 36996 => 36824, + 36993 => 36808, + 37283 => 31958, + 37278 => 37213, + 37276 => 19985, + 37709 => 38208, + 37762 => 38209, + 37672 => 38170, + 37749 => 38190, + 37706 => 38142, + 37733 => 38194, + 37707 => 38149, + 37656 => 38180, + 37758 => 38047, + 37740 => 38201, + 37723 => 38203, + 37744 => 38206, + 37722 => 38038, + 37716 => 38199, + 38346 => 38420, + 38347 => 38421, + 38348 => 38417, + 38344 => 38385, + 38342 => 26495, + 38577 => 38544, + 38584 => 38582, + 38614 => 34429, + 38867 => 38889, + 38982 => 39063, + 39094 => 39123, + 39221 => 21890, + 39425 => 39563, + 39423 => 39567, + 39854 => 40092, + 39851 => 40091, + 39850 => 40084, + 39853 => 40081, + 40251 => 40511, + 40255 => 40509, + 40670 => 28857, + 40779 => 25995, + 21474 => 19995, + 22165 => 22108, + 22190 => 21521, + 22745 => 22329, + 22744 => 22418, + 23352 => 23158, + 25059 => 25041, + 25844 => 25193, + 25842 => 25527, + 25854 => 25200, + 25862 => 25781, + 25850 => 25670, + 25851 => 25822, + 25847 => 25783, + 26039 => 26029, + 27315 => 27103, + 27331 => 26588, + 27323 => 27099, + 27320 => 26592, + 27330 => 26873, + 27310 => 26812, + 27311 => 21488, + 27487 => 27428, + 27512 => 24402, + 27567 => 27553, + 28681 => 27899, + 28683 => 27784, + 28670 => 28388, + 28678 => 28174, + 28666 => 28293, + 28687 => 27983, + 29179 => 29071, + 29180 => 28908, + 29182 => 28952, + 29559 => 29367, + 29557 => 29454, + 29973 => 29934, + 30296 => 30112, + 30290 => 24840, + 30652 => 30545, + 30990 => 30784, + 31150 => 31036, + 31329 => 31313, + 31330 => 31229, + 31328 => 31230, + 31428 => 31388, + 31429 => 31373, + 31787 => 31659, + 31774 => 31658, + 31779 => 31697, + 31777 => 31616, + 31975 => 31918, + 32340 => 32455, + 32341 => 32558, + 32350 => 32469, + 32346 => 32557, + 32353 => 32483, + 32338 => 32559, + 32345 => 32763, + 32584 => 22363, + 32761 => 32728, + 32887 => 32844, + 32886 => 32834, + 33229 => 33040, + 33231 => 33169, + 33290 => 26087, + 34217 => 33832, + 34253 => 34013, + 34249 => 20511, + 34234 => 33632, + 34214 => 33616, + 34799 => 34546, + 34796 => 34633, + 34802 => 34411, + 35250 => 35280, + 35316 => 35294, + 35624 => 35871, + 35641 => 35880, + 35628 => 35884, + 35627 => 35882, + 35920 => 20016, + 36101 => 36184, + 36451 => 36434, + 36452 => 36394, + 36447 => 36857, + 36437 => 36344, + 36544 => 36527, + 36681 => 36716, + 36685 => 36761, + 36999 => 36841, + 37291 => 21307, + 37292 => 37233, + 37328 => 21400, + 37780 => 38229, + 37770 => 38225, + 37782 => 38145, + 37794 => 38056, + 37811 => 38221, + 37806 => 38215, + 37804 => 38224, + 37808 => 38226, + 37784 => 38217, + 37786 => 38180, + 37783 => 26538, + 38356 => 38422, + 38358 => 38383, + 38352 => 38423, + 38357 => 38425, + 38626 => 31163, + 38620 => 26434, + 38617 => 21452, + 38619 => 38607, + 38622 => 40481, + 38692 => 28316, + 38822 => 31179, + 38989 => 39069, + 38991 => 39068, + 38988 => 39064, + 38990 => 39066, + 38995 => 39067, + 39098 => 25196, + 39230 => 39311, + 39231 => 39306, + 39229 => 39304, + 39438 => 39569, + 39686 => 26494, + 39758 => 39753, + 39882 => 40104, + 39881 => 40100, + 39933 => 40107, + 39880 => 40102, + 39872 => 40103, + 40273 => 40515, + 40285 => 40517, + 40288 => 40516, + 40725 => 20908, + 22181 => 21693, + 22750 => 22351, + 22751 => 22404, + 22754 => 22364, + 23541 => 23456, + 40848 => 24222, + 24300 => 24208, + 25074 => 24809, + 25079 => 24576, + 25078 => 25042, + 25871 => 25314, + 26336 => 26103, + 27365 => 27249, + 27357 => 26911, + 27354 => 27016, + 27347 => 27257, + 28703 => 28487, + 28712 => 28625, + 28701 => 27813, + 28693 => 28626, + 28696 => 27896, + 29197 => 28865, + 29272 => 29261, + 29346 => 29322, + 29560 => 20861, + 29562 => 29549, + 29885 => 29626, + 29898 => 29756, + 30087 => 30068, + 30303 => 30250, + 30305 => 30196, + 30663 => 33945, + 31001 => 30861, + 31153 => 31095, + 31339 => 33719, + 31337 => 31283, + 31806 => 24088, + 31805 => 31614, + 31799 => 27280, + 32363 => 31995, + 32365 => 33575, + 32377 => 32462, + 32361 => 32499, + 32362 => 32472, + 32645 => 32599, + 32371 => 32564, + 32694 => 33211, + 33240 => 33098, + 34269 => 33402, + 34282 => 34222, + 34277 => 33647, + 34295 => 34223, + 34811 => 34433, + 34821 => 34631, + 34829 => 34638, + 35168 => 35014, + 35158 => 34948, + 35649 => 21719, + 35676 => 35889, + 35672 => 35782, + 35657 => 35777, + 35674 => 35885, + 35662 => 35890, + 35663 => 35749, + 35654 => 22075, + 35673 => 35887, + 36104 => 36192, + 36106 => 36190, + 36474 => 36343, + 36692 => 36762, + 36686 => 36735, + 36781 => 36766, + 37002 => 36793, + 37297 => 37222, + 37857 => 38236, + 37841 => 38237, + 37855 => 38130, + 37827 => 38238, + 37832 => 38142, + 37852 => 38231, + 37853 => 38232, + 37858 => 38230, + 37837 => 38233, + 37848 => 38197, + 37860 => 38210, + 37847 => 38143, + 37864 => 37694, + 38364 => 20851, + 38580 => 38471, + 38627 => 38590, + 38695 => 38654, + 38876 => 38892, + 38907 => 38901, + 39006 => 31867, + 39000 => 24895, + 39003 => 39072, + 39100 => 39125, + 39237 => 39314, + 39241 => 39313, + 39446 => 39579, + 39449 => 39575, + 39693 => 32993, + 39912 => 40120, + 39911 => 40115, + 39894 => 40109, + 39899 => 40119, + 40329 => 40529, + 40289 => 40521, + 40306 => 40522, + 40298 => 40524, + 40300 => 40527, + 40599 => 20029, + 21240 => 21149, + 22184 => 21657, + 22198 => 22052, + 22196 => 20005, + 23363 => 23064, + 23542 => 23453, + 25080 => 24748, + 25082 => 24527, + 25876 => 25318, + 25881 => 25600, + 26407 => 32999, + 27372 => 27015, + 28734 => 28572, + 28720 => 24357, + 28722 => 28491, + 29200 => 28809, + 29563 => 29486, + 29903 => 29649, + 30306 => 30162, + 30309 => 30151, + 31014 => 30719, + 31018 => 30778, + 31020 => 30718, + 31019 => 30782, + 31431 => 31398, + 31478 => 31454, + 31820 => 31609, + 31811 => 31726, + 31984 => 22242, + 36782 => 36779, + 32381 => 32548, + 32380 => 32487, + 32588 => 32578, + 33242 => 33002, + 33382 => 33328, + 34297 => 34108, + 34298 => 34106, + 34310 => 33446, + 34315 => 33529, + 34311 => 33487, + 34314 => 34164, + 34836 => 34461, + 35172 => 35124, + 35258 => 35273, + 35320 => 35302, + 35696 => 35758, + 35695 => 35793, + 35679 => 22122, + 35691 => 35893, + 36111 => 36194, + 36109 => 36193, + 36489 => 36280, + 36482 => 36342, + 37323 => 37322, + 37912 => 38047, + 37891 => 38105, + 37885 => 38152, + 38369 => 38416, + 39108 => 39128, + 39250 => 39286, + 39249 => 39269, + 39467 => 39582, + 39472 => 33150, + 39479 => 39578, + 39955 => 40131, + 39949 => 40133, + 40569 => 21688, + 40629 => 38754, + 40680 => 20826, + 40799 => 40835, + 40803 => 20986, + 40801 => 40836, + 20791 => 20458, + 20792 => 13417, + 22209 => 21995, + 22208 => 21869, + 22210 => 22179, + 23660 => 23646, + 25084 => 24807, + 25086 => 24913, + 25885 => 25668, + 25884 => 25658, + 26005 => 26003, + 27387 => 27185, + 27396 => 26639, + 27386 => 26818, + 27570 => 27516, + 29211 => 28866, + 29351 => 29306, + 29908 => 29838, + 30313 => 30302, + 30675 => 32999, + 31824 => 34276, + 32399 => 32544, + 32396 => 32493, + 34327 => 34326, + 34349 => 20848, + 34330 => 34259, + 34851 => 34510, + 34847 => 34593, + 35178 => 34972, + 35180 => 25670, + 35261 => 35272, + 35700 => 35892, + 35703 => 25252, + 35709 => 35465, + 36115 => 36163, + 36490 => 36364, + 36493 => 36291, + 36491 => 36347, + 36703 => 36720, + 36783 => 36777, + 37934 => 38256, + 37939 => 38253, + 37941 => 38081, + 37946 => 38107, + 37944 => 38094, + 37938 => 38255, + 37931 => 38220, + 38370 => 36767, + 38911 => 21709, + 39015 => 39038, + 39013 => 39074, + 39255 => 39144, + 39493 => 39537, + 39491 => 39584, + 39488 => 34022, + 39486 => 39585, + 39631 => 39621, + 39981 => 40141, + 39973 => 40143, + 40367 => 33722, + 40372 => 40548, + 40386 => 40542, + 40796 => 40839, + 40806 => 40840, + 40807 => 21870, + 20796 => 20456, + 20795 => 20645, + 22216 => 21587, + 22217 => 21872, + 23423 => 23402, + 24020 => 24005, + 24018 => 23782, + 24398 => 24367, + 25892 => 25674, + 27402 => 26435, + 27489 => 27426, + 28753 => 27922, + 28760 => 28393, + 29568 => 29473, + 30090 => 21472, + 30318 => 30270, + 30316 => 30307, + 31840 => 31548, + 31839 => 31809, + 32894 => 32843, + 32893 => 21548, + 33247 => 33039, + 35186 => 34989, + 35183 => 34924, + 35712 => 35835, + 36118 => 36174, + 36119 => 36189, + 36497 => 36399, + 36499 => 36396, + 36705 => 36756, + 37192 => 37094, + 37956 => 38136, + 37969 => 37492, + 37970 => 37492, + 38717 => 38657, + 38851 => 38801, + 38849 => 32560, + 39019 => 39076, + 39509 => 39556, + 39501 => 39553, + 39634 => 33039, + 39706 => 39035, + 40009 => 40150, + 39985 => 40098, + 39998 => 40148, + 39995 => 40151, + 40403 => 40551, + 40407 => 40485, + 40756 => 40761, + 40812 => 40841, + 40810 => 40842, + 40852 => 40858, + 22220 => 33487, + 24022 => 23721, + 25088 => 24651, + 25891 => 25371, + 25898 => 25605, + 26348 => 26194, + 29914 => 29906, + 31434 => 31363, + 31844 => 31614, + 32403 => 32552, + 32406 => 32420, + 32404 => 25165, + 33250 => 33244, + 34367 => 33821, + 34865 => 34506, + 35722 => 21464, + 37008 => 36902, + 37007 => 36923, + 37987 => 38259, + 37984 => 38084, + 38760 => 38757, + 39023 => 26174, + 39260 => 39181, + 39514 => 24778, + 39515 => 39551, + 39511 => 39564, + 39636 => 20307, + 40020 => 40157, + 40023 => 40158, + 40022 => 40156, + 40421 => 40502, + 40692 => 38665, + 22225 => 22065, + 22761 => 22365, + 25900 => 25597, + 30321 => 30251, + 30322 => 30315, + 32648 => 32641, + 34870 => 34453, + 35731 => 35753, + 35730 => 35863, + 35734 => 35894, + 33399 => 33395, + 36123 => 36195, + 37312 => 37247, + 37994 => 28809, + 38722 => 38643, + 38728 => 28789, + 38724 => 38701, + 38854 => 21315, + 39024 => 39078, + 39519 => 39588, + 39714 => 39699, + 39768 => 39751, + 40031 => 40078, + 40441 => 40560, + 40442 => 40557, + 40572 => 30897, + 40573 => 30416, + 40711 => 40140, + 40823 => 40844, + 40818 => 40843, + 24307 => 21381, + 27414 => 27012, + 28771 => 28286, + 31852 => 31729, + 31854 => 31657, + 34875 => 34542, + 35264 => 35266, + 36513 => 36433, + 37313 => 34885, + 38002 => 38262, + 38000 => 38053, + 39025 => 39045, + 39262 => 39307, + 39638 => 39627, + 40652 => 40649, + 28772 => 28390, + 30682 => 30633, + 35738 => 36190, + 38007 => 38218, + 38857 => 38831, + 39522 => 39540, + 39525 => 39589, + 32412 => 32518, + 35740 => 35872, + 36522 => 36495, + 37317 => 37245, + 38013 => 38075, + 38014 => 37550, + 38012 => 38179, + 40055 => 40132, + 40056 => 40072, + 40695 => 40681, + 35924 => 33395, + 38015 => 20991, + 40474 => 40550, + 39530 => 39562, + 39729 => 37057, + 40475 => 40563, + 40478 => 40510, + 31858 => 21505, + 20189 => 21516, + 27596 => 27595, + 24194 => 20164, + 22908 => 23033, + 25182 => 25421, + 25184 => 21449, + 20322 => 28192, + 24567 => 24671, + 25911 => 32771, + 30337 => 30338, + 32912 => 33011, + 33424 => 33476, + 38440 => 21380, + 38447 => 22336, + 22389 => 19992, + 24354 => 38892, + 24627 => 24653, + 25108 => 25099, + 25297 => 38067, + 26514 => 26720, + 27520 => 22829, + 27869 => 28335, + 30015 => 27667, + 34415 => 34412, + 20417 => 20451, + 21060 => 21037, + 21398 => 24222, + 21401 => 21389, + 33549 => 33503, + 25295 => 25343, + 25923 => 26251, + 26591 => 26976, + 26618 => 25296, + 27608 => 27607, + 31045 => 31046, + 31190 => 31047, + 32008 => 32424, + 33530 => 33683, + 37332 => 38023, + 20936 => 20928, + 21764 => 21591, + 24371 => 24362, + 25360 => 25343, + 25404 => 25386, + 26050 => 26071, + 27436 => 21683, + 30143 => 30193, + 32029 => 32436, + 32024 => 32430, + 32019 => 32446, + 34456 => 34516, + 36859 => 31227, + 37087 => 37071, + 37092 => 21364, + 37333 => 38028, + 38492 => 38485, + 39139 => 39268, + 20586 => 36924, + 21102 => 21072, + 21293 => 21286, + 22279 => 22261, + 22492 => 37326, + 22515 => 22350, + 22497 => 22445, + 22512 => 37319, + 23149 => 23045, + 23148 => 28139, + 23488 => 37319, + 23821 => 23811, + 25533 => 30896, + 26734 => 26479, + 28137 => 20940, + 28150 => 28062, + 28133 => 28172, + 28123 => 27993, + 28106 => 28153, + 28916 => 28867, + 30160 => 34516, + 30501 => 30502, + 30758 => 23528, + 32053 => 32443, + 32058 => 32448, + 32063 => 32464, + 33051 => 33003, + 33651 => 35910, + 33685 => 33607, + 34898 => 28843, + 35285 => 31895, + 37206 => 40489, + 37356 => 38030, + 37348 => 38032, + 37369 => 38037, + 37367 => 38029, + 38278 => 38414, + 38280 => 38380, + 39141 => 39270, + 21412 => 21382, + 21926 => 23721, + 23215 => 22955, + 23505 => 23522, + 23890 => 23721, + 24818 => 24701, + 24824 => 33557, + 25564 => 25513, + 26235 => 26263, + 26895 => 26720, + 26838 => 26536, + 26903 => 30855, + 27581 => 28102, + 28296 => 27817, + 28254 => 27976, + 28194 => 27816, + 28960 => 28140, + 29259 => 31546, + 29999 => 23425, + 30060 => 30066, + 30820 => 30806, + 30812 => 30785, + 30824 => 30743, + 31547 => 31559, + 32079 => 32449, + 32078 => 32471, + 32574 => 29942, + 32674 => 32466, + 34901 => 21516, + 35008 => 33589, + 35224 => 35271, + 35406 => 35765, + 35416 => 35790, + 35410 => 35794, + 36026 => 36150, + 36016 => 36147, + 36309 => 36398, + 36602 => 36730, + 36601 => 36725, + 36587 => 36728, + 37126 => 37075, + 37377 => 38059, + 37379 => 38040, + 37414 => 38043, + 37376 => 38063, + 37380 => 38061, + 37415 => 38058, + 38284 => 38390, + 38537 => 38503, + 38640 => 27675, + 38919 => 39032, + 39147 => 39275, + 20682 => 20185, + 20660 => 20251, + 20674 => 20603, + 20681 => 20325, + 21962 => 21789, + 21993 => 21794, + 22628 => 22489, + 22607 => 22450, + 22780 => 22776, + 23243 => 34949, + 23231 => 24871, + 23510 => 28024, + 23512 => 32622, + 23583 => 40092, + 24048 => 24047, + 24823 => 34850, + 25609 => 27063, + 25636 => 25212, + 25667 => 25179, + 25640 => 25299, + 25647 => 25487, + 25664 => 25410, + 25637 => 25462, + 25639 => 25159, + 28339 => 28066, + 28999 => 36745, + 29010 => 28828, + 29026 => 33557, + 29499 => 29426, + 29771 => 29614, + 30560 => 30519, + 31590 => 31649, + 31604 => 16882, + 31600 => 31534, + 32136 => 32488, + 32134 => 32480, + 32131 => 32481, + 32677 => 32671, + 32801 => 38148, + 33121 => 33078, + 33309 => 36758, + 34033 => 33805, + 33842 => 33841, + 33861 => 33785, + 33874 => 33645, + 33903 => 33647, + 33888 => 21442, + 34571 => 34690, + 34554 => 34545, + 35462 => 35795, + 35455 => 35798, + 35425 => 35817, + 35460 => 35796, + 35445 => 35804, + 36322 => 36346, + 36613 => 36738, + 36615 => 36737, + 36616 => 36736, + 37142 => 37095, + 37140 => 37036, + 37448 => 38090, + 37424 => 38088, + 37434 => 38064, + 37478 => 38066, + 37427 => 38070, + 37470 => 38074, + 37507 => 38131, + 37422 => 38092, + 37446 => 38075, + 37485 => 38077, + 37484 => 38076, + 38927 => 39043, + 38926 => 39040, + 40167 => 20971, + 40701 => 40702, + 20712 => 20606, + 22044 => 21787, + 22652 => 30742, + 23937 => 23901, + 24152 => 24123, + 24153 => 24149, + 24277 => 33643, + 24872 => 24747, + 24947 => 24749, + 24948 => 24913, + 24938 => 24580, + 25129 => 25132, + 25127 => 25111, + 25718 => 25247, + 25715 => 25248, + 25692 => 25532, + 26272 => 30355, + 26402 => 26395, + 27071 => 26724, + 27050 => 26473, + 27550 => 27538, + 28366 => 33637, + 28408 => 27986, + 28411 => 27984, + 28442 => 27812, + 28426 => 28295, + 29079 => 28829, + 29507 => 21574, + 29810 => 29617, + 30392 => 30386, + 30893 => 30720, + 31125 => 31054, + 31630 => 31722, + 21124 => 26413, + 32163 => 32507, + 32196 => 32498, + 32203 => 32495, + 32185 => 32506, + 33155 => 33149, + 33940 => 33715, + 33960 => 33564, + 34600 => 34678, + 34618 => 38675, + 35233 => 35275, + 35474 => 35830, + 35478 => 24726, + 36053 => 36167, + 37541 => 38129, + 37494 => 38095, + 37531 => 38118, + 37498 => 38098, + 37536 => 38097, + 37546 => 38101, + 37517 => 38106, + 37542 => 38111, + 37530 => 38123, + 37547 => 38127, + 37503 => 38122, + 37539 => 38135, + 37614 => 38102, + 38784 => 40727 + ); +$GLOBALS['Text_zhDetect']['exc'] = array( + 23588, + 21514, + 27867, + 27762, + 27745, + 27867, + 24067, + 20223, + 27785, + 23427, + 36836, + 20315, + 25340, + 21319, + 31995, + 23616, + 20811, + 25296, + 27844, + 26479, + 21482, + 31563, + 20223, + 24184, + 28846, + 31192, + 20305, + 21482, + 25176, + 22238, + 21319, + 21482, + 21681, + 24565, + 21846, + 26118, + 23913, + 38613, + 21367, + 25384, + 33293, + 26417, + 24358, + 25166, + 21767, + 20462, + 27427, + 25187, + 23478, + 25928, + 21507, + 22797, + 32972, + 37240, + 22256, + 32470, + 24245, + 27880, + 22564, + 25134, + 21119, + 24439, + 26647, + 27048, + 26104, + 26262, + 40635, + 26865, + 31104, + 25414, + 30522, + 21032, + 24040, + 31461, + 27575, + 25240, + 24840, + 24425, + 21488, + 24109, + 25628, + 21046, + 24535, + 29432, + 25405, + 21512, + 21488, + 23898, + 25114, + 27442, + 25467, + 26753, + 35895, + 33268, + 21340, + 33777, + 22797, + 34615, + 28938, + 20463, + 21038, + 20102, + 28096, + 28394, + 28976, + 34001, + 34920, + 38172, + 27838, + 21700, + 40496, + 23731, + 33945, + 27994, + 20102, + 31601, + 27169, + 35137, + 28436, + 23004, + 28330, + 21097, + 31958, + 38038, + 26495, + 21521, + 26873, + 26812, + 21488, + 27784, + 29071, + 24840, + 31230, + 32763, + 20511, + 36394, + 21400, + 38229, + 28316, + 31179, + 26494, + 20908, + 21693, + 30196, + 33945, + 31995, + 34223, + 22075, + 37222, + 32993, + 23064, + 30151, + 22122, + 36342, + 21688, + 38754, + 20986, + 13417, + 34276, + 21872, + 23721, + 25165, + 33244, + 21315, + 21516, + 27595, + 20164, + 25421, + 21449, + 28192, + 24671, + 32771, + 30338, + 33011, + 21380, + 22336, + 19992, + 24653, + 22829, + 28335, + 27667, + 33503, + 25343, + 26251, + 26976, + 25296, + 27607, + 31046, + 31047, + 33683, + 25343, + 25386, + 26071, + 21683, + 30193, + 32436, + 32430, + 34516, + 31227, + 39268, + 36924, + 37326, + 22350, + 28139, + 30896, + 26479, + 20940, + 27993, + 28153, + 34516, + 23528, + 32443, + 35910, + 33607, + 28843, + 31895, + 38380, + 39270, + 23721, + 23522, + 23721, + 25513, + 26263, + 30855, + 28102, + 27816, + 28140, + 30785, + 31559, + 29942, + 21516, + 33589, + 36398, + 38040, + 27675, + 20185, + 21789, + 22776, + 24871, + 28024, + 32622, + 34850, + 27063, + 25212, + 25179, + 25299, + 25487, + 25410, + 25462, + 25159, + 28066, + 30519, + 31649, + 16882, + 31534, + 33805, + 33841, + 33785, + 34690, + 36346, + 36736, + 24149, + 30355, + 26395, + 27984, + 28295, + 21574, + 29617, + 31054, + 31722, + 26413, + 33564, + 34678, + 38675, + 24726, + 38095, + 38118, + 38106 + ); +class Text_zhDetect +{ + + function guess($str, $def = 'T') + { + $_t2smap = $GLOBALS['Text_zhDetect']['t2smap']; + if (empty($GLOBALS['Text_zhDetect']['s2tmap'])) { + $this->buildS2Tmap(); + } + $_s2tmap = $GLOBALS['Text_zhDetect']['s2tmap']; + + + for($i=0;$iuniord($tc); + if (!isset($_s2tmap[$tc_n]) && !isset($_t2smap[$tc_n])) { + // not in either.. + continue; + } + if (isset($_s2tmap[$tc_n]) && isset($_t2smap[$tc_n])) { + // in both.. + continue; + } + if (!isset($_s2tmap[$tc_n]) && isset($_t2smap[$tc_n])) { + return 'T'; + } + if (isset($_s2tmap[$tc_n]) && !isset($_t2smap[$tc_n])) { + return 'S'; + } + // should not get here.. + } + return $def; + } + function buildS2Tmap() + { + $GLOBALS['Text_zhDetect']['s2tmap']=array_combine( + array_values($GLOBALS['Text_zhDetect']['t2smap']),array_keys($GLOBALS['Text_zhDetect']['t2smap']) + ); + foreach($GLOBALS['Text_zhDetect']['exc'] as $code) { + unset( $GLOBALS['Text_zhDetect']['s2tmap'][$code]); + } + } + + + function uniord($c) { + $h = ord($c[0]); + if ($h <= 0x7F) { + return $h; + } else if ($h < 0xC2) { + return false; + } else if ($h <= 0xDF) { + return ($h & 0x1F) << 6 | (ord($c[1]) & 0x3F); + } else if ($h <= 0xEF && strlen($c) > 2) { + return ($h & 0x0F) << 12 | (ord($c[1]) & 0x3F) << 6 + | (ord($c[2]) & 0x3F); + } else if ($h <= 0xF4 && strlen($c) > 3) { + return ($h & 0x0F) << 18 | (ord($c[1]) & 0x3F) << 12 + | (ord($c[2]) & 0x3F) << 6 + | (ord($c[3]) & 0x3F); + } else { + return false; + } + } + + + function unichr($c) { + if ($c <= 0x7F) { + return chr($c); + } else if ($c <= 0x7FF) { + return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F); + } else if ($c <= 0xFFFF) { + return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F) + . chr(0x80 | $c & 0x3F); + } else if ($c <= 0x10FFFF) { + return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F) + . chr(0x80 | $c >> 6 & 0x3F) + . chr(0x80 | $c & 0x3F); + } else { + return false; + } + } +} diff --git a/XML/Parser.php b/XML/Parser.php index 6648371b..4f6e4771 100644 --- a/XML/Parser.php +++ b/XML/Parser.php @@ -194,23 +194,7 @@ class XML_Parser extends PEAR // }}} // {{{ php4 constructor - /** - * Creates an XML parser. - * - * This is needed for PHP4 compatibility, it will - * call the constructor, when a new instance is created. - * - * @param string $srcenc source charset encoding, use NULL (default) to use - * whatever the document specifies - * @param string $mode how this parser object should work, "event" for - * startelement/endelement-type events, "func" - * to have it call functions named after elements - * @param string $tgtenc a valid target encoding - */ - function XML_Parser($srcenc = null, $mode = 'event', $tgtenc = null) - { - XML_Parser::__construct($srcenc, $mode, $tgtenc); - } + // }}} // {{{ php5 constructor @@ -293,7 +277,7 @@ class XML_Parser extends PEAR */ function _initHandlers() { - if (!is_resource($this->parser)) { + if (!is_object($this->parser)) { return false; } @@ -509,11 +493,12 @@ class XML_Parser extends PEAR return $result; } // if $this->fp was fopened previously + if (is_resource($this->fp)) { while ($data = fread($this->fp, 4096)) { if (!$this->_parseString($data, feof($this->fp))) { - $error = &$this->raiseError(); + $error = $this->raiseError(); $this->free(); return $error; } @@ -589,8 +574,8 @@ class XML_Parser extends PEAR **/ function free() { - if (isset($this->parser) && is_resource($this->parser)) { - xml_parser_free($this->parser); + if (isset($this->parser) && is_object($this->parser)) { + //xml_parser_free($this->parser); unset( $this->parser ); } if (isset($this->fp) && is_resource($this->fp)) { @@ -677,7 +662,7 @@ class XML_Parser extends PEAR * @return null * @abstract */ - function startHandler($xp, $elem, &$attribs) + function startHandler($xp, $elem, $attribs) { return null; } @@ -694,7 +679,7 @@ class XML_Parser extends PEAR * @return null * @abstract */ - function endHandler($xp, $elem) + function endHandler( $elem) { return null; } diff --git a/XML/SvgToPdf.php b/XML/SvgToPdf.php index 58700aa5..c3b44b9c 100644 --- a/XML/SvgToPdf.php +++ b/XML/SvgToPdf.php @@ -41,9 +41,6 @@ */ -require_once 'XML/Tree/Morph.php'; -require_once 'Fpdf/tFPDF.php'; -require_once 'XML/SvgToPdf/Base.php'; // current options for generated file.. @@ -81,32 +78,33 @@ class XML_SvgToPDF { $t = new XML_SvgToPDF; $t->language = $data['language']; - /* + require_once 'XML/Tree/Morph.php'; + $x = new XML_Tree_Morph( $svg, array( 'debug' => 0, 'filter' => array( - 'svg' => array(&$t, 'buildObject'), - 'image' => array(&$t, 'buildObject'), - 'text' => array(&$t, 'buildObject'), - 'tspan' => array(&$t, 'buildObject'), - 'rect' => array(&$t, 'buildObject'), - 'g' => array(&$t, 'buildObject'), - 'path' => array(&$t, 'buildObject'), - 'sodipodi:namedview' => array(&$t, 'buildNull'), - 'defs' => array(&$t, 'buildNull'), + 'svg' => array($t, 'buildObject'), + 'image' => array($t, 'buildObject'), + 'text' => array($t, 'buildObject'), + 'tspan' => array($t, 'buildObject'), + 'rect' => array($t, 'buildObject'), + 'g' => array($t, 'buildObject'), + 'path' => array($t, 'buildObject'), + 'sodipodi:namedview' => array($t, 'buildNull'), + 'defs' => array($t, 'buildNull'), ) ) ); $tree = $x->getTreeFromFile(); - + //echo '
'; print_R($tree);      exit;
         $tree = $t->buildobject($tree);
-        */
+       //   echo '
'; print_R($tree);      exit;
          //echo "
";
-        $tree = $t->parseSvg($svg);
-        //echo "
";print_r($tree);exit;
+       // $tree = $t->parseSvg($svg);
+        // echo "
";print_r($tree);exit;
         
         
         
@@ -121,34 +119,20 @@ class XML_SvgToPDF {
 
         if ($data['language'] == 'big5') {
           //die("trying chinese");
-            require_once  'Fpdf/tFPDF.php' ;
-
-            $pdf = new tFPDF($orientation ,'mm','A4');
-            
-            // we originally used ARIALUNI.ttf'
-            
-            $font = '/usr/share/fonts/truetype/msttcorefonts/Arial.ttf';
-            
-            if (!file_exists('/usr/share/fonts/truetype/msttcorefonts/Arial.ttf')) {
-                die("install msttcorefonts package");
-            }
             
-            //$pdf->AddFont('ARIALUNI','',$font,true);
-            
-            $pdf->AddFont('ARIALUNI','','/usr/share/fonts/truetype/msttcorefonts/Arial.ttf',true);
-            $pdf->AddFont('ARIALUNI','B','/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf',true);
-            
-//            $pdf->SetFont('ARIALUNI','',14);
-//            require_once 'Fpdf/Chinese-unicode.php';
-//
-//            $pdf=new PDF_Unicode($orientation ,'mm','A4');
-////            $pdf->AddGBFont();
-////            $pdf->AddBig5Font();
-//            $pdf->AddUniCNSFont('Uni');
-            //$pdf->AddUniCNSFont('Uni'); 
-            //AddUniCNShwFont
+               
+            require_once 'Fpdf/Unicode.php';
+
+            $pdf=new FPDF_Unicode($orientation ,'mm','A4');
+            $pdf->AddGBFont();
+            $pdf->AddBig5Font();
+            $pdf->AddUniCNShwFont(); 
             $pdf->open();            
+
+         
         } else {
+            require_once  'Fpdf/tFPDF.php' ;
+
             $pdf=new tFPDF($orientation ,'mm','A4');
             $pdf->open();
         }
@@ -216,11 +200,12 @@ class XML_SvgToPDF {
             $page++;
                 
             $t->debug("PAGE $page");
-         
             
             $pdf->addPage();
+
             $tree->writePDF($pdf,$page_data);
-            
+                
+      
             //$tree->writePDF($pdf,$data);
         }
        
@@ -228,7 +213,7 @@ class XML_SvgToPDF {
         return $pdf;
     }
     
-    function fetchRows(&$original_data, $key, $rows) {
+    static function fetchRows(&$original_data, $key, $rows) {
         $ret = array();
         while ($rows > -1 && !empty($original_data[$key])) {
             $addrow = array_shift($original_data[$key]);
@@ -256,7 +241,7 @@ class XML_SvgToPDF {
         return $this->parseNode($d->documentElement);
     }
     
-    function parseNode($n)
+    function parseXMLNode($n)
     {
         // do children first..
         //print_r(array("PARSENODE:",$n));
@@ -285,6 +270,7 @@ class XML_SvgToPDF {
             return $children;
             
         }
+        // fixme.. this is the Dom Version..
         $ret = $this->buildObject($n,$children);
         
         return $ret;
@@ -298,33 +284,12 @@ class XML_SvgToPDF {
     function buildNull($node) {
         return;
     }
-    function buildObject($node, $children) {
-        $class = 'XML_SvgToPDF_'.$node->tagName;
-        /*
-        if (strlen(trim($node->content)) && (@$this->language)) {
-            $node->language = $this->language;
-        }
-        */
- 
-
-        //echo "look for $class?";
-        if (!class_exists($class)) {
-            // try loading it..
-            $file = dirname(__FILE__) . '/SvgToPdf/'.ucfirst(strtolower($node->tagName)). '.php';
-            $this->debug("loading  $file");
-            if (file_exists($file)) {
-                require_once 'XML/SvgToPdf/'.ucfirst(strtolower($node->tagName)) . '.php';
-            }
-        }
-        // now if it doesnt exist..
-        if (!class_exists($class)) {
-            $this->debug("can not find $class");
-           $class = 'XML_SvgToPDF_Base';
-        }
-        $r = new $class;
-        $r->children = $children;
-        $r->fromXmlNode($node);
-        return $r;
+    function buildObject($node )
+    {
+        require_once 'XML/SvgToPdf/Base.php';
+        
+        return XML_SvgToPDF_Base::factory($node);
+         
     }
     
     
diff --git a/XML/SvgToPdf/Base.php b/XML/SvgToPdf/Base.php
index 7d86bf65..05ebfcbe 100644
--- a/XML/SvgToPdf/Base.php
+++ b/XML/SvgToPdf/Base.php
@@ -35,24 +35,101 @@ class XML_SvgToPDF_Base {
     var $version;
     var $docname;
     var $docbase;
+    var $sodipodirole;
+    var $sodipodilinespacing;
+    var $sodipodinonprintable;
+    var $sodipodinodetypes;
+    var $sodipodiversion;
+    var $sodipodidocname;
+    var $sodipodidocbase;
+    var $sodipodi;
+    var $xmlnssodipodi;
+    var $xmlns;
+    var $xmlnsxlink;
+    var $xmlnsinkscape;
+    var $inkscape;     
+    var $inkscapeversion;
+    var $xmlnsrdf;
+    var $xmlnscc;
+    var $xmlnsdc;
     
+    var $xlink;
+    var $rdf;
+    var $cc;
+    var $dc;
+    var $d;
+    var $content = '';
+    var $role;
+    var $linespacing;
+    var $attributes;
+    var $nonprintable;
+    var $about;
+    var $resource;
+    
+    
+    var $name;
+    
+    static function factory($node)
+    {
+        if (is_a($node, 'XML_SvgToPDF_Base')) {
+            return $node;
+        }
+        
+        $class = 'XML_SvgToPDF_'.$node->name;
+        /*
+        if (strlen(trim($node->content)) && (@$this->language)) {
+            $node->language = $this->language;
+        }
+        */
+ 
 
-    function fromXmlNode($node)
+        //echo "look for $class?";
+        if (!class_exists($class)) {
+            // try loading it..
+            $file = dirname(__FILE__) .'/'.ucfirst(strtolower($node->name)). '.php';
+           
+            if (file_exists($file)) {
+                require_once 'XML/SvgToPdf/'.ucfirst(strtolower($node->name)) . '.php';
+            }
+        }
+        // now if it doesnt exist..
+        if (!class_exists($class)) {
+            
+           $class = 'XML_SvgToPDF_Base';
+        }
+        $r = new $class;
+        $r->fromNode($node);
+        return $r;
+    }
+    
+    function factoryChildren($ar) {
+        foreach($ar as $c) {
+            if (!empty($c)) {
+                $this->children[] = $this->factory($c);
+            }
+        }
+    }
+    
+    
+    function fromXmlNode(DomElement $node)
     {
         // extract attributes
         foreach($node->attributes as $k=>$v) {
             if (in_array($k, array('style'))) {
                 continue;
             }
+            $k = preg_replace('/[^a-z]+/', '', $k);
             
-            $this->$k = $v->value;
-            if (preg_match('/[0-9]+mm$/',$v->value)) {
-                $vv = str_replace('mm','',$v->value);
+            $v = is_object($v) ? $v->value : $v;
+            if (preg_match('/[0-9]+mm$/',$v)) {
+                $vv = str_replace('mm','',$v);
                 $vv = $vv * 3.543307;
                 
                 $this->$k = $vv;
                 continue;
             }
+            
+            $this->$k = $v;
         }
         // deal with style..
         if ($node->hasAttribute('style') && strlen($node->getAttribute('style'))) {
@@ -62,10 +139,7 @@ class XML_SvgToPDF_Base {
                 if (!strlen(trim($ss))) {
                     continue;
                 }
-                if (strpos($ss,':') === false) {
-                    $style[$ss] = true;
-                    continue;
-                }
+               
                 $sss = explode(':',$ss);
                 if (preg_match('/[0-9]+pt$/',$sss[1])) {
                     $sss[1] =  str_replace('pt','',$sss[1]);
@@ -74,8 +148,16 @@ class XML_SvgToPDF_Base {
             }
             $this->style = $style;
         }
-      
+        $this->name = $node->tagName;
+        
+        //?? needed?
+        if ($node->children) {
+            $this->factoryChildren($node->children);
+        }
+        
         $this->transform();
+        
+        
         // if node is a tspan  
        
          
@@ -88,7 +170,7 @@ class XML_SvgToPDF_Base {
         if ($node->attributes) {
             foreach($node->attributes as $k=>$v) {
                 
-                echo $node->name . ":" . $k . "=>". $v. "
"; + //echo $node->name . ":" . $k . "=>". $v. "
"; if (strpos($k,':')) { $kk = explode(':',$k); @@ -106,7 +188,8 @@ class XML_SvgToPDF_Base { } } - if (isset($this->style)) { + if (isset($this->style) && is_string($this->style)) { + $s = explode(';',$this->style); foreach($s as $ss) { if (!strlen(trim($ss))) { @@ -125,17 +208,19 @@ class XML_SvgToPDF_Base { $this->style = $style; } + $this->name = $node->name; if ($node->content) { $this->content = trim($node->content); - echo $node->name . ":CONTENT=>". $node->content. "
"; + //echo $node->name . ":CONTENT=>". $node->content. "
"; } + if ($node->children) { - $this->children = $node->children; + $this->factoryChildren($node->children); } - echo "
BEFORE:";print_r($this->toArray());
+       // echo "
BEFORE:";print_r($this->toArray());
         $this->transform();
-        echo "
AFTER:";print_r($this->toArray());
+        //echo "
AFTER:";print_r($this->toArray());
     }
 
 
@@ -242,7 +327,7 @@ class XML_SvgToPDF_Base {
         $this->childrenWritePDF($pdf,$data);
     }
     
-    function childrenWritePDF(&$pdf,&$data) {
+    function childrenWritePDF($pdf,&$data) {
         if (!@$this->children) {
             return;
         }
@@ -251,7 +336,8 @@ class XML_SvgToPDF_Base {
                 continue;
             }
             if (!method_exists($this->children[$k],'writePDF')) {
-                echo "OOPS unknown object? 
" ; print_r($this->children[$k]); exit;
+                echo '
'; print_r(array($this, $k));  
+                trigger_error( "OOPS unknown object?" ); 
             }
             $this->children[$k]->writePDF($pdf,$data);
         }
@@ -356,4 +442,6 @@ class XML_SvgToPDF_Base {
     }
     
     
+    
+    
 }
diff --git a/XML/SvgToPdf/G.php b/XML/SvgToPdf/G.php
index 6886c1d4..303b2c65 100644
--- a/XML/SvgToPdf/G.php
+++ b/XML/SvgToPdf/G.php
@@ -10,7 +10,9 @@ class XML_SvgToPDF_G     extends XML_SvgToPDF_Base
 { 
     var $boundingbox = false; // for repeats...
     var $settings = array();  // cols/rows..
-
+    var $dynamic;
+    var $rows;
+    var $cols;
     function fromXmlNode($node)
     {
        // print_r("G:fromXmlNode");
@@ -65,7 +67,7 @@ class XML_SvgToPDF_G     extends XML_SvgToPDF_Base
     function fromNode($node) {
         parent::fromNode($node);
         
-    
+       // print_R($this);
 //----------- applyDynamic...        
         
           // look for 
diff --git a/XML/SvgToPdf/Path.php b/XML/SvgToPdf/Path.php
index af5c77a4..0f3cf0e4 100644
--- a/XML/SvgToPdf/Path.php
+++ b/XML/SvgToPdf/Path.php
@@ -11,6 +11,16 @@ class XML_SvgToPDF_Path  extends XML_SvgToPDF_Base {
     
     function fromXmlNode($node) {
         parent::fromXmlNode($node);
+        $this->parse();
+    }
+    function fromNode($node) {
+        parent::fromNode($node);
+       // var_dump($node);
+       // var_dump($this);
+        $this->parse();
+    }
+    function parse()
+    {
         $d = explode(' ',trim($this->d));
         $i=0;
         $data = array();
@@ -107,7 +117,9 @@ class XML_SvgToPDF_Path  extends XML_SvgToPDF_Base {
             return;
         }
         */
-        
+        if (!is_array($this->d)) {
+            print_R($this);exit;
+        }
 
         foreach($this->d as $a) {
             switch($a[0]) {
diff --git a/XML/SvgToPdf/Rect.php b/XML/SvgToPdf/Rect.php
index e7ce2295..0a06f0ed 100644
--- a/XML/SvgToPdf/Rect.php
+++ b/XML/SvgToPdf/Rect.php
@@ -9,6 +9,7 @@ class XML_SvgToPDF_Rect  extends XML_SvgToPDF_Base {
     var $xx = 0;
     var $yy = 0;
     var $nonprintable = false;
+    var $maxWidth;
     
     function writePDF($pdf,$data) {
         
diff --git a/XML/SvgToPdf/Text.php b/XML/SvgToPdf/Text.php
index 0131c240..d107f657 100644
--- a/XML/SvgToPdf/Text.php
+++ b/XML/SvgToPdf/Text.php
@@ -4,12 +4,21 @@
 class XML_SvgToPDF_Text  extends XML_SvgToPDF_Base { 
 
 	var $linespacing;
-	
+	var $xx;
+	var $yy;	
 
     function fromXmlNode($node) {
         
         parent::fromXmlNode($node);
+		$this->parse();
+	}
+	function fromNode($node) {
         
+        parent::fromNode($node);
+		$this->parse();
+	}
+	function parse()
+	{
         // any text ???
         if (empty($this->children) || empty($this->children[0]->content)) {
             return;
@@ -56,8 +65,10 @@ class XML_SvgToPDF_Text  extends XML_SvgToPDF_Base {
         }
         $ffont = $font;
         if (preg_match('/big5/i',$this->style['font-family'])) {
-            $ffont = 'ARIALUNI';
-            $font = 'arial'; // default if not big4
+            $font = 'Big5';
+
+			//$ffont = 'ARIALUNI';
+           // $font = 'arial'; // default if not bigg
         }
             
         
@@ -121,13 +132,16 @@ class XML_SvgToPDF_Text  extends XML_SvgToPDF_Base {
         
             $xx = $c->x !== false ? $c->x + @$this->xx : $x;
             $yy = $c->y !== false ? $c->y + @$this->yy : $y + ($lineno * $size * 1.3);
-            $lineno++;              
+            $lineno++;
+			if (empty($c->content)) {
+				//print_R($c);exit;
+			}
             $val = $c->content;
-            if ($ffont == 'ARIALUNI') { //) && preg_match('/[\x7f-\xff]+/',$val)) {
-                $pdf->setFont('ARIALUNI' ,
-                            $weight,
-                            $size);
-            }
+            //if ($ffont == 'ARIALUNI') { //) && preg_match('/[\x7f-\xff]+/',$val)) {
+             //   $pdf->setFont('ARIALUNI' ,
+             //               $weight,
+             //               $size);
+            //}
             if (isset($c->args)) {
                 
                 $args = array();
@@ -148,24 +162,25 @@ class XML_SvgToPDF_Text  extends XML_SvgToPDF_Base {
                 
                 $has_template = preg_match('/%s/', $val);
                      
-                $val = trim(vsprintf($val,$args));
+                $val = empty($val) || empty($args) ? $val : trim(vsprintf($val,$args));
                 
-                if ($has_template && ($ffont == 'ARIALUNI') && preg_match('/[\x7f-\xff]+/',$val)) {
-                    //require_once  'Text/ZhDetect.php';
-                    //$detect = new Text_zhDetect;
-                    //$type = $detect->guess($val);
-                    //if ($v == 'S') {
-                       
-                    //    $val = @iconv('utf8', 'GB2312//IGNORE', $val);
-                    //    $pdf->setFont('GB' ,
-                    //        $weight,
-                    //        $size);
-                    //} else {
-//                        $val = @iconv('utf8', 'BIG5//IGNORE', $val);
-                        $pdf->setFont('ARIALUNI' ,
+                //if ($has_template && ($ffont == 'ARIALUNI') && preg_match('/[\x7f-\xff]+/',$val)) {
+				if ($has_template && ($font == 'Big5') && preg_match('/[\x7f-\xff]+/',$val)) {
+                    require_once  'Text/ZhDetect.php';
+                    $detect = new Text_zhDetect;
+                    $type = $detect->guess($val);
+                    if ($v == 'S') {
+                     
+                        $val = @iconv('utf8', 'GB2312//IGNORE', $val);
+                        $pdf->setFont('GB' ,
+                            $weight,
+                            $size);
+                    } else {
+                        $val = @iconv('utf8', 'BIG5//IGNORE', $val);
+                        $pdf->setFont('Big5' ,
                             $weight,
                             $size);
-                   //}
+                   }
                 }  else {
                     $val = @iconv('utf8','ascii//ignore',$val);
                 }
diff --git a/XML/SvgToPdf/Tspan.php b/XML/SvgToPdf/Tspan.php
index 2f081aaa..5d364e4c 100644
--- a/XML/SvgToPdf/Tspan.php
+++ b/XML/SvgToPdf/Tspan.php
@@ -13,11 +13,26 @@ class XML_SvgToPDF_Tspan extends XML_SvgToPDF_Base {
     var $args = array(); // arguments..
     var $role;
     
-    function fromXmlNode($node) {
+    function fromXmlNode($node)
+    {
         parent::fromXmlNode($node);
+        $this->content = $node->textContent;
+
+        $this->parse();
+    }
+    
+    function fromNode($node)
+    {
+        parent::fromNode($node);
+        
+        $this->content = $node->content;
+
+        $this->parse();
+    }    
+    function parse()
+    {
         $this->x = false;
         $this->y = false;
-        $this->content = $node->textContent;
         /*
         if (isset($this->x)) {
                unset($this->x); 
@@ -31,7 +46,7 @@ class XML_SvgToPDF_Tspan extends XML_SvgToPDF_Base {
             $trans = array_flip(get_html_translation_table(HTML_ENTITIES));
         }
         
-        if (strlen($this->content)) {
+        if (!empty($this->content) && strlen($this->content)) {
             // convert & etc. 
             if (strpos($this->content,'&') !== false) {
                 $this->content = strtr($this->content, $trans);
diff --git a/XML/SvgToPdfAlt.php b/XML/SvgToPdfAlt.php
new file mode 100644
index 00000000..f71ece23
--- /dev/null
+++ b/XML/SvgToPdfAlt.php
@@ -0,0 +1,204 @@
+ array(
+                array(
+                    'name' => = "Xxxxxxxx xxxxxxxxxxxx xxxxxxxxxx xxxxxxx Xxxxxxxx xxxxxxxxxxxx xxxxxxxxxx xxxxxxx";
+                ),
+                array(
+                    'name' => = "Xxxxxxxx xxxxxxxxxxxx xxxxxxxxxx xxxxxxx Xxxxxxxx xxxxxxxxxxxx xxxxxxxxxx xxxxxxx";
+                ),
+                array(
+                    'name' => = "Xxxxxxxx xxxxxxxxxxxx xxxxxxxxxx xxxxxxx Xxxxxxxx xxxxxxxxxxxx xxxxxxxxxx xxxxxxx";
+                ),
+        );
+        $pdf = XML_SvgToPDF::construct(dirname(__FILE__).'/test.svg',$data);
+        
+        $pdf->output();
+        
+        
+        
+        expects an svg file (probably made by sodipodi)
+        a block is the group, 
+        a) it has a text component with
+            dynamic=address
+            rows=7
+            cols=3
+        b) a non-printable rectangle (which is the bounding box)
+        c) some text {xxxx}{yyyy} which is replaced with 
+            address[0....][xxxx] = 'somevalue;
+            address[0....][yyyy] = 'somevalue;
+        
+        
+        
+        
+*/
+
+require_once 'XML/Tree/Morph.php';
+require_once 'XML/SvgToPdfAlt/Base.php';
+
+// current options for generated file..
+
+$GLOBALS['_XML_SVGTOPDF']['options'] = array(
+    'debug' => 0,
+    );
+ 
+        
+class XML_SvgToPDFAlt {
+
+    var $language;
+    static function debug($s,$e=0) {
+        if (!$GLOBALS['_XML_SVGTOPDF']['options']['debug']) {
+            return;
+        }
+        echo "
".print_R($s,true). "
"; + if ($e) { + exit; + } + } + static function construct($svg, $data=array()) { + + $t = new XML_SvgToPDFAlt; + $t->language = @$data['language']; + if (empty($svg)) { + trigger_error(__CLASS__.':construct called without svg', E_USER_ERROR); + } + + $x = new XML_Tree_Morph( + $svg, + array( + 'debug' => 0, + 'filter' => array( + 'svg' => array($t, 'buildObject'), + 'image' => array($t, 'buildObject'), + 'text' => array($t, 'buildObject'), + 'tspan' => array($t, 'buildObject'), + 'rect' => array($t, 'buildObject'), + 'g' => array($t, 'buildObject'), + 'path' => array($t, 'buildObject'), + 'sodipodi:namedview' => array($t, 'buildNull'), + 'defs' => array($t, 'buildNull'), + 'metadata' => array($t, 'buildNull'), + + ) + ) + ); + + $tree = $x->getTreeFromFile(); + + + //echo '
'.htmlspecialchars(print_r($tree,true));exit;
+        
+        $tree = $t->buildobject($tree);
+ //echo '
'.htmlspecialchars(print_r($tree,true));
+        //echo "
";print_r($tree);exit;
+        $orientation =  ($tree->width > $tree->height) ? 'L' : 'P';
+
+        $GLOBALS['_XML_SVGTOPDF']['options']['file'] = $svg;
+
+        if ($data['language'] == 'big5') {
+           
+            require_once 'FpdfAlt/Chinese.php';
+
+            $pdf=new FpdfAlt_Chinese($orientation ,'mm','A4');
+            $pdf->AddGBFont();
+            $pdf->AddBig5Font();
+            $pdf->AddUniCNShwFont(); 
+            $pdf->open();            
+        } else {
+            require_once 'Fpdf.php'; 
+
+            $pdf=new FPDF($orientation ,'mm','A4');
+            $pdf->open();
+        }
+
+        $pdf->setAutoPageBreak(false);
+        $pdf->AliasNbPages();
+        // convert data to array.
+        if (is_object($data)) {
+            $data = (array) $data;
+        }
+        // assoc. array of key => no of fields per page.
+        $perPage = $tree->calcPerPage();
+        
+        // no dynamic blocks:
+        if (!$perPage || empty($data)) {
+            $pdf->addPage();
+            $tree->writePDF($pdf,$data);
+            $t->debug($tree);
+            return $pdf;
+        }
+        
+        // build blocks of data for each page.
+        $haveData = true;
+        $page = 0;
+        while (true == $haveData ) {
+            $page_data = $data;
+            $haveData = false;
+            foreach($perPage as $k=>$v) {
+                if (!$data[$k]) {
+                    $page_data[$k] = array();
+                    continue;
+                }
+                $haveData = true;
+                $page_data[$k] = array_splice ( $data[$k], 0,$v);
+            }
+            $page++;
+            if (!$haveData) {
+                break;
+            }
+                
+            $t->debug("PAGE $page");
+            $pdf->addPage();
+           // echo '
'.htmlspecialchars(print_r($page_data,true));
+            $tree->writePDF($pdf,$page_data);
+        }
+        
+        $t->debug($tree);
+        return $pdf;
+    }
+    
+    function buildNull($node) {
+        return;
+    }
+    function buildObject($node) {
+        $class = 'XML_SvgToPDFAlt_'.$node->name;
+        
+        if (!empty($node->content) && strlen(trim($node->content)) && (@$this->language)) {
+            $node->language = $this->language;
+ 
+        }
+ 
+
+        //echo "look for $class?";
+        if (!class_exists($class) && !empty($node->name)) {
+            // try loading it..
+            $file = dirname(__FILE__) . '/SvgToPdfAlt/'.ucfirst(strtolower($node->name)). '.php';
+            $this->debug("loading  $file");
+            if (file_exists($file)) {
+                require_once 'XML/SvgToPdfAlt/'.ucfirst(strtolower($node->name)) . '.php';
+            }
+        }
+        // now if it doesnt exist..
+        if (!class_exists($class)) {
+            $this->debug("can not find $class");
+           $class = 'XML_SvgToPDFAlt_Base';
+        }
+        //echo '
';print_r($node);
+        
+        $r = new $class;
+        $r->fromNode($node);
+        return $r;
+    }
+    
+    
+
+
+}
diff --git a/XML/SvgToPdfAlt/Base.php b/XML/SvgToPdfAlt/Base.php
new file mode 100644
index 00000000..56bd61f1
--- /dev/null
+++ b/XML/SvgToPdfAlt/Base.php
@@ -0,0 +1,266 @@
+attributes) {
+            foreach($node->attributes as $k=>$v) {
+                if (strpos($k,':')) {
+                    $kk = explode(':',$k);
+                    $k = $kk[1];
+                }
+                $this->$k = $v;
+                $this->{'_'.$k} = $v;
+                if (preg_match('/[0-9]+mm$/',$v)) {
+                    $v = str_replace('mm','',$v);
+                    $v = $v * 3.543307;
+                
+                    $this->$k = $v;
+                    $this->{'_'.$k} = $v;// save the original..
+                    continue;
+                }
+                
+            }
+        }
+        
+        if (isset($this->style)) {
+            $s = explode(';',$this->style);
+            foreach($s as $ss) {
+                if (!strlen(trim($ss))) {
+                    continue;
+                }
+                if (strpos($ss,':') === false) {
+                    $style[$ss] = true;
+                    continue;
+                }
+                $sss = explode(':',$ss);
+                if (preg_match('/[0-9]+pt$/',$sss[1])) {
+                    $sss[1] =  str_replace('pt','',$sss[1]);
+                }
+                $style[$sss[0]] = $sss[1];
+            }
+            $this->style = $style;
+        }
+                
+        
+        if ($node->content) {
+            $this->content = trim($node->content);
+        }
+        if ($node->children) {
+            $this->children = $node->children;
+        }
+        $this->transform();
+    }
+
+
+    function transform() {
+        if (!@$this->transform) {
+            return;
+        }
+        // deal with transformation..
+        $tr = $this->transform;
+        if (preg_match('/scale\(([0-9e.-]+),([0-9e.-]+)\)/',$tr,$args)) {
+            $xscale = (float)$args[1];
+            $yscale = (float)$args[2];
+            $method = 'scale';
+            } else if (preg_match('/matrix\(([0-9e.-]+),([0-9e.-]+),([0-9e.-]+),([0-9e.-]+),([0-9e.-]+),([0-9e.-]+)\)/',$tr,$args)) {
+            array_shift($args);
+            require_once 'Math/Matrix.php';
+            $matrix =  new Math_Matrix( array(
+                    array((float)$args[0],(float)$args[2],(float)$args[4]),
+                    array((float)$args[1],(float)$args[3],(float)$args[5]),
+                    array(       0,       0, 	1))
+            );
+            $method = 'matrix';
+        } else if (preg_match('/translate\(([0-9e.-]+),([0-9e.-]+)\)/',$tr,$args)) {
+            $x = (float)$args[1];
+            $y =(float) $args[2];
+            $method = 'translate';
+        } else {
+          echo "
no match?";print_r($this); exit;
+            return;
+        }
+        //
+        switch ($method) {
+            case 'scale':
+                $this->x *=  $xscale;
+                $this->y *=  $yscale;
+                if (!@$this->children) {
+                    return;
+                }
+                foreach(array_keys($this->children) as $i) {
+                    if (!isset($this->children[$i]->x)) {
+                        continue;
+                        // echo "
";print_r($this);exit;
+                    }
+                    $this->children[$i]->x *=  $xscale;
+                    $this->children[$i]->y *=  $yscale;
+                }
+                break;
+                    case 'matrix':
+                $v = new Math_Vector(array($this->x,$this->y,0));
+                
+                $r = $matrix->vectorMultiply($v);
+                $r = $r->getData();
+                $this->x = $r[0];
+                $this->y = $r[1];
+                //echo "
";var_dump(	$r);exit;
+                if (!@$this->children) {
+                    return;
+                }
+                foreach(array_keys($this->children) as $i) {
+                    if (!isset($this->children[$i]->x)) {
+                        continue;
+                        // echo "
";print_r($this);exit;
+                    }
+                    $v = new Math_Vector(array($this->children[$i]->x,$this->children[$i]->y,0));
+                    $r =  $matrix->vectorMultiply($v);
+                    $r = $r->getData();
+                    $this->children[$i]->x = $r[0];
+                    $this->children[$i]->y = $r[1];
+     
+                }
+                break; 
+            case 'translate':
+                //echo 'translate' . $x .',' . $y . "\n";
+                if (isset($this->x) &&  isset($this->y)) {
+                         
+                   $this->x +=  $x;
+                   $this->y +=  $y;
+                }
+                if (!@$this->children) {
+                    return;
+                }
+                foreach(array_keys($this->children) as $i) {
+                    if (!isset($this->children[$i]->x) || !isset($this->children[$i]->y)) {
+                        continue;
+                        // echo "
";print_r($this);exit;
+                    }
+                    $this->children[$i]->x +=  $x;
+                    $this->children[$i]->y +=  $y;
+                }
+                break; 
+                 
+          }
+     }
+
+
+
+
+    
+    function writePDF($pdf,$data) {
+        $this->childrenWritePDF($pdf,$data);
+    }
+    
+    function childrenWritePDF(&$pdf,&$data) {
+        if (!@$this->children) {
+            return;
+        }
+        foreach(array_keys($this->children) as $k) {
+            if (!$this->children[$k]) {
+                continue;
+            }
+            if (!method_exists($this->children[$k],'writePDF')) {
+                echo "OOPS unknown object? 
" ; print_r($this->children[$k]); exit;
+            }
+            $this->children[$k]->writePDF($pdf,$data);
+        }
+    }
+    
+    function shiftChildren($x,$y) {
+        if (!@$this->children) {
+            return;
+        }
+        foreach(array_keys($this->children) as $k) {
+            if (!$this->children[$k]) {
+                continue;
+            }
+            $this->children[$k]->shift($x,$y);
+        }
+    }
+    
+    function shift($x,$y) {
+        //XML_SvgToPDF::debug('shift');
+        //XML_SvgToPDF::debug(array($x,$y));
+        //XML_SvgToPDF::debug($this);
+        if (isset($this->x)) {
+            
+            $this->x -= $x;
+        }
+        if (isset($this->y)) {
+            $this->y -= $y;
+        }
+        //XML_SvgToPDF::debug($this);
+        $this->shiftChildren($x,$y);
+    }
+    function calcPerPage() {
+        $ret = array();
+        foreach($this->children as $n) {
+            if (!$n) {
+                continue;
+            }
+            if (!is_a($n, 'XML_SvgToPDF_G')) {
+                continue;
+            }
+            if (!isset($n->settings)) {
+                continue;
+            }
+            
+            $rows  = isset($n->settings['rows']) ? $n->settings['rows'] : 1;
+            $cols  = isset($n->settings['cols']) ? $n->settings['cols'] : 1;
+            
+            
+            $ret[$n->settings['dynamic']] =  $rows * $cols;
+            
+            
+            
+        }
+        return $ret;
+         
+    
+    
+    
+    
+    }
+    
+    function toColor($color) {
+        if (!$color || ($color == 'none')) {
+            return false;
+        }
+        
+        if ($color == 'black') {
+            $color = '#000000';
+        }
+        
+        return array(
+            hexdec(substr($color,1,2)),
+            hexdec(substr($color,3,2)),
+            hexdec(substr($color,5,2)));
+        
+    }
+    
+    
+}
diff --git a/XML/SvgToPdfAlt/G.php b/XML/SvgToPdfAlt/G.php
new file mode 100644
index 00000000..32ed5a14
--- /dev/null
+++ b/XML/SvgToPdfAlt/G.php
@@ -0,0 +1,160 @@
+children) {
+            return;
+        }
+        $settings = array(
+            'rows' => 1,
+            'cols' => 1
+        );
+        
+        $isDynamic = false;
+        foreach(array_keys($this->children) as $k) {
+            if (!is_a($this->children[$k], 'XML_SvgToPDF_Text')) {
+                continue;
+            }
+            
+            if (!isset($this->children[$k]->children[0]->content) || 
+                    (strpos($this->children[$k]->children[0]->content,'=') === false)) {
+                
+                continue;
+            }
+              
+            foreach($this->children[$k]->children as $o) {
+                list($l,$r) = explode('=',$o->content);
+                $settings[$l] = $r;
+            }
+             
+            
+            unset($this->children[$k]);
+            $isDynamic = true;
+            break;
+        }
+      
+        if (!$isDynamic) {
+            return;
+        }
+        
+        
+        
+         //look for the bounding box..
+        $boundingbox = false;
+        foreach(array_keys($this->children) as $k) {
+            if (!is_a($this->children[$k], 'XML_SvgToPDF_Rect')) {
+               continue;
+            }
+            if (@$this->children[$k]->nonprintable == 'true') {
+                $boundingbox = clone($this->children[$k]);
+                $this->children[$k]->style['fill'] = 'none';
+               // unset($this->children[$k]);
+            }
+        }
+        if (!$boundingbox) {
+            return;
+        }
+        
+        $this->boundingbox = $boundingbox;
+        $this->settings = $settings;
+        $this->shiftChildren($this->boundingbox->x,$this->boundingbox->y);
+    }
+    
+    function shift($x,$y) {
+        
+        if ($this->boundingbox) {
+            return;
+        }
+        
+         $this->shiftChildren($x,$y);
+    
+    }
+
+
+
+    function writePDF($pdf,$data) {
+        // g group = does it have a 
+        // look for 
+        if (!@$this->children) {
+            return;
+        }
+         
+        
+        if (empty($this->settings)) {
+            return $this->childrenWritePDF($pdf,$data);
+        }
+        $use = false;
+        if (substr($this->settings['dynamic'],-2,2) == '()') {
+        
+            $use = $data->{substr($this->settings['dynamic'],0,-2)}();
+            
+        } else {
+            $use = @$data[$this->settings['dynamic']];
+        }
+        
+            
+        if ($use === false) {
+            return;
+        }
+        
+        if (!is_array($use) || !$use) {
+            return $this->childrenWritePDF($pdf,$data);
+        }
+        
+        
+        
+        
+        $this->x = $x = $this->boundingbox->x;
+        $this->y =$y = $this->boundingbox->y;
+        $w = $this->boundingbox->width;
+        $h = $this->boundingbox->height; 
+        
+        
+        //echo '
';print_r($this);exit;
+        // shift... ** this does not handle groups!!!
+      
+        //print_R($use);
+        $keys = array_keys($use);
+        $kpos = 0;
+        $kmax = count($keys);
+        //XML_SvgToPDF::debug(array($x,$y,$w,$h));
+        //XML_SvgToPDF::debug($keys);
+        XML_SvgToPDF::debug($this->settings);
+        for($r=0;$r<$this->settings['rows'];$r++) {
+            $yy = $y + ($r*$h);
+            for($c=0;$c<$this->settings['cols'];$c++) {
+                $xx = $x + ($c*$w);
+                XML_SvgToPDF::debug(array($xx,$yy));
+                foreach(array_keys($this->children) as $k) {
+                    if (!$this->children[$k]) {
+                        continue;
+                    }
+                    $this->children[$k]->xx = $xx;
+                    $this->children[$k]->yy = $yy;
+                    $this->children[$k]->maxWidth = $w - 20; 
+                    $this->children[$k]->writePDF($pdf,$use[$keys[$kpos]]);
+                }
+                $kpos++;
+                if ($kpos >= $kmax) {
+                    break 2;
+                }
+            }
+        }
+        
+        
+        
+    }
+
+
+
+
+}
diff --git a/XML/SvgToPdfAlt/Image.php b/XML/SvgToPdfAlt/Image.php
new file mode 100644
index 00000000..d84f91b6
--- /dev/null
+++ b/XML/SvgToPdfAlt/Image.php
@@ -0,0 +1,20 @@
+Image($dir .'/'.basename($this->href), $this->x/ 3.543307, $this->y/ 3.543307, $this->width/ 3.543307,$this->height/ 3.543307);
+     
+    
+    }
+
+ 
+
+
+}
diff --git a/XML/SvgToPdfAlt/Path.php b/XML/SvgToPdfAlt/Path.php
new file mode 100644
index 00000000..09181d83
--- /dev/null
+++ b/XML/SvgToPdfAlt/Path.php
@@ -0,0 +1,146 @@
+d));
+        $i=0;
+        $data = array();
+        
+        while ($i < count($d)) {
+            $action = $d[$i];
+            switch(strtolower($action)) {
+                
+                
+                
+                case 'c': // ????
+                   
+                    $data[] = array('L',$d[$i+3],$d[$i+4]);
+                    $i+=7;
+                    break;
+                case 'm': // move
+                case 'l': // line
+                    $data[] = array($action,$d[$i+1],$d[$i+2]);
+                    $i+=3;
+                    break;
+                case 'h': // move horizontal
+                case 'v': // move horizontal
+                    $data[] = array($action,$d[$i+1]);
+                    $i+=2;
+                    break;
+                
+                
+                case 'z': // close path..
+                    $data[] = array($action);
+                    $i++;
+                    break;
+                default:
+                    echo "oops found something odd in path? '$action'";
+                    echo $this->d;
+                    exit;
+                    break;
+            }
+        }
+        $this->d = $data;
+    }
+            
+            
+        // TODO!! - shift!!!
+            
+        
+        
+        
+        
+     function shift($x,$y) {
+        //XML_SvgToPDF::debug('shift');
+        //XML_SvgToPDF::debug(array($x,$y));
+        //XML_SvgToPDF::debug($this);
+        foreach($this->d as $i=>$a) {
+            if (count($a) < 2) {
+                continue;
+            }
+            if ($a[0] == 'v') {
+                $this->d[$i][1] -= $y;
+            } else {
+                $this->d[$i][1] -= $x;
+                if (isset($this->d[$i][2])) {
+                    $this->d[$i][2] -= $y;
+                }
+            }
+        }
+        
+    }   
+        
+    
+    
+    function writePDF($pdf,$data) {
+        
+        $l = $this->toColor(@$this->style['stroke']);
+        if ($l) {
+            $pdf->setDrawColor($l[0],$l[1],$l[2]);
+        }
+        $pdf->setLineWidth($this->style['stroke-width']/ 3.543307);
+     
+        $c = array();
+        if (count($this->d) > 2) {
+            $cc = array();
+            foreach($this->d as $a) { 
+                 if (count($a) < 2) {
+                        continue;       
+                 }
+                 $x = $a[1] + @$this->xx;
+                 $y = $a[2] + @$this->yy;
+                 $cc[] = $x/ 3.543307;
+                 $cc[] = $y/ 3.543307;
+            }
+            $pdf->line($cc,0,0,0);
+            return;
+        }   
+
+        foreach($this->d as $a) {
+            switch($a[0]) {
+                case 'M':
+                    $x = $a[1] + @$this->xx;
+                    $y = $a[2] + @$this->yy;
+                    $c = array($x,$y);
+                    break;
+                
+                case 'L':
+                    $x = $a[1] + @$this->xx;
+                    $y = $a[2] + @$this->yy;
+                    $pdf->line($c[0]/ 3.543307,$c[1]/ 3.543307,$x/ 3.543307,$y/ 3.543307);
+                    $c = array($x,$y);
+                    break;
+                default:
+                    break;
+            }
+        }
+                
+         
+    
+    
+    }
+     
+        
+    
+
+
+    function toColor($color) {
+        if (!$color || ($color == 'none')) {
+            return false;
+        }
+        return array(
+            hexdec(substr($color,1,2)),
+            hexdec(substr($color,3,2)),
+            hexdec(substr($color,5,2)));
+        
+    }
+
+
+
+}
diff --git a/XML/SvgToPdfAlt/Rect.php b/XML/SvgToPdfAlt/Rect.php
new file mode 100644
index 00000000..b49a626d
--- /dev/null
+++ b/XML/SvgToPdfAlt/Rect.php
@@ -0,0 +1,50 @@
+x   + @$this->xx;
+        $y =  $this->y  + @$this->yy;
+        
+        
+        
+        $pdf->setLineWidth($this->style['stroke-width']); 
+        $f = $this->toColor($this->style['fill']);
+        if ($f) {
+            $pdf->setFillColor($f[0],$f[1],$f[2]);
+        }
+        
+        $l = $this->toColor(@$this->style['stroke']);
+        if ($l) {
+            $pdf->setDrawColor($l[0],$l[1],$l[2]);
+        }
+        // no fill, no line = dont draw...
+        if (!$l && !$f) {
+            return;
+        }
+        XML_SvgToPDFAlt::debug("RECT:" .($x/ 3.543307).',' .($y/ 3.543307). ','
+             .($this->width/ 3.543307).',' . ($this->height/ 3.543307));
+        $pdf->rect($x/ 3.543307,$y/ 3.543307,
+            $this->width/ 3.543307,$this->height/ 3.543307,($l ? 'D' : ''). ($f ? 'F' : ''));
+    
+    
+    
+    }
+
+
+    function toColor($color) {
+        if (!$color || ($color == 'none')) {
+            return false;
+        }
+        return array(
+            hexdec(substr($color,1,2)),
+            hexdec(substr($color,3,2)),
+            hexdec(substr($color,5,2)));
+        
+    }
+
+
+}
\ No newline at end of file
diff --git a/XML/SvgToPdfAlt/Text.php b/XML/SvgToPdfAlt/Text.php
new file mode 100644
index 00000000..e6176468
--- /dev/null
+++ b/XML/SvgToPdfAlt/Text.php
@@ -0,0 +1,343 @@
+children[0]->content)) {
+            return;
+        }
+        if (substr($this->children[0]->content,0,2) == '==') {
+            $this->style['text-anchor'] = 'justify';
+            $this->children[0]->content = substr($this->children[0]->content,2);
+        }
+    }
+      
+    function transform() {
+        parent::transform();
+        if (!@$this->transform) {
+            return; 
+        }
+        if (preg_match('/scale\(([0-9e.-]+),([0-9e.-]+)\)/',$this->transform,$args)) {
+		  $xscale = $args[1];
+		  $yscale = $args[2];
+          $this->style['font-size'] *= $args[1];
+        }
+    }
+    
+        
+        
+
+    function writePDF($pdf,$data) {
+        // set up font.. 
+         
+        $font = strtolower($this->style['font-family']);
+        
+        static $map = array(
+            'times new roman' => 'times',
+            'courier new' => 'courier',
+            'arial' => 'arial',
+        );
+        if (isset($map[$font])) {
+            $font = $map[$font];
+        } else {
+    	    $font = 'times';
+        }
+        if (preg_match('/big5/i',$this->style['font-family'])) {
+            $font = 'Big5';
+        }
+            
+        
+        
+        $weight =  '';
+        if ($this->style['font-weight'] == 'bold') {
+            $weight .=  'B';
+        }
+        if (@$this->style['font-style'] == 'italic') {
+            $weight .=  'I';
+        }
+        
+        if (@$this->style['text-decoration'] == 'underline') {
+            $weight .=  'U';
+        }
+        // size..
+        $size = $this->style['font-size']  * 0.85;
+        
+        $pdf->setFont($font,$weight,$size);
+     
+        switch(@$this->style['text-anchor']) {
+            case 'end':
+                $align = 'E';
+                break;
+            case 'middle':
+                $align = 'M';
+                break;
+            case 'justify':
+                $align = 'J';
+                $max = 0;
+                foreach ($this->children as $child) {
+                    if (!@$child->content) {
+                        continue;
+                    }
+                    $l = $pdf->getStringWidth($child->content);
+                    $max = ($l > $max) ? $l : $max;
+                }
+                // fudge factor!
+                $this->justifyLen = $max;
+                break;
+            default:
+                $align = 'L';
+            
+        }
+        
+        $f = $this->toColor(@$this->style['fill']);
+        if ($f) {
+            $pdf->setTextColor($f[0],$f[1],$f[2]);
+        }
+     
+     
+     
+        $yoffset = 0;
+        $x =  $this->x   + @$this->xx;
+        $y =  $this->y  + @$this->yy;
+        if (!@$this->children) {
+            return;
+        }
+        $lineno = 0;
+        foreach($this->children as $i=>$c) {
+        
+            $xx = isset($c->x) ? $c->x + @$this->xx : $x;
+            $yy = isset($c->y) ? $c->y + @$this->yy : $y + ($lineno * $size * 1.3);
+            $lineno++;              
+            $val = @$c->content;
+            
+            if (isset($c->args)) {
+                
+                $args = array();
+                foreach($c->args as $v) {
+                    if ($v == 'page') {
+                        $args[] = $pdf->PageNo();
+                        continue;
+                    }
+                    if ($v == 'nb') {
+                        $args[] = '{nb}';
+                        continue;
+                    }
+                    $args[] = $this->getValue($data,trim($v));
+                }
+                
+                $has_template = preg_match('/%s/', $val);
+                     
+                $val = vsprintf($val,$args);
+                
+                if ($has_template && ($font == 'Big5')) {
+                    require_once  'Text/ZhDetect.php';
+                    $detect = new Text_zhDetect;
+                    $type = $detect->guess($val);
+                    if ($v == 'S') {
+                       
+                        $val = @iconv('utf8', 'GB2312//IGNORE', $val);
+                        $pdf->setFont('GB' ,
+                            $weight,
+                            $size);
+                    } else {
+                        $val = @iconv('utf8', 'BIG5//IGNORE', $val);
+                        $pdf->setFont('Big5' ,
+                            $weight,
+                            $size);
+                   }
+                }
+                
+                /*
+                
+                
+                if ($has_template  && ($font == 'Big5')) {
+                   
+                    
+                    $val =    @iconv('utf8', 'utf16be//TRANSLIT', $val);
+                    
+                    $pdf->setFont('Uni-hw' ,
+                        $weight,
+                        $size);
+                }
+                */
+            }
+            
+            $talign = $align;
+            if ((!@$this->children[$i+1] ||  !strlen(trim(@$this->children[$i+1]->content))) && ($align == 'J')) {
+                $talign = 'L';
+            }
+            
+            
+            
+            
+            
+            
+            
+            
+            $yoffset += $this->multiLine($pdf,explode("\n",$val),
+                    $xx/ 3.543307,
+                    ($yy / 3.543307) + $yoffset,
+                    ($size / 3.543307) + 1,
+                    $talign
+                );
+            
+             
+        }
+        
+        // now daraw
+    
+    }
+    
+    /**
+    * get a value from the data
+    *
+    * eg. $data = array(
+    *     'fred' => 'somevalue'
+    *
+    *  getValue ($data,'fred') returns 'somevalue' 
+    * 
+    * value can also be a method = eg. getFred()
+    *
+    * @param   object|array $data 
+    * @param   string $v key to get.
+    * 
+    *
+    * @return   string
+    * @access   public
+    */
+  
+    function iconvert($str) {
+        if (is_object($str) || is_array($str)) {
+            return $str;
+        }
+        return  $str ;//. ' - ' . @iconv( "UTF-8" , "Big5//IGNORE", $str  );
+    }
+  
+    function getValue($data,$v) {
+        
+        // not a method:
+        
+        if ($v[strlen($v)-1]  != ')') {
+            $data = (array) $data;
+            if (false === strpos($v,'.')) {
+                if (!isset($data[$v])) {
+                    return '';
+                }
+                if (is_array($data[$v]) || is_object($data[$v])) {
+                    return '';
+                }
+                
+                return $this->iconvert(@$data[$v]);
+            }
+            $dd = (array)$data;
+            foreach(explode('.', $v) as $vv) {
+                if (!is_array($dd)) {
+                    return '';   
+                }
+                if (!isset($dd[$vv])) {
+                    return '';
+                }
+                $dd = is_object($dd[$vv]) ? ((array) $dd[$vv]) : $this->iconvert($dd[$vv]);
+            }
+            //echo "ATTEMPT: $v: got $dd\n";
+            //exit;
+            if (is_array($dd) || is_object($dd)) {
+                return '';
+            }
+            return $this->iconvert($dd);
+        }
+        // method !!!
+        if (!is_object($data)) {
+            return '';
+        }
+        $method = substr($v,0,-2);
+        if (is_callable(array($data,$method))) {
+            $ret = $data->$method();
+            if (is_array($ret) || is_object($ret)) {
+                return '';
+            }
+            // not in original!!!
+            return $this->iconvert($ret);
+        }
+        //echo 
+        //print_r($data);
+        
+        //exit;
+        return "no method $method in ".get_class($data);
+    
+    
+    }
+    
+    
+    function breakLines(&$pdf,$str,$x,$y,$h,$align) {
+        // do the estimation...
+        $len = strlen($str);
+ 
+        $total = $pdf->getStringWidth($str . '      ');
+         
+        $charsize = $total/$len;
+        
+        $max_chars = floor(($this->maxWidth / 3.543307) / $charsize);
+        //echo "LEN: $len, $total, $charsize, $max_chars";
+        $lines = explode("\n",wordwrap($str,$max_chars));
+         
+        return $this->multiLine($pdf,$lines,$x,$y,$h,$align);
+    }
+    
+    function multiLine(&$pdf,$lines,$x,$y,$h,$align) {
+        // now dealing with mm
+        XML_SvgToPDFAlt::debug("MULTILINE " .implode("\n",$lines) . " $x, $y, $h");
+        $yoffset  = 0;
+        $line = -1;
+        foreach ($lines as $l=>$v) {
+            $line++;
+            if (@$this->maxWidth && ($pdf->getStringWidth($v) > ($this->maxWidth / 3.543307))) {
+                $yoffset += $this->breakLines($pdf,$v,$x,$y + ($l * $h) + $yoffset, $h,$align);
+                continue;
+            }
+            
+            $xoffset = 0;
+            if ($align == 'M') { // center
+                $xoffset = -1 * ($pdf->getStringWidth($v) / 2);
+            }
+            if ($align == 'E') { // right/end
+                $xoffset = -1 * $pdf->getStringWidth($v);
+            }
+           
+            if ($align == 'J' ) { // justified (eg. started with ==
+                $this->justify($pdf, $x , $y + ($l * $h) + $yoffset , $v, $this->justifyLen);
+                continue;
+            }
+            XML_SvgToPDFAlt::debug("TEXT:   " . ( $xoffset + $x ) . "," .
+                ($y + ($l * $h) + $yoffset) . "," . 
+                $v);
+            
+            $pdf->text(
+                $xoffset + $x ,
+                $y + ($l * $h) + $yoffset ,
+                $v);
+                
+        }
+        return   ($l * $h) + $yoffset;
+        
+    }
+        
+        
+    function justify(&$pdf,$x,$y,$text,$len) {
+        if (!strlen(trim($text))) {
+            return;
+        }
+        $bits = explode(' ', $text);
+        $textlen = $pdf->getStringWidth(implode('',$bits));
+        $spacesize = ($len - $textlen) / (count($bits) -1);
+        foreach($bits as $word) {
+            $pdf->text($x , $y ,$word );
+            $x += $spacesize + $pdf->getStringWidth($word);
+        }
+    }
+        
+     
+
+}
diff --git a/XML/SvgToPdfAlt/Tspan.php b/XML/SvgToPdfAlt/Tspan.php
new file mode 100644
index 00000000..4e217fb5
--- /dev/null
+++ b/XML/SvgToPdfAlt/Tspan.php
@@ -0,0 +1,62 @@
+x)) {
+               unset($this->x); 
+        }
+        if (isset($this->y)) {
+               unset($this->y); 
+        }
+        static $trans = false;
+        if (!$trans) {
+            $trans = array_flip(get_html_translation_table(HTML_ENTITIES));
+        }
+        if (@$this->content) {
+            if (strpos($this->content,'&') !== false) {
+                $this->content = strtr($this->content, $trans);
+                $this->content = str_replace(''',"'",$this->content);
+
+                $this->content =  preg_replace_callback(
+                        '/&#(\d+);/m',
+                            function($m) { return chr($m[1]); }  ,$this->content);
+            }
+            if (@$node->language) {
+                // todo - other conversions....
+
+                $this->content = mb_convert_encoding($this->content,'BIG-5','UTF-8');
+
+                
+            }
+
+            if (false === strpos($this->content,'{')) {
+                return;
+            }
+            preg_match_all('/\{([a-z0-9_.]+(\(\))?)\}/i',$this->content,$matches);
+//echo "
";            print_r($matches);
+            //if (false !== strpos($this->content,'(')) {
+                
+            //    echo "
";print_R($matches);
+            //    exit;
+            //}
+            
+            $this->args = $matches[1];
+            foreach($this->args as $v) {
+                $this->content  = str_replace('{'.$v.'}', '%s',$this->content);
+            }
+            //$this->content = preg_replace('/\{('.implode('|',$matches[1]).')\}/','%s',$this->content);
+        }
+        
+    }
+            
+
+
+
+}
diff --git a/XML/Tree.php b/XML/Tree.php
index d7b7abfa..92b93481 100644
--- a/XML/Tree.php
+++ b/XML/Tree.php
@@ -82,6 +82,9 @@ class XML_Tree extends XML_Parser
     * @var  string
     */
     var $version = '1.0';
+    
+    
+    var $obj = array();
 
     /**
     * Constructor
@@ -213,7 +216,7 @@ class XML_Tree extends XML_Parser
     function getTreeFromFile ()
     {
         $this->folding = false;
-        $this->XML_Parser(null, 'event');
+        parent::__construct(null, 'event');
         $err = $this->setInputFile($this->filename);
         if (PEAR::isError($err)) {
             return $err;
@@ -235,7 +238,7 @@ class XML_Tree extends XML_Parser
     function getTreeFromString($str)
     {
         $this->folding = false;
-        $this->XML_Parser(null, 'event');
+        parent::__construct(null, 'event');
         $this->cdata = null;
         $err = $this->parseString($str);
         if (PEAR::isError($err)) {
@@ -254,22 +257,22 @@ class XML_Tree extends XML_Parser
     *
     * @access private
     */
-    function startHandler($xp, $elem, &$attribs)
+    function startHandler($xp, $elem,  $attribs)
     {
-        $lineno = xml_get_current_line_number($xp);
+         $lineno = xml_get_current_line_number($this->parser);
         // root elem
-        if (!isset($this->i)) {
-            $this->obj1 = $this->addRoot($elem, null, $attribs, $lineno);
+        if (empty($this->i)) {
+            $this->obj[1] = $this->addRoot($elem, null, $attribs, $lineno);
             $this->i = 2;
         } else {
             // mixed contents
             if (!empty($this->cdata)) {
-                $parent_id = 'obj' . ($this->i - 1);
-                $parent    = $this->$parent_id;
+                $parent_id = $this->i - 1;
+                $parent    = $this->obj[$parent_id];
                 $parent->children[] = new XML_Tree_Node(null, $this->cdata, null, $lineno);
             }
-            $obj_id = 'obj' . $this->i++;
-            $this->$obj_id = new XML_Tree_Node($elem, null, $attribs, $lineno);
+            $obj_id = $this->i++;
+            $this->obj[$obj_id] = new XML_Tree_Node($elem, null, $attribs, $lineno);
         }
         $this->cdata = null;
         return null;
@@ -284,13 +287,13 @@ class XML_Tree extends XML_Parser
     *
     * @access private
     */
-    function endHandler($xp, $elem)
+    function endHandler($elem)
     {
         $this->i--;
         if ($this->i > 1) {
-            $obj_id = 'obj' . $this->i;
+            $obj_id =   $this->i;
             // recover the node created in StartHandler
-            $node   = $this->$obj_id;
+            $node   = $this->obj[$obj_id];
             // mixed contents
             if (count($node->children) > 0) {
                 if (trim($this->cdata)) {
@@ -299,8 +302,8 @@ class XML_Tree extends XML_Parser
             } else {
                 $node->setContent($this->cdata);
             }
-            $parent_id = 'obj' . ($this->i - 1);
-            $parent    = $this->$parent_id;
+            $parent_id =  ($this->i - 1);
+            $parent    = $this->obj[$parent_id];
             // attach the node to its parent node children array
             $parent->children[] = $node;
         }
@@ -319,6 +322,7 @@ class XML_Tree extends XML_Parser
     */
     function cdataHandler($xp, $data)
     {
+        //var_dump($data);
         if (trim($data) != '') {
             $this->cdata .= $data;
         }
@@ -468,4 +472,3 @@ class XML_Tree extends XML_Parser
         return $result;
     }
 }
-?>
diff --git a/XML/Tree/Morph.php b/XML/Tree/Morph.php
index ead8bbc7..da90d1de 100644
--- a/XML/Tree/Morph.php
+++ b/XML/Tree/Morph.php
@@ -88,8 +88,11 @@ require_once 'XML/Tree.php';
 */
 class XML_Tree_Morph extends XML_Tree {
 
-    var $cdata;
+    var $cdata = '';
     var $_morphOptions;
+    
+    var $i;
+    
 
     /**
     * Constructor
@@ -129,26 +132,31 @@ class XML_Tree_Morph extends XML_Tree {
       
   
     
-    function endHandler($xp, $elem)  {
+    function endHandler($elem)  {
         $this->i--;
         if ($this->i > 1) {
-            $obj_id = 'obj' . $this->i;
+            $obj_id =   $this->i;
             // recover the node created in StartHandler
-            $node   =  $this->$obj_id;
+            $node   =  $this->obj[$obj_id];
             // mixed contents
-            if (count($node->children) > 0) {
-                if (trim($this->cdata)) {
+            //var_dump($this->cdata, typeof($node->children);
+            if (is_array($node->children) && count($node->children) > 0) {
+                if (!empty($this->cdata) && trim($this->cdata)) {
                     $node->children[] =  new XML_Tree_Node(null, $this->cdata);
                 }
-            } else {
+            } else if ($this->cdata !== null) {
+                
                 $node->setContent($this->cdata);
+                //var_dump(array($node, $this->cdata));
+            } else {
+                $node->setContent('');
             }
-            $parent_id = 'obj' . ($this->i - 1);
-            $parent    = $this->$parent_id;
+            $parent_id =  ($this->i - 1);
+            $parent    = $this->obj[$parent_id];
             // attach the node to its parent node children array
-            
+           // print_r($this);exit;
             if (isset($this->_morphOptions['filter'][$node->name])) {
-                $f = &$this->_morphOptions['filter'][$node->name];
+                $f = $this->_morphOptions['filter'][$node->name];
                 if (is_string($f) && method_exists($this,'morph'.$f)) {
                     $parent->children[] = $this->{'morph'.$this->_morphOptions['filter'][$node->name]}($node);
                     $this->cdata = null;
@@ -168,6 +176,7 @@ class XML_Tree_Morph extends XML_Tree {
             }
             
             $parent->children[] = $node;
+            
         }
         $this->cdata = null;
         return null;
diff --git a/XML/Tree/Node.php b/XML/Tree/Node.php
index 7ff9c04d..4ad6d41d 100644
--- a/XML/Tree/Node.php
+++ b/XML/Tree/Node.php
@@ -28,6 +28,8 @@
 * @package XML_Tree
 * @version 1.0  16-Aug-2001
 */
+#[AllowDynamicProperties] 
+
 class XML_Tree_Node {
     /**
     * Attributes of this node
@@ -56,7 +58,8 @@ class XML_Tree_Node {
     * @var  string
     */
     var $name;
-
+    
+    var $lineno;
     /**
     * Constructor
     *
@@ -64,10 +67,12 @@ class XML_Tree_Node {
     * @param  string    content         Node content (text)
     * @param  array     attributes      Attribute-hash for the node
     */
-    function XML_Tree_Node($name, $content = '', $attributes = array(), $lineno = null)
+    function __construct($name, $content = '', $attributes = array(), $lineno = null)
     {
         $this->name = $name;
-        $this->setContent($content);
+        if ($content !== null) {
+            $this->setContent($content);
+        }
         $this->attributes = $attributes;
         $this->children   = array();
         $this->lineno     = $lineno;
@@ -275,6 +280,11 @@ class XML_Tree_Node {
         return null;
     }
 
+    function hasAttribute($name)
+    {
+        return isset($this->attributes[strtolower($name)]);
+    }
+    
     /**
     * Sets an attribute for this node.
     *
@@ -309,9 +319,11 @@ class XML_Tree_Node {
     *
     * @access public
     */
-    function setContent(&$content)
+    function setContent($content)
     {
+        
         $this->content = $this->encodeXmlEntities($content);
+       // var_dump(array($this->content, $content));
     }
 
     /**
@@ -401,7 +413,16 @@ class XML_Tree_Node {
     */
     function encodeXmlEntities($xml)
     {
-        $xml = str_replace(array('ü', 'Ü', 'ö',
+         $xml =  preg_replace_callback("/[\x{0080}-\x{FFFF}]/u", function($v) {
+                         //   var_dump($v);
+                            return '&#'. mb_ord($v[0]).';';
+                            
+                                  //"'&#'.ord('\\1').';'"         
+                        },
+                        $xml
+                    );
+         //var_dump($xml);
+         $xml = str_replace(array('ü', 'Ü', 'ö',
                                  'Ö', 'ä', 'Ä',
                                  'ß', '<', '>',
                                  '"', '\''
@@ -413,20 +434,31 @@ class XML_Tree_Node {
                                 ),
                            $xml
                           );
-        // fixme - remove the /e!!!
-        $xml = @preg_replace(array("/\&([a-z\d\#]+)\;/i",
+       // var_dump($xml);
+        $xml =  preg_replace(array("/\&([a-z\d\#]+)\;/i",
                                   "/\&/",
                                   "/\#\|\|([a-z\d\#]+)\|\|\#/i",
-                                  "/([^a-zA-Z\d\s\<\>\&\;\.\:\=\"\-\/\%\?\!\'\(\)\[\]\{\}\$\#\+\,\@_])/e"
                                  ),
                             array("#||\\1||#",
                                   "&",
                                   "&\\1;",
-                                  "'&#'.ord('\\1').';'"
+                                  
                                  ),
                             $xml
-                           );
-
+        );
+ 
+/*
+             $xml =  preg_replace_callback("/[^a-zA-Z\d\s\<\>\&\;\.\:\=\"\-\/\%\?\!\'\(\)\[\]\{\}\$\#\+\,\@_]/u",
+                        function($v) {
+                             var_dump($v);
+                            return '&#'. mb_ord($v[0]).';';
+                            
+                                  //"'&#'.ord('\\1').';'"         
+                        },
+                        $xml
+                    );
+                    */
+//var_dump($xml);             
         return $xml;
     }
 
-- 
2.39.2