Skip to content

Conversation

@dpvc
Copy link
Member

@dpvc dpvc commented Oct 25, 2025

This PR fixes a problem with zero-width accents in Safari output in CHTML. In the past, fonts made combining accents using 0-width characters that overlapped to the left, but modern browsers now handle combining characters themselves regarded of whether they are 0-width or not. So browsers differ on how they handle combining characters, and in particular on how the zero-width characters are displayed.

For this reason, MathJax uses the spacing-modifier Unicode black rather than the Combining Diacritical Marks block whenever possible. This works well for most cases, except there is no Spacing Modifier version of the vector arrow, U+20D7, so that has been a perennial problem for MathJax. I thought I had taken care of this in v3, but either that was lost in changes for v3, or it was font-specific (I think it was the latter, where I made a full width vector arrow rather than a zero one in order to work around this problem). With the new fonts, the vector arrow is not longer properly placed when viewed from Safari (but is for other browsers). This is fixed in this PR by additional CSS that resolves the problem in Safari without damaging the position in other browsers (at least in the ones I've tested).

This fixes more than just the U+20D7, but also other combining diacriticals, like U+0303 and the other ones in the 0300 block, e.g.

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mover>
    <mi>x</mi>
    <mo stretchy="false" accent="true">&#x303;</mo>
  </mover>
</math>

@dpvc dpvc requested a review from zorkow October 25, 2025 14:24
@dpvc dpvc added this to the v4.0.1 milestone Oct 25, 2025
@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

❌ Patch coverage is 28.57143% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.66%. Comparing base (27c47f3) to head (82eab14).

Files with missing lines Patch % Lines
ts/output/chtml/FontData.ts 0.00% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1375      +/-   ##
===========================================
- Coverage    86.66%   86.66%   -0.01%     
===========================================
  Files          338      338              
  Lines        84384    84389       +5     
  Branches      4779     3149    -1630     
===========================================
+ Hits         73131    73132       +1     
- Misses       11253    11257       +4     

☔ 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.

2 participants