Re: [csswg-drafts] [css-fonts] font-variant-numeric: diagonal-fractions, in most fonts, doesn't work with semantic markup (#5756)

It is interesting taking a look at these fonts. 

A number of fonts like `Arial`, `Times New Roman`, and `IBM Plex Sans` seem to implement `frac` as described at [https://ilovetypography.com/OpenType/opentype-features.html]( https://ilovetypography.com/OpenType/opentype-features.html#:~:text=Substitute%20%E2%80%94%20depending%20on%20the%20context). This results in all digits being superscripted unless they follow a `/` in which case they are subscripted (so digits are never left as normal).

Fonts like `Ubuntu Mono` are essentially implementing `frac` as (very) finite set of ligatures. Such fonts should at least make sure these ligatures don't have more digits on either side (not doing so is just a bug in the font).

The `Gimlet` font from the original example does a rather verbose set of chain context matches (GSUB LookupType 6.2) to match the leading digits (essentially writing everything out explicitly in an n^2 way). It implements this out to 10 iterations, so the numerator is limited to 10 digits (any additional digits before the `/` will not be made superscript). It looks like an unlimited number of trailing digits will be made subscript, however.

I'm not sure but maybe fonts could use GSUB LookupType 8.1, though I haven't actually tried that. And this should work with AAT. In any event, many popular fonts don't handle `frac` in a super general way, so it's probably best to discourage non-targeted use.

-- 
GitHub Notification of comment by bungeman
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5756#issuecomment-737354789 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 2 December 2020 16:47:09 UTC