Created
December 31, 2014 09:53
-
-
Save mojavelinux/c74162d44ca77d1a7c25 to your computer and use it in GitHub Desktop.
Distill the NotoSansCJK otf fonts into something we can use in Asciidoctor PDF (and Asciidoctor EPUB3)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fontforge | |
# * 0x90 - Neither OpenType or Apple | |
# * 0x800 - Generate old-style 'kern' table | |
# * 0x08 - Exclude TrueType instructions | |
# For PDF | |
genflags = 0x90 + 0x08 + 0x800 | |
# For EPUB3 | |
#genflags = 0x90 + 0x08 | |
src_file = $1 | |
dst_file = $1:r + ".ttf" | |
Open(src_file) | |
CIDFlatten() | |
SelectAll() | |
ClearInstrs() | |
SelectNone() | |
# Remove glyphs we'll later truncate to get under glyph limit | |
SelectMore(0u1f190,0u1f199) | |
Clear() | |
SelectNone() | |
Generate(dst_file, "", genflags) | |
Close() | |
Open(dst_file) | |
# Add missing space glyph | |
Select(0u00a0) | |
Copy() | |
Select(0u0020) | |
Paste() | |
SetWidth(0) | |
SelectNone() | |
# select lesser range of glyphs | |
SelectMore(0u0020,0uffee) | |
SelectInvert() | |
Clear() | |
SelectNone() | |
Generate(dst_file, "", genflags) | |
Close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment