Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
OpenType
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 parseRequiredTables
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
2
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;
16
17use Pop\Pdf\Build\Font\Exception;
18
19/**
20 * OpenType font class
21 *
22 * @category   Pop
23 * @package    Pop\Pdf
24 * @author     Nick Sagona, III <nick@popphp.org>
25 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
26 * @license    https://www.popphp.org/license     New BSD License
27 * @version    6.0.0
28 */
29class OpenType extends \Pop\Pdf\Build\Font\TrueType
30{
31
32    /**
33     * Constructor
34     *
35     * Instantiate a OpenType font file object based on a pre-existing font file on disk.
36     *
37     * @param  ?string $fontFile
38     * @param  ?string $fontStream
39     * @throws Exception|\Pop\Utils\Exception
40     */
41    public function __construct(?string $fontFile = null, ?string $fontStream = null)
42    {
43        parent::__construct($fontFile, $fontStream);
44    }
45
46    /**
47     * Method to parse the required tables of the OpenType font file.
48     *
49     * @return void
50     */
51    protected function parseRequiredTables(): void
52    {
53        // OS/2
54        if (isset($this->tableInfo['OS/2'])) {
55            $this->properties['tables']['OS/2'] = new Table\Os2($this);
56
57            $this->properties['flags']['isSerif']       = $this->properties['tables']['OS/2']['flags']['isSerif'];
58            $this->properties['flags']['isScript']      = $this->properties['tables']['OS/2']['flags']['isScript'];
59            $this->properties['flags']['isSymbolic']    = $this->properties['tables']['OS/2']['flags']['isSymbolic'];
60            $this->properties['flags']['isNonSymbolic'] = $this->properties['tables']['OS/2']['flags']['isNonSymbolic'];
61            $this->properties['capHeight']               = $this->properties['tables']['OS/2']['capHeight'];
62            $this->properties['embeddable']               = $this->properties['tables']['OS/2']['embeddable'];
63        }
64    }
65
66}