Exemple #1
0
 private function readSubtables(StreamInterface $stream)
 {
     foreach ($this->getEncodingRecords() as $encodingRecord) {
         $stream->setPosition($this->getBaseOffset() + $encodingRecord->getOffset());
         $format = $stream->readUShort();
         $stream->setPosition($this->getBaseOffset() + $encodingRecord->getOffset());
         $subTable = $this->getSubTable($format);
         $subTable->read($stream);
         $this->subTables[] = $subTable;
     }
 }
Exemple #2
0
 /**
  * Reads all the names from the given stream.
  *
  * @param StreamInterface $stream The stream to read from.
  * @return string[]
  */
 private function readNames(StreamInterface $stream)
 {
     $names = array();
     foreach ($this->nameRecord as $record) {
         // When there is no language code, we can't read the record name:
         if ($record->getLanguageCode() === null) {
             continue;
         }
         $stringOffset = $this->baseOffset + $this->stringOffset + $record->getOffset();
         $stream->setPosition($stringOffset);
         if ($record->getPlatformID() == 3) {
             $name = $stream->readStringBytes($record->getLength(), 'UTF-16BE', 'UTF-8');
         } else {
             $name = $stream->readStringBytes($record->getLength(), 'MacRoman', 'UTF-8');
         }
         $names[$record->getNameID()][$record->getLanguageCode()] = $name;
     }
     return $names;
 }