Ejemplo n.º 1
0
 private function replaceComponentsOfCompositeGlyphs()
 {
     // If there exist composite glyphs, replace the components' glyphIndices
     // First construct a from=>to array
     $replacements = array();
     foreach ($this->TTFchars as $TTFchar) {
         $orgIndex = $TTFchar->orgIndex;
         $newIndex = $TTFchar->newIndex;
         $replacements[$orgIndex] = $orgIndex;
     }
     for ($i = 0; $i < count($this->TTFchars); $i++) {
         $TTFchar = $this->TTFchars[$i];
         $description = $TTFchar->description;
         if (strlen($description) == 0) {
             continue;
         }
         $glyph = TTF::getGlyph($description);
         if ($glyph['numberOfContours'] >= 0) {
             continue;
         }
         $newDescription = TTF::replaceComponentsOfCompositeGlyph($description, $replacements);
         $this->TTFchars[$i]->description = $newDescription;
     }
     if (self::VERBOSE) {
         foreach ($this->TTFchars as $TTFchar) {
             echo sprintf("%4d %4d %4d %4d\n", $TTFchar->charCode, $TTFchar->orgIndex, $TTFchar->newIndex, strlen($TTFchar->description));
         }
         echo sprintf("TTFchars size is %d\n", count($this->TTFchars));
     }
 }