示例#1
0
 /**
  * Parses horizontal header table (hhea) and sticks it in the indicated font
  */
 function get_hhea_table($font)
 {
     if ($this->hhea_table != '') {
         return $this->hhea_table;
     }
     $hhea =& $font->tables['hhea'];
     $fh = $font->open();
     fseek($fh, $hhea->offset);
     // see http://www.microsoft.com/typography/otspec/hhea.htm
     $hhea = new OTTTFontHHEA();
     $hhea->Table_version_number = FileRead::read_Fixed($fh);
     $hhea->Ascender = FileRead::read_FWORD($fh);
     $hhea->Descender = FileRead::read_FWORD($fh);
     $hhea->LineGap = FileRead::read_FWORD($fh);
     $hhea->advanceWidthMax = FileRead::read_UFWORD($fh);
     $hhea->minLeftSideBearing = FileRead::read_FWORD($fh);
     $hhea->minRightSideBearing = FileRead::read_FWORD($fh);
     $hhea->xMaxExtent = FileRead::read_FWORD($fh);
     $hhea->caretSlopeRise = FileRead::read_SHORT($fh);
     $hhea->caretSlopeRun = FileRead::read_SHORT($fh);
     $hhea->caretOffset = FileRead::read_SHORT($fh);
     $hhea->reserved1 = FileRead::read_SHORT($fh);
     $hhea->reserved2 = FileRead::read_SHORT($fh);
     $hhea->reserved3 = FileRead::read_SHORT($fh);
     $hhea->reserved4 = FileRead::read_SHORT($fh);
     $hhea->metricDataFormat = FileRead::read_SHORT($fh);
     $hhea->numberOfHMetrics = FileRead::read_USHORT($fh);
     $this->hhea_table = $hhea;
     fclose($fh);
     return $this->get_hhea_table($font);
 }