Skip to content

Fix several issues with multi-character stretchy assemblies. (mathjax/MathJax#3528, mathjax/MathJax#3531)#1441

Open
dpvc wants to merge 2 commits intodevelopfrom
fix/stretchy-assemblies
Open

Fix several issues with multi-character stretchy assemblies. (mathjax/MathJax#3528, mathjax/MathJax#3531)#1441
dpvc wants to merge 2 commits intodevelopfrom
fix/stretchy-assemblies

Conversation

@dpvc
Copy link
Member

@dpvc dpvc commented Feb 27, 2026

This PR fixes several issues with multi-character stretchy assemblies. There were two main problems:

  1. In Windows with CHTML, the extenders could show gaps due to the overlap between pieces not being big enough.
  2. If an assembly height is requested that is less than the sum of the top and bottom pieces, they need to overlap, but that wasn't happening.

The first is fixed in the ts/output/chtml/FontData.ts file by reducing the line-height by a small fuzz factor. The SVG output was using this, and the value for that (and a horizontal fuzz factor) have been moved to the common FontData.ts file so they can be used by both output formats.

The positioning of the extender is also fixed so that the overlap with the upper glyph is more consistent.

The horizontal extenders in CHTML now uses the HFUZZ value to add a little overlap as well, since glyphs with rounded ends were producing some gaps.

The second issue is addressed in the ts/output/chtml/Wrappers/mo.ts file. It now uses the named VFUZZ and HFUZZ values, but the main change is in the createPart() method, which checks if the requested height is less than the sum of the top and bottom parts (W < 0) in a vertical assembly (nl is not null), and if so, it overrides the top and bottom margins, which are what reserve the space for the top and bottom glyphs, to make the total height be correct. The createAssembly() function is adjusted to add the needed heights to the data that is passed to createPart()

The ts/output/svg/Wrapers/mo.ts file is modified to remove the prettier-ignore comment, and allowing the function to be prettified. That is really the only change, other than moving the definitions of the fuzz values to the common FontData.ts file.

Resolves issues mathjax/MathJax#3528 and mathjax/MathJax#3531.

@dpvc dpvc requested a review from zorkow February 27, 2026 13:32
@dpvc dpvc added this to the v4.2 milestone Feb 27, 2026
@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 16.04938% with 68 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.45%. Comparing base (5caee44) to head (fdcc1b7).

Files with missing lines Patch % Lines
ts/output/chtml/Wrappers/mo.ts 13.33% 26 Missing ⚠️
ts/output/svg/Wrappers/mo.ts 10.71% 25 Missing ⚠️
ts/output/chtml/FontData.ts 5.55% 17 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1441      +/-   ##
===========================================
- Coverage    86.49%   86.45%   -0.05%     
===========================================
  Files          340      340              
  Lines        86044    86092      +48     
  Branches      4833     4833              
===========================================
+ Hits         74425    74431       +6     
- Misses       11595    11661      +66     
+ Partials        24        0      -24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant