\r
\r
class TTFontFile {\r
-\r
-var $_pos;\r
-var $numTables;\r
-var $searchRange;\r
-var $entrySelector;\r
-var $rangeShift;\r
-var $tables;\r
-var $otables;\r
-var $filename;\r
-var $fh;\r
-var $hmetrics;\r
-var $glyphPos;\r
-var $charToGlyph;\r
-var $ascent;\r
-var $descent;\r
-var $name;\r
-var $familyName;\r
-var $styleName;\r
-var $fullName;\r
-var $uniqueFontID;\r
-var $unitsPerEm;\r
-var $bbox;\r
-var $capHeight;\r
-var $stemV;\r
-var $italicAngle;\r
-var $flags;\r
-var $underlinePosition;\r
-var $underlineThickness;\r
-var $charWidths;\r
-var $defaultWidth;\r
-var $maxStrLenRead;\r
+ \r
+ var $_pos;\r
+ var $numTables;\r
+ var $searchRange;\r
+ var $entrySelector;\r
+ var $rangeShift;\r
+ var $tables;\r
+ var $otables;\r
+ var $filename;\r
+ var $fh;\r
+ var $hmetrics;\r
+ var $glyphPos;\r
+ var $charToGlyph;\r
+ var $ascent;\r
+ var $descent;\r
+ var $name;\r
+ var $familyName;\r
+ var $styleName;\r
+ var $fullName;\r
+ var $uniqueFontID;\r
+ var $unitsPerEm;\r
+ var $bbox;\r
+ var $capHeight;\r
+ var $stemV;\r
+ var $italicAngle;\r
+ var $flags;\r
+ var $underlinePosition;\r
+ var $underlineThickness;\r
+ var $charWidths;\r
+ var $defaultWidth;\r
+ var $maxStrLenRead;\r
+ var $version;\r
+ var $fontRevision;\r
\r
function TTFontFile() {\r
$this->maxStrLenRead = 200000; // Maximum size of glyf table to read in as string (otherwise reads each glyph from file)\r
if (!$psName)\r
die("Could not find PostScript font name");\r
for ($i=0;$i<strlen($psName);$i++) {\r
- $c = $psName{$i}; // 1.02\r
+ $c = $psName[$i]; // 1.02\r
$oc = ord($c);\r
if ($oc>126 || strpos(' [](){}<>/%',$c)!==false)\r
die("psName=".$psName." contains invalid character ".$c." ie U+".ord(c));\r
* Public methods *
* *
*******************************************************************************/
-function tFPDF($orientation='P', $unit='mm', $format='A4')
+function __construct($orientation='P', $unit='mm', $format='a4')
{
//Some checks
$this->_dochecks();
if(!isset($name)) {
$this->Error('Problem with the font definition file');
}
- $i = count($this->fonts)+$this->extraFontSubsets+1;
+ $i = count(is_array($this->fonts) ? $this->fonts : array())+$this->extraFontSubsets+1;
$sbarr = range(0,127);
$this->fonts[$fontkey] = array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$ttfilename, 'subsets'=>array(0=>$sbarr), 'subsetfontids'=>array($i), 'used'=>false);
unset($cw);
$this->y=$this->tMargin;
$this->FontFamily='';
//Check page size
- if($orientation=='')
+ if($orientation=='') {
$orientation=$this->DefOrientation;
- else
+ } else {
$orientation=strtoupper($orientation[0]);
- if($format=='')
+ }
+ if($format=='') {
$format=$this->DefPageFormat;
- else
- {
- if(is_string($format))
+ } else {
+ if(is_string($format)) {
$format=$this->_getpageformat($format);
+ }
}
- if($orientation!=$this->CurOrientation || $format[0]!=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1])
+ if($orientation!=$this->CurOrientation || empty($format) || $format[0] !=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1])
{
//New size
if($orientation=='P')
}
else
{
- $this->w=$format[1];
- $this->h=$format[0];
+ $this->w= $format[1];
+ $this->h= $format[0];
}
$this->wPt=$this->w*$this->k;
$this->hPt=$this->h*$this->k;
{
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->images);
- while(list($file,$info)=each($this->images))
- {
+ foreach($this->images as $file_info) {
+
+ list($file,$info)=$file_info;
+
$this->_newobj();
$this->images[$file]['n']=$this->n;
$this->_out('<</Type /XObject');
var $children = array();
var $transform = '';
+ var $id;
+ var $nodetypes;
+ var $version;
+ var $docname;
+ var $docbase;
+
function fromXmlNode($node)
{
// extract attributes
- function writePDF($pdf,&$data) {
+ function writePDF($pdf,$data) {
$this->childrenWritePDF($pdf,$data);
}
- function writePDF($pdf,&$data) {
+ function writePDF($pdf,$data) {
// g group = does it have a
// look for
if (empty($this->children)) {
class XML_SvgToPDF_Path extends XML_SvgToPDF_Base {
var $d; // stores the details of the path..
+ var $id;
function fromXmlNode($node) {
if (!$color || ($color == 'none')) {
return false;
}
- var_dump($color);
- return array(
+ return array(
hexdec(substr($color,1,2)),
hexdec(substr($color,3,2)),
hexdec(substr($color,5,2)));
class XML_SvgToPDF_Text extends XML_SvgToPDF_Base {
+ var $linespacing;
+
+
function fromXmlNode($node) {
parent::fromXmlNode($node);
var $x = false;
var $y = false;
var $args = array(); // arguments..
+ var $role;
+
function fromXmlNode($node) {
parent::fromXmlNode($node);
$this->x = false;
}
- function shift() // disable shifting on text
+ function shift($x,$y) // disable shifting on text
{
return;
}