-
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:
|
The original intent for the usWin setting for this approach is actually mentioned in my proposal to update the metrics in googlefonts/googlefonts.github.io#135 and not what is listed in the current table, which is to take the highest point excluding extra-tall characters for vertical typesetting and harmonised across weight. The proposed setting is to just take the yMin/yMax for usWin, which for newer C/J fonts will almost always mean stuck at around 1300/-600 due to the presence of either U+3031 〱/ U+3032 〲/ vertical glyph for U+2E3A ——. These glyphs should not be considered when calculating the horizontal clipping metrics for usWin.
Although a viable solution, Latin vertical metrics actually considered the possibility of extra-height glyphs in font:
However, the new proposal for C/J fonts here did not take into account of the possibility of stacked diacritics in C/J fonts. This has actually been considered in the original metrics, quote from my proposal to update metrics:
It's just mistakenly reworded to be "Set to look comfortable" in the current requirements. The extra-tall looking metrics show in example for Source Han Sans is actually due to another rule that is present in Latin metric requirements too:
In Source Han Sans' case, that is mostly due to stacked diacritics for hanyu pinyin (Ǜ) and Vietnamese (Ẫ) in Heavy weight. This should probably be considered in C/J fonts too. |
TL;DR: The current metrics seems to go against the current C/J font industry convention, which will cause issues in the long run especially incompatibility with commercial C/J fonts. A bettter vertical metrics wording/clarification update for C/J (instead of a full reworking) is proposed in googlefonts/googlefonts.github.io#135 . |
@celestialphineas @rutopio Thank you for sharing the approaches that you are familiar with. Interestingly, neither aligns with the existing GF requirements, only further serving to underscore the need to update these requirements :). Out of interest, are either of you familiar with any apps (aside from Adobe) that make use of the
Interesting. I will reach out to my contacts over in Office and find out how this is set.
We can certainly provide further clarification on this point. The Latin guidelines use a specific glyph (Ắ) and state that the I'm fine with implementing something similar here with an appropriate corresponding glyph which we can discuss. My thought was to use the em-box as a guideline since the ideographs are prioritized in these projects.
The method I suggested was attempting to optimize more for keeping the ideographs centered on the body—so it is based on the existing em-square rather than following the guidance for Latin, which is optimizing for ensuring that there will not be any vertical collisions with stacked diacritics. In the case of WenKai, that means the
All the more reason to use
If we divorce the setting of line height metrics from clipping metrics, then we can enable complete rendering of glyphs such as In re-reading these guidelines, I find it sort of interesting that the 'conventional' approach here doesn't even align with the spec recommendations—the |
The
We haven't found an application be directly affected, as there are few applications that need to know the body em-box of a CJK font, which unfortunately means that many CJK typography requirements cannot be met. However, it does affect many scripts when we need to determine the body em-box, whether in Glyphs or in Python with PIL, since a lot of SC/TC fonts do not even have their |
@celestialphineas Thank you for the further information! Fascinating that font 2 and 3 have While I realize it would likely be irritating to you to need to update your scripts away from |
I'd certainly be happy to follow The only trouble is that legacy SC/TC fonts are a total mess to deal with, and I also wonder how urgent the cross-platform rendering impact of aligning I personally (but also practically) care much more about the behavior in Adobe applications, and therefore our foundry usually follows the Adobe convention, not necessarily the convention of Source Han, but sometimes also Adobe Heiti Std as an example. Things become even easier to us when the Latin part of a font is aligned to Another factor worth noting is the actual C/J typesetting requirements for line height/gap, are considered and determined based on a fixed point size of the body em-box. A "default" line height defined by the font does not make much sense in C/J typesetting. We usually expect typeface style changes without causing dramatic overall layout changes when switching fonts in professional typesetting scenarios (and that's also why MS Word is so confusing). |
Yeah, totally understand you on that. My hope is that once the fonts have been "processed" by the onboarder to ensure alignment with the GF standard, that a lot of the mess will have been resolved, so it'll be easier for everyone :).
Yeah, MS Word does make things complex. When
That's helpful to know. I think for GF, we are looking to achieve improved rendering in a wider range of environments vs just Adobe, so we have to account for the more "default" approaches implemented in web browsers / text processors / etc.
Thanks for the references. The note you pointed out, though, indicates that the lineGap is "commonly set" between 50% and 100% of the height of the character frame. That's a pretty wide range!
|
I think If we set The real line height should be determined by the users, not predefined in the font metrics. |
The current metrics can do the same thing too, albeit a bit too limiting (quite loosened in googlefonts/googlefonts.github.io#135). As you have mentioned it is only 90 units below, it would make more sense if the default line height metrics could just show the character at full height instead of having users to adjust it manually. Clipping should not happen at all in these cases, especially since it might involve displaying of names and loss of information. The convention of setting
Another issue that comes up is what even is considered as "too-loose" or "too-tight". The usual convention for C/J typesetting is at least 1.5 to 2em of line height, but the proposed metrics introduced an abritrary value of 15–20% that is up to the personal preference of font designers. The proposal metrics could very well be viewed as "too-tight" for some end users. Given that line height will almost certainly be changed by web designers in the end, it would be better to leave the CJK metrics as-is, instead of enforcing extra height in the source font files. Also if you view the Latin metrics part, would you say the current GF Latin metrics will end up with too-loose typesetting? It is similar to what CJK fonts have right now. A comparison of LXGW WenKai TC set according to the simpler proposal (loosened version of what GF has currently) at googlefonts/googlefonts.github.io#135 would be nice too, which is easier to calculate than the current proposal (just take the highest glyph or |
In the last version of Iansui, |
Note that pinyin is mandatory in GB 2312 (although only lowercase, one of GF Fontbakery check requires uppercase equivalent to be in the font so it should be filled in anyway) and present in Adobe-Japan1-6.
Given that there is still some programs (e.g. Microsoft Word) that treats sTypo as a clipping metrics, it would be better that if sTypo is enabled, it should include hanyu pinyin at the minimum least. |
Also of note from Microsoft Docs in full:
which mentions that if sTypo is to be set away from the em-box, then the BASE table bottom/top edges should match sTypo too. |
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: