diff options
Diffstat (limited to 'Master/texmf-dist/doc/fonts/xits/postprocess.py')
-rwxr-xr-x | Master/texmf-dist/doc/fonts/xits/postprocess.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/fonts/xits/postprocess.py b/Master/texmf-dist/doc/fonts/xits/postprocess.py new file mode 100755 index 00000000000..af04a5fd7c2 --- /dev/null +++ b/Master/texmf-dist/doc/fonts/xits/postprocess.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +import sys +import warnings +from fontTools import ttLib + +# suppress noisy DeprecationWarnings in fontTools +warnings.filterwarnings("ignore",category=DeprecationWarning) + +font = ttLib.TTFont(sys.argv[1]) + +MS_Platform_ID = 3 +MS_Enc_ID = 1 +MS_Lang_US_ID = 0x409 + +FullName_ID = 4 + +name = font["name"] +cff = font["CFF "] + +psname = cff.cff.fontNames[0] + +# set MS full name to psname +# per name table spec +fullname = name.getName(FullName_ID, MS_Platform_ID, MS_Enc_ID, MS_Lang_US_ID) +fullname.string = psname.encode("utf_16_be") + +font.save(sys.argv[1] + ".post") |