Skip to content
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

Add detailed rules for the ssty OpenType feature #135

Open
fred-wang opened this issue Feb 21, 2019 · 7 comments
Open

Add detailed rules for the ssty OpenType feature #135

fred-wang opened this issue Feb 21, 2019 · 7 comments

Comments

@fred-wang
Copy link
Contributor

fred-wang commented Feb 21, 2019

Currently, the ssty feature is mentioned in the following paragraph:
"Some characters like primes already have script size by default and hence would be too small when used in a script position. Hence user agents must support glyph selections via the OpenType font feature ssty (Script Style) in order to display such “prescripted” characters with the appropriate size." (chapter 2)
"If mtext [or token element with similar box model] is used at a non-zero scriptlevel then user agents must enable the ssty OpenType feature on text nodes unless it contradicts what the page author has specified with the font-feature-settings CSS property." (chapter 3)
See also:
https://bugzilla.mozilla.org/show_bug.cgi?id=442637
http://www.microsoft.com/typography/otspec/features_pt.htm#ssty
http://www.microsoft.com/typography/otspec/math.htm

Original report: https://gitlab.com/mathml/MathMLinHTML5/issues/2

@briansmith
Copy link

"Some characters like primes already have script size by default and hence would be too small when used in a script position. Hence user agents must support glyph selections via the OpenType font feature ssty (Script Style) in order to display such “prescripted” characters with the appropriate size." (chapter 2)

Another reason to support such "ssty": Consider x^(y^z), where the superscript has an internal superscript, and x^(y_z), where the superscript has an internal subscript. AFAICT, the only way the font can properly tell the UA how to render these is through "ssty" levels 1 and 2. "subs" and "sups" OpenType features aren't documented to have multiple levels and so can't handle this.

@fred-wang
Copy link
Contributor Author

This is the current text:

        <p>
          Some characters like primes already have script size by default
          and
          hence would be too small when used in a script position.
          To render such “prescripted” characters with the appropriate size,
          If a <code>&lt;mtext&gt;</code> has a positive
          <a><code>internal scriptlevel</code></a> value then user agents
          must enable
          the <code>ssty</code> (Script Style) OpenType feature
          on its text nodes [[OPEN-FONT-FORMAT]]
          unless it contradicts what the page author has
          specified with the
          <a data-cite="CSS-FONTS-4#font-rend-desc"><code>font-feature-settings</code></a>
          CSS property.
        </p>

@fred-wang
Copy link
Contributor Author

Consensus from 15 June 2020: remove the text above and move this to level 2.

@fred-wang
Copy link
Contributor Author

Murray mentioned use cases for ssty: https://lists.w3.org/Archives/Public/public-mathml4/2020Jun/0019.html

(although I don't know whether they would be handled by the rule mentioned above)

@fred-wang
Copy link
Contributor Author

The previous rule proposed in the spec was relying on the "scriptlevel value" but it's not clear whether or not it will be accessible, depending on what ends up on the CSS side.

@fred-wang
Copy link
Contributor Author

I think there was confusing in https://github.com/mathml-refresh/mathml/issues/146 ; This is NOT about converting U+0027 (' apostrophe) to U+2032 (′ prime) so it has nothing to do with the character-level changes.

This is about adjusting size for "already prescript glyphs" when rendered as a script by doing glyph-level changes. The markup suggested by MathML3 is

 <msup><mi>a</mi><mo>&#x2032;</mo></msup>

NOT

 <mi>a</mi><mo>&#x2032;</mo>

From the OpenType MATH spec:

Script Style

This feature provides glyph variants adjusted to be more suitable for use in subscripts and superscripts.

These script style forms should not be scaled or moved in the font; scaling and moving them is done by the math-layout engine. Instead, the 'ssty' feature should provide glyph forms that result in shapes that look good as superscripts and subscripts when scaled and positioned by the math engine. When designing the script forms, the font developer may assume that the scriptPercentScaleDown and scriptScriptPercentScaleDown values in the MathConstants table will be scaling factors applied to the size of the alternate glyphs by the math engine.

This feature can have a parameter indicating the script level: 1 for simple subscripts and superscripts, 2 for second level subscripts and superscripts (that is, scripts on scripts), and so on. (Currently, only the first two alternates are used).

For glyphs that are not covered by this feature, the original glyph is used in subscripts and superscripts.

Recommended format: Alternate Substitution table (Single Substitution if there are no second level forms). There should be no context.

@fred-wang
Copy link
Contributor Author

Using ttx -t GSUB fontname to dump the GSUB table, this is what I get for a few fonts:

  • Cambria Math: glyph04593, glyph04594
  • STIX Two: minute.ssty, minute.ssty2
  • Latin Modern Math: minute.st, minute.sts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants