Add per-font codepoint-coverage test for all 8 bundled fonts#212
Conversation
There was a problem hiding this comment.
Code Review
This pull request documents symbol coverage in the README and adds unit tests in MTTypesetterTest.m to verify that all LaTeX symbols render correctly across multiple fonts. The reviewer suggested adding an assertion in the new helper method assertAllSymbolsRenderInFont:name:allowList: to verify that the underlying CoreText font (font.ctFont) is not NULL, ensuring that font loading failures are caught explicitly.
| - (void) assertAllSymbolsRenderInFont:(MTFont *)font name:(NSString *)fontName allowList:(NSSet<NSString*> *)allowList | ||
| { | ||
| NSArray<NSString*>* allSymbols = [MTMathAtomFactory supportedLatexSymbolNames]; |
There was a problem hiding this comment.
When testing if an MTFont has successfully loaded, we should verify that its internal CoreText font (font.ctFont) is not NULL, rather than assuming it loaded or asserting that the MTFont instance itself is non-nil (since fontWithName:size: always returns a non-nil instance). Adding this assertion at the start of the helper method ensures that any font loading failure is caught immediately with a clear message.
- (void) assertAllSymbolsRenderInFont:(MTFont *)font name:(NSString *)fontName allowList:(NSSet<NSString*> *)allowList
{
XCTAssertTrue(font.ctFont != NULL, @"Font %@ failed to load its underlying CoreText font", fontName);
NSArray<NSString*>* allSymbols = [MTMathAtomFactory supportedLatexSymbolNames];References
- When testing if an MTFont has successfully loaded its underlying font files, do not assert that the MTFont instance itself is non-nil (as fontWithName:size: always returns a non-nil instance). Instead, verify that the internal CoreText font (font.ctFont) is not NULL.
d2a99a6 to
090db84
Compare
1dad97b to
f3e93fd
Compare
f3e93fd to
dce545f
Compare
Loops over every bundled math font and asserts that each command in supportedLatexSymbolNames renders with positive metrics. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
dce545f to
1a73653
Compare
Goal
Generalize the symbol-coverage test from Latin Modern to all 8 fonts — one XCTest method per font — with per-font allow-lists of known-missing commands, and document those gaps in the README.
Plan:
docs/plans/2026-05-30-add-math-fonts.md(items 18–20)LLD:
docs/lld/2026-05-30-add-math-fonts.mdStack
Commits
[item 18]Add per-font codepoint-coverage tests (allow-lists empty)[item 19]Populate Fira Math / Noto Sans Math coverage allow-lists[item 20]Document per-font symbol-coverage gaps in READMECoverage findings
All 8 fonts have full coverage of
supportedLatexSymbolNames— no missing symbols found. The allow-lists for Fira Math and Noto Sans Math are empty (complete coverage confirmed). All 6 TeX-grade fonts (Latin Modern, XITS, Termes, New Computer Modern, Pagella, STIX Two) also pass with empty allow-lists.The per-font test structure (
assertAllSymbolsRenderInFont:name:allowList:+ one method per font) is in place for easy future maintenance.Testing
273 tests, 0 failures (
swift test).