\r
function AddFont($family,$style='',$file='')\r
{\r
- //Add a TrueType or Type1 font\r
+ //var_dump(array($family, $style, $file));//Add a TrueType or Type1 font\r
$family=strtolower($family);\r
if($family=='arial')\r
$family='helvetica';\r
$c=$s[$i];
if(ord($c)<128)
{
- $l+=$cw[$c];
+ $l+= isset($cw[$c]) ? $cw[$c] : 0;
$i++;
}
else
function _putfonts()
{
- $nf=$this->n;
+ print_R($this->fonts);
+ $nf=$this->n;
foreach($this->diffs as $diff)
{
//Encodings
$this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
$this->_out('endobj');
}
+
+
foreach($this->FontFiles as $file=>$info)
{
//Font file embedding
if(defined('FPDF_FONTPATH'))
$file=FPDF_FONTPATH.$file;
$size=filesize($file);
+
if(!$size)
$this->Error('Font file not found');
$this->_out('<</Length '.$size);
$this->_out('endobj');
if($font['type']!='core')
{
- //Widths
+ //Widths
$this->_newobj();
$cw=&$font['cw'];
$s='[';
$this->_out('endobj');
}
}
- }
+ }
}
function _putType0($font)
$this->_out('endobj');
}
}
-?>
);
$tree = $x->getTreeFromFile();
-
- //echo '<PRE>'.htmlspecialchars(print_r($tree,true));exit;
+
+ ///echo '<PRE>'.htmlspecialchars(print_r($tree,true));exit;
$tree = $t->buildobject($tree);
//echo '<PRE>'.htmlspecialchars(print_r($tree,true));
$pdf->addPage();
$tree->writePDF($pdf,$data);
$t->debug($tree);
+
return $pdf;
}
$tree->writePDF($pdf,$page_data);
}
- $t->debug($tree);
+ $t->debug($tree, true);
return $pdf;
}
$isDynamic = false;
foreach(array_keys($this->children) as $k) {
- if (!is_a($this->children[$k], 'XML_SvgToPDF_Text')) {
+ if (!is_a($this->children[$k], 'XML_SvgToPDFAlt_Text')) {
continue;
}
//look for the bounding box..
$boundingbox = false;
foreach(array_keys($this->children) as $k) {
- if (!is_a($this->children[$k], 'XML_SvgToPDF_Rect')) {
+ if (!is_a($this->children[$k], 'XML_SvgToPDFAlt_Rect')) {
continue;
}
if (@$this->children[$k]->nonprintable == 'true') {
$kmax = count($keys);
//XML_SvgToPDF::debug(array($x,$y,$w,$h));
//XML_SvgToPDF::debug($keys);
- XML_SvgToPDF::debug($this->settings);
+ XML_SvgToPDFAlt::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));
+ XML_SvgToPDFAlt::debug(array($xx,$yy));
foreach(array_keys($this->children) as $k) {
if (!$this->children[$k]) {
continue;
$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;
+ $val = isset($c->content) ? $c->content : '';
if (isset($c->args)) {
$val = vsprintf($val,$args);
- if ($has_template && ($font == 'Big5')) {
+ if ($has_template && ($font == 'Big5')) {
require_once 'Text/ZhDetect.php';
$detect = new Text_zhDetect;
$type = $detect->guess($val);
$weight,
$size);
} else {
+ $vv = $val;
$val = @iconv('utf8', 'BIG5//IGNORE', $val);
+ //var_dump(array($vv, $val));
$pdf->setFont('Big5' ,
$weight,
$size);
}
- }
+ }
/*
}
$talign = $align;
- if ((!@$this->children[$i+1] || !strlen(trim(@$this->children[$i+1]->content))) && ($align == 'J')) {
+ if ((empty($this->children[$i+1]) || !isset($this->children[$i+1]->content) || !strlen(trim($this->children[$i+1]->content))) && ($align == 'J')) {
$talign = 'L';
}
-
-
-
+
function multiLine(&$pdf,$lines,$x,$y,$h,$align) {
// now dealing with mm
- XML_SvgToPDFAlt::debug("MULTILINE " .implode("\n",$lines) . " $x, $y, $h");
+ XML_SvgToPDFAlt::debug("MULTILINE '" .implode("\n",$lines) . "' $x, $y, $h");
$yoffset = 0;
$line = -1;
foreach ($lines as $l=>$v) {
$this->content = preg_replace_callback(
'/&#(\d+);/m',
- function($m) { return chr($m[1]); } ,$this->content);
+ function($m) {
+
+ return mb_chr($m[1]);
+ } ,$this->content);
}
if (@$node->language) {
// todo - other conversions....
- $this->content = mb_convert_encoding($this->content,'BIG-5','UTF-8');
+ //$this->content = mb_convert_encoding($this->content,'BIG-5','UTF-8');
}