If you convert OTF font like SourceHanSans to TTF using fontforge or Glyphs, the cmap table in the converted ttf font is incorrect. The cmap table in these fonts maps some glyphs to multiple code, but the cmap in the converted ttf maps one glyph to one code.
process-cmap.rb
fixes this.
- Ruby 1.9 or above
- ruby bundler
gem install bundler
- ttx :
- from AFDKO
- from fonttools
- Optional : fontforge or Glyphs to convert otf to ttf.
bundle install
fontforge -script otf-to-ttf.sh [original otf font]
bundle exec ruby process-cmap.rb [original otf font]
Fixed font will be generated in the cmap_modified
directory.
https://skoji.jp/blog/2020/03/otf-to-ttf.html (in Japanese)