> Is there a way to feature detect the synthesis functionality or not? How
> a web author will be able to differentiate between Gecko vs
> Chromium/WebKit behaviors? Would the lack of this feature confuse
> authors? Maybe having some console message information when
> font-variant-position doesn't have any effect due to missing synthesis
> functionality, dunno if that makes sense.
> 
> Do we have an use counter for the cases where we're not using
> synthesized glyphs due to lack of functionality? So we can track how
> common that situation is and understand the priority of such feature in
> the future.
 
I’m not sure I completely understand your question, but I suppose 
identifying cases when the feature is requested and the font does not have 
subscript/superscript glyphs might not be possible since we perform the 
checking of the font features in the shaping stage in Harfbuzz and we check 
different fonts in the shaping process without knowing what font will be 
finally used in the page. So, for example, we can trigger on some system 
font that does not have sub/superscript glyphs (so this glyphs should be 
synthesised) however, in the end, this font won’t be used in the page but a 
different web font will be used instead.  

One of the ways to detect whether a font has super/subscript glyphs is to 
check whether the font with the feature has loaded (using document.fonts 
for instance) and if it did then we won’t synthesise.
> I'm curious how this relates to the "old" way of doing superscript. If I 
understand correctly (and I might not!), then x<span 
style="font-variant-position: super">2</span> will render as "x²", somehow 
finding > the "super" variant of 2 in the font? The old way of doing this 
would be with x<span style="vertical-align: super; font-size: 
0.83em">2</span> which will use the normal glyph for 2, but smaller and 
differently > positioned?

Not exactly, vertical-align always does synthesis, so even if the font has 
subscript or superscript opentype features vertical-align would still 
synthesize the glyphs. The old way of activation superscript/subscript is 
through font-feature-settings, i.e. setting it to “sups” or ”subs”.  

On Wednesday, February 15, 2023 at 6:08:20 PM UTC+1 Daniel Bratell wrote:

> I'm curious how this relates to the "old" way of doing superscript.
>
> If I understand correctly (and I might not!), then
>
> x<span style="font-variant-position: super">2</span>
>
> will render as "x²", somehow finding the "super" variant of 2 in the font?
>
> The old way of doing this would be with
>
> x<span style="vertical-align: super; font-size: 0.83em">2</span>
>
> which will use the normal glyph for 2, but smaller and differently 
> positioned?
>
> /Daniel
>
> On 2023-02-14 22:26, Manuel Rego Casasnovas wrote:
> > Is there a way to feature detect the synthesis functionality or not? How
> > a web author will be able to differentiate between Gecko vs
> > Chromium/WebKit behaviors? Would the lack of this feature confuse
> > authors? Maybe having some console message information when
> > font-variant-position doesn't have any effect due to missing synthesis
> > functionality, dunno if that makes sense.
> >
> > Do we have an use counter for the cases where we're not using
> > synthesized glyphs due to lack of functionality? So we can track how
> > common is that situation and understand the priority of such feature in
> > the future.
> >
> > Cheers,
> > Rego
> >
> > On 14/02/2023 17:08, Philip Jägenstedt wrote:
> >> I will recuse myself from this one since I have an interest in the
> >> success of Interop 2022 (and 2023), but I think shipping this makes
> >> sense. Chrome is the last browser to not support it at all, and we've
> >> seen with other features that the time it becomes available in all
> >> browsers can be an inflection point in usage.
> >>
> >> On Tue, Feb 14, 2023 at 4:56 PM 'Munira Tursunova' via blink-dev
> >> <blin...@chromium.org <mailto:blin...@chromium.org>> wrote:
> >>
> >>
> >> Contact emails
> >>
> >> moo...@google.com <mailto:moo...@google.com>, dr...@google.com
> >> <mailto:dr...@google.com>
> >>
> >>
> >> Explainer
> >>
> >> https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-position 
> <https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-position>
> >>
> >>
> >> Specification
> >>
> >> https://drafts.csswg.org/css-fonts-4/#propdef-font-variant-position
> >> <https://drafts.csswg.org/css-fonts-4/#propdef-font-variant-position>
> >>
> >>
> >> Summary
> >>
> >> The font-variant-position CSS property controls the use of
> >> alternate, smaller glyphs that are positioned as superscript or
> >> subscript.
> >>
> >>
> >> Motivation
> >>
> >> Font-variant-position property allows users to control usage of
> >> typographic superscript and subscript glyphs.
> >>
> >> Currently font-variant-position is implemented without synthesis
> >> functionality and affects only fonts that have superscript or
> >> subscript glyphs (“sups”/”subs” opentype feature); i.e. if the font
> >> doesn’t have superscript/subscript then setting
> >> font-variant-position to “super”/“sub” won’t synthesize superscript
> >> and subscript glyphs, therefore won’t change anything.
> >>
> >> Subscript and superscript glyphs can be also activated using the
> >> font-feature-settings property, however using font-variant-position
> >> property might be more reasonable since it cascades like a regular
> >> CSS property and with the font-feature-settings, if the element
> >> inherits the “sups” or “subs” value, users need to
> >> activate/deactivate other features that were also defined in
> >> font-feature-settings of the parent element.
> >>
> >> Implementing the synthesis part would be complex and it is
> >> questionable if it is worth the cost since synthesized glyphs may
> >> look unnatural and synthesis of the font-variant-position property
> >> is at risk in the spec
> >> <
> https://drafts.csswg.org/css-fonts-4/#:~:text=The%20following%20features,variant%2Dposition%20property>.
>  
> Also Safari supports font-variant-position property without synthesis 
> functionality as well.
> >>
> >> This feature is implemented behind the ‘experimental’ flag and is
> >> part of Interop 2022. Shipping this feature will provide a higher
> >> stable score for Interop and will decrease the stable vs.
> >> experimental score difference.Since Chrome is the last browser to
> >> ship this, this will enable broader usage of the feature on the web.
> >>
> >>
> >> Blink component
> >>
> >> Blink>Fonts
> >> <
> https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3EFonts
> >
> >>
> >>
> >> Search tags
> >>
> >> font-variant-position
> >> <https://chromestatus.com/features#tags:font-variant-position>,
> >> subscript glyphs
> >> <https://chromestatus.com/features#tags:subscript%20glyphs>,
> >> superscript glyphs
> >> <https://chromestatus.com/features#tags:superscript%20glyphs>, sub
> >> <https://chromestatus.com/features#tags:sub>, super
> >> <https://chromestatus.com/features#tags:super>
> >>
> >>
> >> TAG review
> >>
> >> Already shipped in other browsers, see below, no TAG review required.
> >>
> >>
> >> TAG review status
> >>
> >> Not applicable, existing standard, shipped in other UAs
> >>
> >>
> >> Risks
> >>
> >>
> >>
> >> Interoperability and Compatibility
> >>
> >>
> >> Gecko: Shipped/Shipping
> >>
> >> https://bugzilla.mozilla.org/show_bug.cgi?id=1024804
> >> <https://bugzilla.mozilla.org/show_bug.cgi?id=1024804>Gecko has
> >> implemented the feature with the synthesis functionality.
> >>
> >>
> >> WebKit: Shipped/Shipping
> >>
> >> https://bugs.webkit.org/show_bug.cgi?id=148413
> >> <https://bugs.webkit.org/show_bug.cgi?id=148413>WebKit has
> >> implemented the feature without the synthesis functionality.
> >>
> >>
> >> Web developers: No signals
> >>
> >>
> >> Other signals: -
> >>
> >>
> >>
> >> Activation
> >>
> >> None expected; Feature already implemented in other browsers.
> >>
> >>
> >>
> >> Debuggability
> >>
> >> Same as any other CSS property, css_properties.json will be rolled
> >> to DevTools during development.
> >>
> >>
> >>
> >> Will this feature be supported on all six Blink platforms
> >> (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
> >>
> >> Yes
> >>
> >>
> >> Is this feature fully tested by web-platform-tests
> >> <
> https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md
> >?
> >>
> >> Yes, following tests are testing property implementation:
> >>
> >> https://wpt.fyi/results/css/css-fonts/font-variant-position.html
> >> <https://wpt.fyi/results/css/css-fonts/font-variant-position.html>
> >>
> >> https://wpt.fyi/results/css/css-fonts/font-variant-position-01.html
> >> <https://wpt.fyi/results/css/css-fonts/font-variant-position-01.html>
> >>
> >> https://wpt.fyi/results/css/css-fonts/font-variant-position-02.html
> >> <https://wpt.fyi/results/css/css-fonts/font-variant-position-02.html>
> >>
> >> https://wpt.fyi/results/css/css-fonts/font-variant-position-03.html
> >> <https://wpt.fyi/results/css/css-fonts/font-variant-position-03.html>
> >>
> >> 
> https://wpt.fyi/results/css/css-fonts/parsing/font-variant-position-valid.html
>  
> <
> https://wpt.fyi/results/css/css-fonts/parsing/font-variant-position-valid.html
> >
> >>
> >> 
> https://wpt.fyi/results/css/css-fonts/parsing/font-variant-position-computed.html
>  
> <
> https://wpt.fyi/results/css/css-fonts/parsing/font-variant-position-computed.html
> >
> >>
> >> https://wpt.fyi/results/css/css-fonts/parsing/font-variant-valid.html <
> https://wpt.fyi/results/css/css-fonts/parsing/font-variant-valid.html>
> >>
> >>
> >> Flag name
> >>
> >> FontVariantPosition
> >>
> >>
> >> Requires code in //chrome?
> >>
> >> False
> >>
> >>
> >> Tracking bug
> >>
> >> https://bugs.chromium.org/p/chromium/issues/detail?id=1212668
> >> <https://bugs.chromium.org/p/chromium/issues/detail?id=1212668>
> >>
> >>
> >> Estimated milestones
> >>
> >> No milestones specified
> >>
> >>
> >>
> >> Anticipated spec changes
> >>
> >> None expected
> >>
> >>
> >>
> >> Link to entry on the Chrome Platform Status
> >>
> >> https://chromestatus.com/feature/5067180721307648
> >> <https://chromestatus.com/feature/5067180721307648>
> >>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "blink-dev" group.
> >> To unsubscribe from this group and stop receiving emails from it,
> >> send an email to blink-dev+...@chromium.org
> >> <mailto:blink-dev+...@chromium.org>.
> >> To view this discussion on the web visit
> >> 
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAAO7W_C-aHBXYr1mp%3DiJkTQEPgP-isxxv-u-Uv%3DyO4Mp9b_j5Q%40mail.gmail.com
>  
> <
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAAO7W_C-aHBXYr1mp%3DiJkTQEPgP-isxxv-u-Uv%3DyO4Mp9b_j5Q%40mail.gmail.com?utm_medium=email&utm_source=footer
> >.
> >>
> >> -- 
> >> You received this message because you are subscribed to the Google
> >> Groups "blink-dev" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> >> an email to blink-dev+...@chromium.org
> >> <mailto:blink-dev+...@chromium.org>.
> >> To view this discussion on the web visit
> >> 
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAARdPYcZ%2Br_RpUWL3Z8QKTYzF5WTG3nnZeaM3UbDwofYc9cu8g%40mail.gmail.com
>  
> <
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAARdPYcZ%2Br_RpUWL3Z8QKTYzF5WTG3nnZeaM3UbDwofYc9cu8g%40mail.gmail.com?utm_medium=email&utm_source=footer
> >.
>

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to blink-dev+unsubscr...@chromium.org.
To view this discussion on the web visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/bafec970-883b-45a2-9c93-fd8f8220e741n%40chromium.org.

Reply via email to