Pop\Font\TrueType\Table\Loca::__construct PHP Метод

__construct() публичный Метод

Instantiate a TTF 'loca' table object.
public __construct ( AbstractFont $font ) : Loca
$font Pop\Font\AbstractFont
Результат Loca
    public function __construct(\Pop\Font\AbstractFont $font)
    {
        $bytePos = $font->tableInfo['loca']->offset;
        $format = $font->header->indexToLocFormat == 1 ? 'N' : 'n';
        $byteLength = $font->header->indexToLocFormat == 1 ? 4 : 2;
        $multiplier = $font->header->indexToLocFormat == 1 ? 1 : 2;
        for ($i = 0; $i < $font->numberOfGlyphs + 1; $i++) {
            $ary = unpack($format . 'offset', $font->read($bytePos, $byteLength));
            $this->offsets[$i] = $ary['offset'] * $multiplier;
            $bytePos += $byteLength;
        }
    }