Example #1
0
 protected function _parse()
 {
     $font = $this->getFont();
     $offset = $font->pos();
     $loca = $font->getData("loca");
     $real_loca = array_slice($loca, 0, -1);
     // Not the last dummy loca entry
     $data = array();
     foreach ($real_loca as $gid => $location) {
         $_offset = $offset + $loca[$gid];
         $_size = $loca[$gid + 1] - $loca[$gid];
         $data[$gid] = Outline::init($this, $_offset, $_size);
     }
     $this->data = $data;
 }
Example #2
0
 function parseData()
 {
     parent::parseData();
     $font = $this->getFont();
     do {
         $flags = $font->readUInt16();
         $glyphIndex = $font->readUInt16();
         $a = 1.0;
         $b = 0.0;
         $c = 0.0;
         $d = 1.0;
         $e = 0.0;
         $f = 0.0;
         $point_compound = null;
         $point_component = null;
         $instructions = null;
         if ($flags & self::ARG_1_AND_2_ARE_WORDS) {
             if ($flags & self::ARGS_ARE_XY_VALUES) {
                 $e = $font->readInt16();
                 $f = $font->readInt16();
             } else {
                 $point_compound = $font->readUInt16();
                 $point_component = $font->readUInt16();
             }
         } else {
             if ($flags & self::ARGS_ARE_XY_VALUES) {
                 $e = $font->readInt8();
                 $f = $font->readInt8();
             } else {
                 $point_compound = $font->readUInt8();
                 $point_component = $font->readUInt8();
             }
         }
         if ($flags & self::WE_HAVE_A_SCALE) {
             $a = $d = $font->readInt16();
         } elseif ($flags & self::WE_HAVE_AN_X_AND_Y_SCALE) {
             $a = $font->readInt16();
             $d = $font->readInt16();
         } elseif ($flags & self::WE_HAVE_A_TWO_BY_TWO) {
             $a = $font->readInt16();
             $b = $font->readInt16();
             $c = $font->readInt16();
             $d = $font->readInt16();
         }
         //if ($flags & self::WE_HAVE_INSTRUCTIONS) {
         //
         //}
         $component = new Outline_Component();
         $component->flags = $flags;
         $component->glyphIndex = $glyphIndex;
         $component->a = $a;
         $component->b = $b;
         $component->c = $c;
         $component->d = $d;
         $component->e = $e;
         $component->f = $f;
         $component->point_compound = $point_compound;
         $component->point_component = $point_component;
         $component->instructions = $instructions;
         $this->components[] = $component;
     } while ($flags & self::MORE_COMPONENTS);
 }