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

Re-implement stretchy math operators using composed shapes #2155

Open
alerque opened this issue Nov 2, 2024 · 5 comments
Open

Re-implement stretchy math operators using composed shapes #2155

alerque opened this issue Nov 2, 2024 · 5 comments
Labels
enhancement Software improvement or feature request
Milestone

Comments

@alerque
Copy link
Member

alerque commented Nov 2, 2024

-- HACK: For stretchy operators, MathML Core and OpenType define how to build large glyphs
-- from an assembly of smaller ones. It's fairly complex and idealistic...
-- Anyhow, we do not have that yet, so we just stretch the glyph artificially.
-- There are cases where this will not look very good.
-- Call that a compromise, so that long vectors or large matrices look "decent" without assembly.

HACK: For stretchy operators, MathML Core and OpenType define how to build large glyphs from an assembly of smaller ones. It's fairly complex and idealistic... Anyhow, we do not have that yet, so we just stretch the glyph artificially. There are cases where this will not look very good. Call that a compromise, so that long vectors or large matrices look "decent" without assembly.

@alerque alerque added the enhancement Software improvement or feature request label Nov 2, 2024
@alerque alerque added this to the v0.x.y milestone Nov 2, 2024
@alerque alerque added this to Math Nov 2, 2024
@github-project-automation github-project-automation bot moved this to To do in Math Nov 2, 2024
@Omikhleia
Copy link
Member

Concerns:

  • Handling of vertical stretchy operators ("along the block axis")
  • Handling of horizontal stretchy operators ("along the inline axis")
  • Root symbols (msqrt / mroot) on both axis

Aside note: Even glyph assembly can lead to sizes being off, so re-scaling with a PDF matrix is not necessarily entirely out of the picture -- but the closer we are to the target size, the less scaling artifacts are visible.

@Omikhleia Omikhleia changed the title Re-implement stretchy math operaters using composed shapes Re-implement stretchy math operators using composed shapes Nov 2, 2024
@Omikhleia
Copy link
Member

Omikhleia commented Nov 2, 2024

Aside note: Old typographers (from the time characters were in "metal"), well usually, did do this kind of insane glyph assembly logic.1 It's not because a technology exists that it has to be used. 🐰

Footnotes

  1. Most of the time, they reserved the space with rectangular shapes (or "struts"), and would have another person applying ink pads (usually wooden cuts) over the printed text. Same often applied to dropped capitals.

@khaledhosny
Copy link
Contributor

Asymmetrical scaling can (and will) distort glyph shapes, and symmetrical scaling will make the glyphs out of proportion. There a reason the MATH table has glyph assemblies and that is not lack of scaling support in graphics libraries. A better replacement to glyph assemblies would be font variations in MATH table (harfbuzz/boring-expansion-spec#136), but we don’t have that yet.

@Omikhleia
Copy link
Member

... scaling can (and will) distort glyph shapes

Of course it will, and I as said, it's very noticeable when we are far from the expected size. As I wrote both in-code and in the commit log, "there are cases where this will not look very good". But what do you prefer:

  • Math support that doesn't have stretchy vectors/matrices etc. --> I'm confident no one will use it.
  • Math support that supports them decently although some look bad (see pic. in wip(math): Accents in math #2156 for instance) --> I believe it's more important to reach that status first (= the MathML engine at least does what it has to do up to that point).

@khaledhosny
Copy link
Contributor

khaledhosny commented Nov 3, 2024

I was specifically commenting on this part:

Aside note: Even glyph assembly can lead to sizes being off, so re-scaling with a PDF matrix is not necessarily entirely out of the picture

I advise against doing any scaling once glyph assembly support is in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Software improvement or feature request
Projects
Status: To do
Development

No branches or pull requests

3 participants