How can one find the Unicode codepoints that a font has glyphs for, on a Debian-based system?

后端 未结 2 712
不知归路
不知归路 2021-01-11 18:01

From a scripting language (Python or Ruby, say) on a Debian-based system, I would like to find either one of:

  1. All the Unicode codepoints that a particular font
2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-11 18:59

    I've recently listed the mapping from unicode codepoints to glypths in a TTF using TTX/FontTools. That tool is written in Python, so it matches the Python tag in your post. The command

    ttx -t cmap foo.ttf
    

    will generate an XML file foo.ttx which describes that mapping, for various environments and encodings. See e.g. this reference for a description of what the platform and encoding identifiers actually mean. I assume that the package can be used as a library as well as a command line tool, but I have no experience there.

提交回复
热议问题