Skip to content

[css-inline] Define how to synthesize ideographic-over and ideographic-under #10850

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

Open
kojiishi opened this issue Sep 7, 2024 · 6 comments
Labels
css-inline-3 Current Work i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. topic: text edge control

Comments

@kojiishi
Copy link
Contributor

kojiishi commented Sep 7, 2024

The text-box-edge property has text-edge as its value.

It defines that:

Which goes to these definitions:

  • ideographic-over: Corresponds to the line-over design edge of CJK (Han/Hangul/Kana) text. Assigned to idtp in OpenType.
  • ideographic-under: Corresponds to the line-under design edge of CJK (Han/Hangul/Kana) text. Assigned to ideo in OpenType.
  • ideographic-ink-over: Corresponds to the line-over ink edge of CJK (Han/Hangul/Kana) text. Assigned to icft in OpenType.
  • ideographic-ink-under: Corresponds to the line-under ink edge of CJK (Han/Hangul/Kana) text. Assigned icfb in OpenType.

Questions:

  1. Most fonts, including many CJK fonts, don't have these tables. How should this be synthesized when these are missing?
  2. When the first font in the cascade doesn't have these tables but the second one does, should UA synthesize from the first font, or use the table from the second font?

@fantasai @nt1m @vitorroriz @Clqsin45 @bfgeek @jfkthame @kidayasuo @xfq

@nt1m
Copy link
Member

nt1m commented Sep 7, 2024

cc @alanbaradlay who implemented this in WebKit. Maybe he can help answer?

@fantasai
Copy link
Collaborator

This is currently defined in https://www.w3.org/TR/css-inline-3/#baseline-synthesis ; though if it needs some improvement, we can improve it.

CC @MurakamiShinyu

@kojiishi
Copy link
Contributor Author

kojiishi commented Sep 13, 2024

This is currently defined in https://www.w3.org/TR/css-inline-3/#baseline-synthesis ; though if it needs some improvement, we can improve it.

Thank you for the pointer, I didn't know the section. I read it, but I'm not sure if I understand the algorithm in this section. Can you help?

  1. The central baseline is defined to be halfway between the ideographic-over and ideographic-under baselines, so any two of these determines the third.

and the central baseline:

Corresponds to the ideographic central baseline, halfway between the ideographic-under and ideographic-over baselines. Assigned to bsln value 1 in TrueType AAT.

Am I reading this correctly that this is defined from each other? I'm having difficulty to understand what it suggests when all of them are missing. If it means to fallback to the item 3:

  1. In CJK fonts the ascent and descent typically match the ideographic-over and ideographic-under baselines, so can be used as a fallback when both are missing.

Is this suggesting to use ascent/descent as the synthesized ideographic-over and ideographic-under? For text-box-trim, using ascent/descent means that it's the same as text. This Japanese article and another Japanese article indicates that using ascent/descent doesn't help for the vertical centering and alignment purposes for CJK fonts. For Meiryo, Hiragino, and Noto (Chrome/Firefox/Safari default Japanese fonts), ascent/descent don't match the desired position of ideographic-over and ideographic-under, and I'm failing to read what to do when ascent/descent don't match.

@jfkthame
Copy link
Contributor

jfkthame commented Sep 26, 2024

My thoughts on the two original questions here:

  1. Most fonts, including many CJK fonts, don't have these tables. How should this be synthesized when these are missing?

From metrics present in the first available font (as described in css-inline).

(I think synthesizing by measuring the actual bounds of specific glyphs would problematic for a couple of reasons: the results may be poor for more ornately-styled fonts that do not have such "regular" glyph shapes as a standard Gothic or similar face; and because of the potential interaction with font subsetting, which will be confusing/unpredictable for authors.)

  1. When the first font in the cascade doesn't have these tables but the second one does, should UA synthesize from the first font, or use the table from the second font?

From the first font. For predictable behavior, these layout metrics should be consistently derived from the primary font specified by the author, not dependent on what fonts happen to be present later in the cascade.

@xfq xfq added the i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. label Jan 16, 2025
@kidayasuo
Copy link

Feedback from JLReq TF Meeting on 1/28/2025

For idtp/ideo:
The cap height of Latin glyphs within a CJK font is usually vertically centered within the ideographic em-box. This provides a way to determine the baseline position within the em-box.

For icft/icfb:
One suggestion was to use a representative glyph and derive estimated values for icft/icfb based on its bounding box. We are currently awaiting recommendations from font makers regarding the appropriate representative glyph.

It goes without saying that these values must be calculated based on the first CJK font in the font list because the first font in the list is typically chosen based on the author’s intent for Latin glyphs rather than CJK text. This remains true even in cases where CJK is the primary script in an internationalized environment.

Does this answer your questions?

@kidayasuo
Copy link

kidayasuo commented Feb 4, 2025

I received a response from a font designer regarding possible representative glyphs for estimating icft/icfb.

Characters with many strokes tend to have less flexibility in stroke placement, bringing their boundaries closer to the limits of the font’s design space. Because of this, characters with many strokes are better representative glyphs for estimating icft/icfb.

Additionally, rightward sweeps on the right or leftward sweeps on the left often extend beyond the design space (e.g., 東 or 水), so they are best avoided. As a result, he recommended the following characters:

輩, 鬱, 酬, 湖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-inline-3 Current Work i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. topic: text edge control
Projects
None yet
Development

No branches or pull requests

6 participants