Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenType/CFF font is not supported. #1

Closed
Asvel opened this issue Sep 9, 2022 · 0 comments
Closed

OpenType/CFF font is not supported. #1

Asvel opened this issue Sep 9, 2022 · 0 comments

Comments

@Asvel
Copy link
Owner

Asvel commented Sep 9, 2022

The glyph outlines in an OpenType font may be defined in two formats, TrueType or Compact Font Format (CFF), the latter is not supported by this tool, there are two major reasons:

  • Render engines ignore OpenType hmtx table (Horizontal Metrics Table, which specified glyph width and side bearing) for CFF outlines font, because CFF data also contains relevant values and takes higher priority.
    • It can be fixed through changing the defaultWidthX values inside CFF data and hardcoding side bearing into glyphs.
    • CFF2 format does not have this problem as it only contains glyph data.
  • Render engines cannot be tuned to "monospace mode" with CFF outlines font in any way, OS/2.panose.bProportion is ignored, post.isFixedPitch has no effect, even hdmx feature won't help.
    • "monospace mode" is needed to align CJK characters with Latin characters correctly, for example, if a monospaced font is 0.6:1 ratio and displayed at 14px, render engine will render it at width 14*0.6=8.4 round to 8px, and render the aligned CJK characters at width 14*1.2=16.8 round to 17px, alignment will be broken without additional adjustment.
    • Some render engines always enable this adjustment but others are not, they only enable it for fonts with matched property.

Furthermore, I could not find any CFF outlines font aligned correctly under every environment, for a test case, neither Source Han Mono nor Source Han Code JP aligned correctly in WebStorm 2022.2.1(#WS-222.3739.57) under Windows 10 21H2(19044.1889).

PS: If you are trying to fallback to Source Han Sans, there are several third-party TrueType outlines editions such as Source-Han-TrueType and source-han-sans-ttf.

@Asvel Asvel pinned this issue Sep 9, 2022
@Asvel Asvel closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant