Skip to content

Apply OpenType MATH italic correction at run boundaries - #288

Open
Happypig375 wants to merge 3 commits into
port-iosmath-2026from
fix/issue-32-ordinary-italic-correction
Open

Apply OpenType MATH italic correction at run boundaries#288
Happypig375 wants to merge 3 commits into
port-iosmath-2026from
fix/issue-32-ordinary-italic-correction

Conversation

@Happypig375

@Happypig375 Happypig375 commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • apply the actual glyph/font OpenType MATH italic correction when a slanted math run ends before an upright glyph or delimiter
  • preserve same-style Ordinary fusion and attach internal slanted-to-upright corrections to the corresponding fused glyph
  • retain text-mode shaping, Rule 16 spacing, scripts, wrappers, composites, and public InnerDisplay mutability semantics
  • cache the ink-aware advance only for completed Typesetter-owned inner layouts, avoiding repeated recursive ink-tree traversal
  • formalize and enforce the math glyph lookup contract of one glyph per Unicode scalar

The behavior follows the OpenType MATH rule that the last glyph's italic correction is added when a slanted run is followed by a straight character: https://learn.microsoft.com/en-us/typography/opentype/spec/math#mathitalicscorrectioninfo-table

Validation

  • Core suite: 1,658/1,658 passed
  • Rendering suite (serial): 1,298/1,298 passed
  • TestMeasure: 64/64 passed
  • exact Issue32MatrixRightDelimiter Skia golden: passed
  • negative non-scalar-aligned glyph-provider contract test: passed
  • git diff --check: passed
  • final senior correctness/performance review: approved
  • BenchmarkDotNet AllConstantValues: 572.205 ms mean (failed PR run: 29.294 s; local pre-fix warmup: 35.4 s; prior baseline: about 608 ms)
  • BenchmarkDotNet QuarticSolutions: 131.028 ms mean (failed PR run: 344.7 ms; prior baseline: 122.4 ms)

Stack

This is intentionally based on port-iosmath-2026 / #264 because it builds on that port's math-run font-fusion semantics. The final performance repair is bcca7142.

Fixes #32

@Happypig375 Happypig375 added Type/Bug A reproducible defect in CSharpMath. Area/Rendering Typesetting, measurement, fonts, text layout, and drawing. labels Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area/Rendering Typesetting, measurement, fonts, text layout, and drawing. Type/Bug A reproducible defect in CSharpMath.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant