How are underlines positioned in Indic text?
r12a opened this issue · 5 comments
CSS and browser implementers are looking for information about how to position underlines for various scripts, especially for Indic scripts. Can we provide them with the information they need (and add it to the layout requirements doc)? See w3c/csswg-drafts#459 (comment)
A few thoughts on this:
- Ideally, underline position and thickness should be defined at the font level, with CSS only providing fallback default behaviour. There are, however, some issues with this:
- a) In OpenType fonts, values for underlinePosition and underlineThickness are stored in the 'post' table. There is one pair of values for the whole font, regardless of how many different scripts are supported, and currently no way to specify different values for different scripts or language (writing) systems.
- b) font tools tend to provide a default setting for these two values, and a lot of font makers appear not to alter the default setting, with the result that the data may not produce best results.
I think both of these issues could be addressed by defining localisable underline thickness and position values, probably as an extension of the existing but little-used 'BASE' table. This would not only provide layout software with appropriate values for different scripts and writing systems, but the newly defined data structure may well encourage font developers (and font tool makers) to pay more attention to this aspect of font production. This could also assist CSS in determining whether the font data is reliable.
[These comments also apply to the strikethrough height and thickness values, currently implemented in the 'OS/2' table, and similarly under-localised.]
- A lot of writing systems have conjunct forms, below marks, and/or vertical stacks that cut through the height of an underline. In addition to determining the appropriate height and thickness of underlines, it is also desirable to determine the preferred behaviour of underlining with descending glyphs, which might also differ depending on writing system.
This is complicated by the fact that the depth of a given sequence of characters in a complex script is font-dependent, and cannot be determined or even reliably guessed at from the character string.
John, i think it would be best to move the above comment to the discussion at w3c/csswg-drafts#459
Btw, note that CSS already attempts to address the need to avoid the underline running through ink below the baseline. https://drafts.csswg.org/css-text-decor-3/#text-decoration-skip-property
btw @tiroj this question was particularly about how to determine the position of an underline relative to the text, but your comment mentions two other topics related to underlines: (a) how to get the right thickness, and (b) how to skip parts of characters that would interfere with the underline. Here are some relevant CSS links:
(a) w3c/csswg-drafts#239 (and parts of w3c/csswg-drafts#459)
(b) https://drafts.csswg.org/css-text-decor-3/#text-decoration-skip-property - there are also some issues at https://github.com/w3c/csswg-drafts/issues?utf8=%E2%9C%93&q=skip
I'd suggest that the link at the top of the page w3c/csswg-drafts#459 is probably best restricted to discussion of the distance of the underline from the text.
Underlines for Indic scripts don't have notable special behaviors compared to Latin ones, besides the common hopes (between Indic and Latin) of skipping descenders (text-decoration-skip
) and adjusting the vertical position (*text-underline-offset
).
The so-called "hanging baseline" is not relevant here.