/** * Reads the data from the given stream. * * @param StreamInterface $stream The stream to read from. */ public function read(StreamInterface $stream) { // Read the format number... $stream->readUShort(); $this->setLength($stream->readUShort()); $this->setLanguage($stream->readUShort()); $this->setSegCountX2($stream->readUShort()); $this->setSearchRange($stream->readUShort()); $this->setEntrySelector($stream->readUShort()); $this->setRangeShift($stream->readUShort()); $offset = 14; for ($i = 0; $i < $this->segCountX2 / 2; ++$i, $offset += 2) { $this->setEndCount($i, $stream->readUShort()); } $this->setReservedPad($stream->readUShort()); $offset += 2; for ($i = 0; $i < $this->segCountX2 / 2; ++$i, $offset += 2) { $this->setStartCount($i, $stream->readUShort()); } for ($i = 0; $i < $this->segCountX2 / 2; ++$i, $offset += 2) { $this->setIdDelta($i, $stream->readShort()); } for ($i = 0; $i < $this->segCountX2 / 2; ++$i, $offset += 2) { $this->setIdRangeOffset($i, $stream->readUShort()); } for ($index = 0; $offset < $this->getLength(); $index++, $offset += 2) { $this->setGlyphId($index, $stream->readUShort()); } }
/** * @param StreamInterface $stream The stream to read from. */ public function read(StreamInterface $stream) { $this->tableVersionNumber = $stream->readFixed(); $this->fontRevision = $stream->readFixed(); $this->checkSumAdjustment = $stream->readULong(); $this->magicNumber = $stream->readULong(); if ($this->magicNumber != self::MAGIC_NUMBER) { throw new \Exception(sprintf('Magic number for head table should be set to 0x%x but we got 0x%x', self::MAGIC_NUMBER, $this->magicNumber)); } $this->flags = $stream->readUShort(); $this->unitsPerEm = $stream->readUShort(); $this->created = $stream->readLongDateTime(); $this->modified = $stream->readLongDateTime(); $this->xMin = $stream->readShort(); $this->yMin = $stream->readShort(); $this->xMax = $stream->readShort(); $this->yMax = $stream->readShort(); $this->macStyle = $stream->readUShort(); $this->lowestRecPPEM = $stream->readUShort(); $this->fontDirectionHint = $stream->readShort(); $this->indexToLocFormat = $stream->readShort(); $this->glyphDataFormat = $stream->readShort(); }
/** * Reads the information from the given stream. * * @param StreamInterface $stream The stream to read from. */ public function read(StreamInterface $stream) { $this->yPelHeight = $stream->readUShort(); $this->yMax = $stream->readShort(); $this->yMin = $stream->readShort(); }
/** * @param StreamInterface $stream The stream to read from. */ public function read(StreamInterface $stream) { $this->version = $stream->readUShort(); $this->xAvgCharWidth = $stream->readShort(); $this->usWeightClass = $stream->readUShort(); $this->usWidthClass = $stream->readUShort(); $this->fsType = $stream->readUShort(); $this->ySubscriptXSize = $stream->readShort(); $this->ySubscriptYSize = $stream->readShort(); $this->ySubscriptXOffset = $stream->readShort(); $this->ySubscriptYOffset = $stream->readShort(); $this->ySuperscriptXSize = $stream->readShort(); $this->ySuperscriptYSize = $stream->readShort(); $this->ySuperscriptXOffset = $stream->readShort(); $this->ySuperscriptYOffset = $stream->readShort(); $this->yStrikeoutSize = $stream->readShort(); $this->yStrikeoutPosition = $stream->readShort(); $this->sFamilyClass = $stream->readShort(); $this->panose = array(); for ($i = 0; $i < 10; ++$i) { $this->panose[] = $stream->readByte(); } $this->ulUnicodeRange1 = $stream->readULong(); $this->ulUnicodeRange2 = $stream->readULong(); $this->ulUnicodeRange3 = $stream->readULong(); $this->ulUnicodeRange4 = $stream->readULong(); $this->achVendID = array(); for ($i = 0; $i < 4; ++$i) { $this->achVendID[] = $stream->readChar(); } $this->fsSelection = $stream->readUShort(); $this->usFirstCharIndex = $stream->readUShort(); $this->usLastCharIndex = $stream->readUShort(); $this->sTypoAscender = $stream->readShort(); $this->sTypoDescender = $stream->readShort(); $this->sTypoLineGap = $stream->readShort(); $this->usWinAscent = $stream->readUShort(); $this->usWinDescent = $stream->readUShort(); $this->ulCodePageRange1 = $stream->readULong(); $this->ulCodePageRange2 = $stream->readULong(); $this->sxHeight = $stream->readShort(); $this->sCapHeight = $stream->readShort(); $this->usDefaultChar = $stream->readUShort(); $this->usBreakChar = $stream->readUShort(); $this->usMaxContext = $stream->readUShort(); }
/** * Reads information from the given stream. * * @param StreamInterface $stream The stream to read from. */ public function read(StreamInterface $stream) { $this->advanceWidth = $stream->readUShort(); $this->lsb = $stream->readShort(); }
/** * Reads information from the given stream. * * @param StreamInterface $stream The stream to read from. */ public function read(StreamInterface $stream) { $this->tableVersionNumber = $stream->readFixed(); $this->ascender = $stream->readFWord(); $this->descender = $stream->readFWord(); $this->lineGap = $stream->readFWord(); $this->advanceWidthMax = $stream->readUFWord(); $this->minLeftSideBearing = $stream->readFWord(); $this->minRightSideBearing = $stream->readFWord(); $this->xMaxExtent = $stream->readFWord(); $this->caretSlopeRise = $stream->readShort(); $this->caretSlopeRun = $stream->readShort(); $this->caretOffset = $stream->readShort(); // Read reserved values: $stream->readShort(); $stream->readShort(); $stream->readShort(); $stream->readShort(); $this->metricDataFormat = $stream->readShort(); $this->numberOfHMetrics = $stream->readUShort(); }