-
Notifications
You must be signed in to change notification settings - Fork 661
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
[css-fonts-5] Add "font-synthesis: super" #7441
Comments
I definitely agree that one of the underlying issues you raise here -- that |
Calling it So, just sketching out what this might look like:
This property controls whether user agents are allowed to synthesize superscript and subscript glyphs when a font lacks them. auto Also, this would be added to the
|
Also just for the record, pointing out that it says is allowed not is required. Same as |
I agree with @dbaron that lack of feature detection is a problem for use of Two questions:
|
|
What do you mean ? It should be happening, or it should be possible to test? Yes, it can't be guaranteed that synthesis will be used by testing for positive support. But it would be useful if there was a way to identify that the UA has no support for synthesis, so it's not going to be there whichever way. Then the stylesheet could ensure that a font with the respective OpenType features is used, or otherwise |
Should be possible to test |
That's quite problematic in this case, because the whole point here would be to detect if super/sub glyphs are guaranteed to be used or not. Why is is allowed rather than required? If this is because you should either get it from the font if available or synthesize, rather than always synthesize, then we should say that explicitly, because in that case, doing neither isn't actually intended. Or we we actually mean that it's ok with the |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> Topic: font-synthesis: super<fantasai> github: https://github.com//issues/7441 <fantasai> astearns: jfkthame, can you take this one? <fantasai> jfkthame: I agree there's a problem here, but unsure whta exactly is being proposed as a way forward <fantasai> jfkthame: crux seems to be that it's not possible to tell whether superscript/subscript glyphs will be synthesized or not if unavailable <fantasai> jfkthame: adding 'font-synthesis-position' doesn't solve the real problem here <fantasai> fantasai: can you outline the problem? <fantasai> jfkthame: font-variant-position is supposed to apply superscript/subscript font features if available <fantasai> jfkthame: spec suggests that a browser may synthesize reduced+shifted glyphs if the OT feature doesn't actually support the characters that are present <fantasai> jfkthame: a lot of fonts only have support for a small minority of characters <fantasai> jfkthame: but whether the browser will or won't do synthesis is left up to the implementation <fantasai> jfkthame: which means authors can't use font-variant-position because you won't know if it has an effect or not <astearns> ack dbaron <fantasai> dbaron: I think maybe the idea I was thinking at the time was, if we had font-synthesis-position <fantasai> dbaron: then an engine that supported synthesis would support that value of font-synthesis <fantasai> dbaron: and therefore you could use @supports to detect whether synthesis was supported <fantasai> dbaron: whereas engine that didn't support synthesis of super/subscripts wouldn't support that value of font-synthesis because nothing to control <fantasai> dbaron: since synthesis wasn't supported in the first place <fantasai> dbaron: that way you can use @supports queries to detect synthesis support for font-variant <fantasai> dbaron: through the addition of a font-synthesis value that controlled it <florian> q+ <fantasai> This makes sense to me, fwiw. <fantasai> astearns: So if you're using super/subscript for semantic purposes <fantasai> astearns: you could check whether font-synthesis-position is supported <fantasai> astearns: and know that it's OK to use it, because there will be fallback synthesis that will preserve semantics <fantasai> astearns: but if not there, you know that you need to fiddle with the glyphs yourself to make sure the semantic meaning is preserved <astearns> ack florian <fantasai> florian: Minor related point, for this proposal of dbaron's to be reliable <fantasai> florian: we need a tweak to the text <fantasai> florian: currently we say that the browser "should" synthesize, we need to take it to "must" <fantasai> florian: can't allow a UA to do it *sometimes* <fantasai> florian: but I support dbaron's proposal <fantasai> dbaron: it doesn't help for engines that already support synthesis but don't support the new value <fantasai> dbaron: e.g. Gecko already does the synthesis, can't detect it right now <fantasai> dbaron: but Gecko could implement this, which would make synthesis detectable <fantasai> astearns: jfkthame, thoughts? <fantasai> jfkthame: I think that seems reasonable <fantasai> jfkthame: I think it would be nice to see a proposed spec wording <fantasai> jfkthame: to make it explicit as to what happens <fantasai> jfkthame: but I don't have any problem in principle with this way forward <fantasai> -> https://github.com//issues/7441#issuecomment-1444461111 <TabAtkins> fantasai: I don't htink the specific wording is that complex <astearns> ack fantasai <TabAtkins> fantasai: Chris outlined the exact text we'd add <TabAtkins> fantasai: The only thing we need ot make clear is if we support this property, you *will* perform synthesis for font-variant-position when it's needed. You don't have the option to not do it. <TabAtkins> fantasai: Taht's all we need to add to make this work. <emilio> fantasai: we'd add another prop and another value to the shorthand, and UAs must support it <emilio> ... if they implement that prop <fantasai> florian: Given backlog of edits, I think we can resolve on it, and if anyone is unhappy they can say so before the edit lands <fantasai> astearns: Does that work? <fantasai> jfkthame: sounds fine <fantasai> jfkthame: main change in Chris's comment, 'auto' value means synthesis is *allowed* and instead we'd say is *required* if glyphs are missing <fantasai> astearns: so playing out the future where we have an engine that does super/subscript synthesis now <fantasai> astearns: decides they don't want to do synthesis anymore, they drop the property? <fantasai> florian: yes <fantasai> chrishtr: so spec would require synthesis <fantasai> chrishtr: so chrome would no longer be spec compliant? <fantasai> fantasai: No, you're mixing up font-variant-position and font-synthesis-position <fantasai> chrishtr: so new thing to solve this issue <fantasai> dbaron: we define the property so that it's not mandatory to implement, but if you implement has to correspond to this other feature <fantasai> florian: nothing's ever mandatory in CSS, but if you implement `font-synthesis-position`, you must implement font synthesis <fantasai> chrishtr: did drott's comments get answered in the issue? <fantasai> astearns: ... <fantasai> chrishtr: only applies to font-variant-position? <fantasai> florian: UA stylesheet uses different things to simulate superscripts and subscripts, so conceptually related but technically not <fantasai> florian: you can override that in CSS, but unless you do that, not relevant <fantasai> chrishtr: Second question was about feature detection <fantasai> fantasai: we're enabling feature detection by adding this property <fantasai> @supports (font-synthesis: position) { ... do stuff with font-variant-position here ... } <fantasai> chrishtr: so if we resolve to add this, then Gecko because they do synthesis, they ship this property <fantasai> chrishtr: then developers would be able to reliably condition use of font-variant-position on support for font-synthesis-position <fantasai> chrishtr: so can do it reliably or not <fantasai> fantasai: yes, exactly <fantasai> chrishtr: OK! seems fine to me, thanks for walking me through it <fantasai> astearns: proposed resolution is to accept Chris's formulation of font-synthesis-position, but make it so that 'auto' forces synthesis intead of making it allowed <fantasai> chrishtr: that would resolve Florian's comment at the end of the issue? <fantasai> florian: correct <fantasai> astearns: you're looking to preserve meaning, so you know that the syntax will be reliable <fantasai> s/syntax/feature/ <fantasai> astearns: OK, any objection to proposed resolution? <fantasai> RESOLVED: Add font-synthesis-position as defined in https://github.com//issues/7441#issuecomment-1444461111 except 'auto' means synthesis is required (not merely allowed) <fantasai> astearns: Anything else on this one? |
Just FTR, I noticed when re-reading the spec for
which means the existing implementations that don't synthesis are actually non-compliant. (In Gecko bug https://bugzilla.mozilla.org/show_bug.cgi?id=1849010, I'm currently implementing |
Also FTR, the "Status of the Specification" section of the specification lists synthesis in font-variant-position as "at-risk". |
CSS fonts 4 has this:
Which is nice, but it's currently implemented in Gecko only. The spec also marks this as "at risk".
This means
font-variant-position
is a bit useless - as it may or may not generate superscript, everyone just usesfont-size
andvertical-align
instead which is guaranteed to work cross-browser, even if it's not as nice typographically.Ideally all platforms would implement it, but an alternative would be: add
font-synthesis: super
to control whether this substitution takes place, and have it set by default. My presumption is this would be pretty easy to implement.More useful than turning it off is checking for whether it's supported. This would make
font-variant-position
safe to use in a cross-browser way.Technically it applies to subscript too, so could be
font-synthesis: position
?The text was updated successfully, but these errors were encountered: