美文网首页
fonttools获取的字体字符数

fonttools获取的字体字符数

作者: 千羽之城88 | 来源:发表于2020-10-31 11:55 被阅读0次

工具

  1. fonttools
  2. gawk
  3. wc

操作

ttx -t cmap "/Users/username/Library/Fonts/FOT-TsukuOldMinPro-R.otf"

# will get the following content
#      <map code="0xfa5d" name="cid14199"/><!-- CJK COMPATIBILITY IDEOGRAPH-FA5D -->
#      <map code="0xfa5e" name="cid14198"/><!-- CJK COMPATIBILITY IDEOGRAPH-FA5E -->
#      <map code="0xfa5f" name="cid13367"/><!-- CJK COMPATIBILITY IDEOGRAPH-FA5F -->
#      <map code="0xfa60" name="cid13331"/><!-- CJK COMPATIBILITY IDEOGRAPH-FA60 -->
#      <map code="0xfa61" name="cid13346"/><!-- CJK COMPATIBILITY IDEOGRAPH-FA61 -->
#      <map code="0xfa62" name="cid13321"/><!-- CJK COMPATIBILITY IDEOGRAPH-FA62 -->
#      <map code="0xfa63" name="cid13339"/><!-- CJK COMPATIBILITY IDEOGRAPH-FA63 -->


cat FOT-TsukuOldMinPro-R.ttx | gawk  'BEGIN{FS="\""}{if($2>"0x2710")printf "%s %s\n",sprintf("%c",strtonum($2)),$4}'

# or

cat FOT-TsukuOldMinPro-R.ttx | gawk -F\" '{if($2>"0x2710")printf "%s %s\n",sprintf("%c",strtonum($2)),$4}'

# will get :

#眞 cid13357
#真 cid13854
#絣 cid14180
#芽 cid13670
#諭 cid14068
#輸 cid14069
#嶲 cid15269

相关文章

网友评论

      本文标题:fonttools获取的字体字符数

      本文链接:https://www.haomeiwen.com/subject/oidsvktx.html