From adaf3406e4b15e968b70a64c6195240131a62715 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 13 Oct 2011 10:32:17 +0000 Subject: [PATCH] --- fluidbook/tools/convert.pe | 7 ++++ .../Util/fontextractor/class.ws.pdf.font.php | 33 ++++++++++++++++--- inc/ws/Util/html5/class.ws.html5.compiler.php | 3 ++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/fluidbook/tools/convert.pe b/fluidbook/tools/convert.pe index a70350060..efc6c4141 100644 --- a/fluidbook/tools/convert.pe +++ b/fluidbook/tools/convert.pe @@ -10,12 +10,19 @@ while ( i<=$argc-3 ) endloop if($argv[i]!="-") + if($iscid==1) + Print("It's a CID Font") + Print("Flatten CID") + CIDFlatten() + endif + Print("Rewrite font with CMAP ",$argv[i]); cmap=LoadStringFromFile($argv[i]) glyphs=StrSplit(cmap,"\\n"); j=0 while(j '00C6', 'ae' => '00E6', 'OE' => '0152', 'oe' => '0152', 'IJ' => '0132', 'ij' => '0133', @@ -85,6 +86,8 @@ class wsPDFFont { $this->capheight = $e[1]; } elseif ($e[0] == '/Flags') { $this->flags = $e[1]; + } elseif ($e[0] == '/FontBBox') { + $this->bbox = array($e[2], $e[3], $e[4], $e[5]); } } } @@ -97,11 +100,15 @@ class wsPDFFont { if (!is_null($this->descendant)) { $font = $this->decendant; } + + if(is_null($font)){ + $font=$this; + } $fontforge->setArg(null, $file); $fontforge->setArg(null, $font->italicAngle); - $fontforge->setArg(null, $font->ascent); - $fontforge->setArg(null, $font->descent); + $fontforge->setArg(null, $font->getAscent()); + $fontforge->setArg(null, $font->getDescent()); //if ($font->firstChar == 0 && $font->firstWidth == 500) { $fontforge->setArg(null, '-'); $fontforge->setArg(null, '-'); @@ -110,7 +117,9 @@ class wsPDFFont { // $fontforge->setArg(null, $font->firstWidth); //} $fontforge->execute(); + $this->addToLog($fontforge); + } public function getInfos() { @@ -269,9 +278,9 @@ class wsPDFFont { $inMap = true; continue; } - - if(count($e)==1 && $e[0]=='endbfchar'){ - $inMap=false; + + if (count($e) == 1 && $e[0] == 'endbfchar') { + $inMap = false; } if (!$inMap) { @@ -286,6 +295,20 @@ class wsPDFFont { return $res; } + public function getAscent() { + if ($this->ascent == 0) { + return $this->bbox[3]; + } + return $this->ascent; + } + + public function getDescent() { + if ($this->descent == 0) { + return abs($this->bbox[1]); + } + return $this->descent; + } + protected function manageLigatures($code) { $codes = str_split($code, 4); $str = ''; diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index 0f9e0778a..6f449afb9 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -386,6 +386,9 @@ class wsHTML5Compiler { $fontforge->setArg(null, '-'); $fontforge->setArg(null, $this->vdir . '/data/style/F' . $index . '.' . $format); $fontforge->execute(); + + fb($fontforge->commande); + fb($fontforge->output); } } } -- 2.39.5