Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Post
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Pdf\Build\Font\TrueType\Table;
16
17/**
18 * POST table class
19 *
20 * @category   Pop
21 * @package    Pop\Pdf
22 * @author     Nick Sagona, III <nick@popphp.org>
23 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
24 * @license    https://www.popphp.org/license     New BSD License
25 * @version    6.0.0
26 */
27class Post extends AbstractTable
28{
29
30    /**
31     * Font table properties
32     * @var array
33     */
34    protected array $properties = [
35        'italicAngle' => 0,
36        'fixed'       => 0
37    ];
38
39    /**
40     * Constructor
41     *
42     * Instantiate a TTF 'post' table object.
43     *
44     * @param  \Pop\Pdf\Build\Font\TrueType $font
45     */
46    public function __construct(\Pop\Pdf\Build\Font\TrueType $font)
47    {
48        $bytePos = $font->tableInfo['post']->offset + 4;
49
50        $italicBytes  = $font->read($bytePos, 4);
51        $this->properties['italicAngle'] = $font->readFixed(16, 16, $italicBytes);
52
53        $bytePos += 8;
54
55        $ary = unpack('nfixed/', $font->read($bytePos, 2));
56        $ary = $font->shiftToSigned($ary);
57        $this->properties['fixed'] = $ary['fixed'];
58    }
59
60}