-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
C/J vertical metrics requirements #8911
Comments
@tiroj you might be interested in this :) |
Regarding Risk 1, I would like to mention that: The majority of SC/TC vendors never write a To my knowledge, the nowadays common practice of foundries in China mainland is as follows:
|
Our usual approach:
|
Over the years, Google has established clear guidance for setting font vertical metrics to ensure consistent rendering across a variety of environments (with web as a particular focus).
As a short summary, this guidance makes use of the two core vertical metric values,
sTypo
(sTypoAscender / sTypoDescender / sTypoLineGap) to establish typographic metrics (which are set for ideal line height for reading) in conjunction withusWin
(usWinAscent / usWinDescent) to establish clipping metrics (where MS Word will not display any glyph paint that extends beyond these metrics), and setting theUSE_TYPO_METRICS
flag to ensure that they are used for such. Thehhea
metrics follow the sTypo (as theUSE_TYPO_METRICS
flag is set) values for consistency on Mac. If you need further explanation of these metrics and how to set them, I suggest reading the spec at the link above.Interestingly, where the metrics requirements are responsive to the design of the typeface, in the case of CJK they are locked to specific values based on the metrics established by Ken Lunde for the Source Han Sans / Noto CJK project:
In this case, since the
USE_TYPO_METRICS
flag is disabled, theusWin
metrics act as both typographic vertical metrics and also clipping metrics.The setting for the
sTypo
values is of particular note, and comes from the MS OpenType Spec requirements for the sTypo values of CJK fonts.There are several problems with this approach.
usWin
metrics are not reflective of what is in the font. Like (1), the design of a given font can differ quite significantly, so by setting theusWin
metrics to specific values instead of being responsive to the design, the metric might be too small to avoid clipping, or excessively large for the design.USE_TYPO_METRICS
is disabled, thenusWin
metrics are used for default line-spacing when displaying the font on the browser, and in applications like MS Word. And sinceusWin
metrics are primarily a clipping metric, then in most cases the line-gap will likely be too big for a given design. There are even complaints about this for Source Han Sans / Noto Sans CJK.The BASE table
Stepping back from the guidance in the MS OT Spec, Ken Lunde, and Google’s specification, these requirements raise some key questions:
USE_TYPO_METRICS
is disabled, why does settingsTypo
metrics matter?sTypo
/USE_TYPO_METRICS
in the same way as in non-CJK fonts to establish ideal default line spacing?On this subject the OT Spec directs readers to Baseline tags and to the BASE table. The BASE table is part of the OpenType code of a font that provides information regarding the ideographic-em-box. Below is a sample of the ideographic-em-box and the corresponding BASE table.
The BASE tags above are:
These BASE tags provide language-specific metrics data that may be used for typesetting purposes, such as to enable better cross-script alignment. However, in cases where a font does not include a BASE table and an application needs to define the ideographic-em-box for rendering purposes, there is specific logic laid out in the OT spec wherein the typoMetrics are used as a fallback:
Because of this fallback logic, the OT Spec recommends that the
sTypo
andhhea
metrics align with the BASE table to ensure consistency:A new direction forward for C/J vertical metrics
This appropriation of the
sTypo
leaves us in a quandary. In order to ensure compatibility with “some” applications and legacy environments, it is required to keep thesTypo
aligned with the ideographic em-box. However, doing so removes our capability to set the vertical metrics apart from the clipping metrics.Interestingly, the OT spec seems to predict this predicament:
To that end, I would like to propose a new approach for C/J fonts. For the
sTypo
, we use the ideographic em-box as a reference guide, and scale it up proportionally, similar to how Latin treats the ascender / descender values.hhea
will follow thesTypo
, andusWin
will continue to align with yMin and yMax. Finally, an accurately-set BASE table will be required to enable applications that need ideographic information to position the glyphs correctly.Taking LXGW WenKai TC as an example:
(note – in this case, I used a 18% increase on the sTypoMetrics to follow the suggestion of the original designer)
The result of this approach, in MS Word for Mac:
As you can see, this change has produced significantly less space between the lines as the overall line height (ascender+descender) has reduced from 1317 to 1180. It helps the text hold together better, and read more comfortably than previously.
Open Questions
vhea
/vmtx
table are not present, that the sTypo values may used as a fallback when setting text vertically. It would be worth investigating if this use is widespread, and if so, then addition of these vertical-specific tables should be recommended for C/J fonts, and required for any that are intended for vertical use.Risks
sTypo
metrics for ideographic-based positioning will find that any font employing the above method are no longer positioned as expected. I believe this is primarily a legacy issue, but worth noting.Priority
This is a high priority issue that needs resolution as it is currently preventing immediate onboarding for many Traditional Chinese fonts:
And will prevent onboarding of these upcoming Chinese projects as well
Additionally, we have two upcoming Japanese and three Korean projects which will also be impacted.
The text was updated successfully, but these errors were encountered: