How to generate fonts
Posted by
chloerei on
URL: https://discuss.asciidoctor.org/How-to-generate-fonts-tp2358.html
I'm using asciidoctor-pdf, and I want to render a document write in CJK charsets, so I need to add a CJK font in theme.
I have read
https://github.com/asciidoctor/asciidoctor-epub3/blob/master/scripts/generate-font-subsets.pe , it looks complex than I think.
I don't need subsets, so I use this script to convert Noto CJK font from OTF to TTF:
[source]
----
#!/usr/bin/env fontforge
Open($1)
Generate($1:r + ".ttf")
----
But it drops the CJK, how to convert all fonts?
And I found I must convert four styles(normal, bold, italic, bold_italic) for each fonts. Could you release a more simple script to convert a font to four styles without subsets? It works like:
[source]
----
$ generate-font NotoSansCJKsc-Regular.otf
Genrating...
NotoSansCJKsc-Regular-Regular.ttf
NotoSansCJKsc-Regular-Bold.ttf
NotoSansCJKsc-Regular-Italic.ttf
NotoSansCJKsc-Regular-BoldItalic.ttf
----
This example look duplicate with regular and bold, because Noto CJK has release different weight, but it's useful for some font only have one weight(like DroidFallback).
I don't konw font format's detail, so I probably misunderstood, it it possible?