Commit aeb3319
committed
feat: Write CFF private DICT data
[why]
The hinting of CFF (1 and 2) Open Type fonts is usually entirely in
their private DICT data. To preserve the hinting - which is needed to
make the font rendering look good and as expected - the private DICT
data needs to be read and written.
[how]
Parts of the needed code seem to be added already in preparation for
CFF2. I guess there was a misunderstanding or a mixture of versions, but
the private DICT did not change between CFF1 and CFF2, and we need to
always use the PRIVATE_DICT_META_CFF2, the link given in its definition
is the same as given with link [1] for CFF1. See also [2].
So firstly we always refer to 'version 2', as the previous code did also
but only in one case.
For writing the delta values the encoding function is missing and so
that is added. encode.delta() just calls encode.number() repeatedly,
figuratively speaking.
Last but not least the correct private DICT length has to be set.
[1] https://adobe-type-tools.github.io/font-tech-notes/pdfs/5176.CFF.pdf
[2] https://learn.microsoft.com/en-us/typography/opentype/otspec180/cff2#appendixD
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>1 parent 52d167f commit aeb3319
2 files changed
+13
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
490 | | - | |
| 490 | + | |
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
| |||
1283 | 1283 | | |
1284 | 1284 | | |
1285 | 1285 | | |
1286 | | - | |
| 1286 | + | |
1287 | 1287 | | |
1288 | 1288 | | |
1289 | 1289 | | |
| |||
1561 | 1561 | | |
1562 | 1562 | | |
1563 | 1563 | | |
1564 | | - | |
| 1564 | + | |
1565 | 1565 | | |
1566 | | - | |
1567 | 1566 | | |
1568 | 1567 | | |
1569 | 1568 | | |
| |||
1607 | 1606 | | |
1608 | 1607 | | |
1609 | 1608 | | |
1610 | | - | |
| 1609 | + | |
1611 | 1610 | | |
1612 | 1611 | | |
1613 | 1612 | | |
| |||
1627 | 1626 | | |
1628 | 1627 | | |
1629 | 1628 | | |
1630 | | - | |
| 1629 | + | |
1631 | 1630 | | |
1632 | 1631 | | |
1633 | 1632 | | |
| |||
1643 | 1642 | | |
1644 | 1643 | | |
1645 | 1644 | | |
| 1645 | + | |
1646 | 1646 | | |
1647 | 1647 | | |
1648 | 1648 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
855 | 855 | | |
856 | 856 | | |
857 | 857 | | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
858 | 865 | | |
859 | 866 | | |
860 | 867 | | |
| |||
0 commit comments