Commit aea28e5
committed
cff: Implement private DICT reading and writing for CFF and CFF2
[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.
The OtherBlues and FamilyOtherBlues operators must occur
after the BlueValues and FamilyBlues operators, respectively.
This is implicitely guaranteed by the way the private DICT is
set up and finally Object.keys() works.
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 a47a5f3 commit aea28e5
2 files changed
+13
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
491 | | - | |
| 491 | + | |
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
| |||
1284 | 1284 | | |
1285 | 1285 | | |
1286 | 1286 | | |
1287 | | - | |
| 1287 | + | |
1288 | 1288 | | |
1289 | 1289 | | |
1290 | 1290 | | |
| |||
1562 | 1562 | | |
1563 | 1563 | | |
1564 | 1564 | | |
1565 | | - | |
| 1565 | + | |
1566 | 1566 | | |
1567 | | - | |
1568 | 1567 | | |
1569 | 1568 | | |
1570 | 1569 | | |
| |||
1608 | 1607 | | |
1609 | 1608 | | |
1610 | 1609 | | |
1611 | | - | |
| 1610 | + | |
1612 | 1611 | | |
1613 | 1612 | | |
1614 | 1613 | | |
| |||
1628 | 1627 | | |
1629 | 1628 | | |
1630 | 1629 | | |
1631 | | - | |
| 1630 | + | |
1632 | 1631 | | |
1633 | 1632 | | |
1634 | 1633 | | |
| |||
1644 | 1643 | | |
1645 | 1644 | | |
1646 | 1645 | | |
| 1646 | + | |
1647 | 1647 | | |
1648 | 1648 | | |
1649 | 1649 | | |
| |||
| 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