dompdf/php-font-lib

Undefined Offset in kern.php when using custom font

brendt opened this issue · 0 comments

We're getting this error:

ErrorException: Undefined offset: 12767

The code:

vendor/phenx/php-font-lib/src/FontLib/Table/Type/kern.php:51

45:         $tree  = array();
46: 
47:         $values = $font->readUInt16Many($subtable["nPairs"] * 3);
48:         for ($i = 0, $idx = 0; $i < $subtable["nPairs"]; $i++) {
49:           $left  = $values[$idx++];
50:           $right = $values[$idx++];
51:           $value = $values[$idx++];
52: 
53:           if ($value >= 0x8000) {
54:             $value -= 0x10000;

When using this setup

<style>
        @font-face {
            font-family: 'Flanders Art Sans Light';
            font-style: normal;
            font-weight: normal;
            src: url(http://kulibo.local.statik.be/fonts/FlSaLite.ttf) format('truetype');
        }

        @font-face {
            font-family: 'Flanders Art Sans';
            font-style: normal;
            font-weight: normal;
            src: url(http://kulibo.local.statik.be/fonts/FlSaReg.ttf) format('truetype');
        }

        @font-face {
            font-family: 'Flanders Art Sans Regular';
            font-style: normal;
            font-weight: normal;
            src: url(http://kulibo.local.statik.be/fonts/FlSaReg.ttf) format('truetype');
        }

        @font-face {
            font-family: 'Flanders Art Sans Medium';
            font-style: normal;
            font-weight: normal;
            src: url(http://kulibo.local.statik.be/fonts/FlSaMed.ttf) format('truetype');
        }

        @font-face {
            font-family: 'Flanders Art Sans Bold';
            font-style: normal;
            font-weight: normal;
            src: url(http://kulibo.local.statik.be/fonts/FlSaBold.ttf) format('truetype');
        }

        * {
            font-family: "Flanders Art Sans", serif;
        }

        h1 {
            font-family: "Flanders Art Sans Bold", serif;
        }
</style>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.