Fix baseline rounding to match GDI/BMFont (issue #67)#69
Open
kaltinril wants to merge 2 commits into
Open
Conversation
BmFontModelBuilder Tier 2 used Math.Ceiling for lineHeight and base, but Windows GDI computes tmAscent with Math.Round. This made x-height glyphs appear 1px lower than ascender glyphs within the same text run, causing the inconsistent vertical alignment reported in issue #67. Change both Ceiling calls to Math.Round(…, AwayFromZero) so FreeType and DirectWrite produce the same base/lineHeight as GDI and BMFont's reference output. Adds a gum-em-height.bmfc comparison config (fontSize=-36) to test the Gum integration path, and cross-backend tests that assert FreeType and DirectWrite match GDI without hardcoding specific pixel values. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
BaselineAlignmentTests ran InlineData(DirectWrite) on net8.0-windows where the rasterizer isn't referenced, causing InvalidOperationException. Guard both DirectWrite InlineData attributes with #if DIRECTWRITE so they only compile and run on net10.0-windows where the backend is available. Also reads the pre-existing updatingSyntheticChecks guard flag in EffectsPanel.cs (it was written but never read, producing CS0219 warnings in the build output). Adds the missing if-checks to synBoldCheck.Checked and synItalicCheck.Checked — the handlers that are re-entered during programmatic IsChecked changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BmFontModelBuilder Tier 2 used Math.Ceiling for lineHeight and base, but Windows GDI computes tmAscent with Math.Round. This made x-height glyphs appear 1px lower than ascender glyphs within the same text run, causing the inconsistent vertical alignment reported in issue #67.
Change both Ceiling calls to Math.Round(…, AwayFromZero) so FreeType and DirectWrite produce the same base/lineHeight as GDI and BMFont's reference output. Adds a gum-em-height.bmfc comparison config (fontSize=-36) to test the Gum integration path, and cross-backend tests that assert FreeType and DirectWrite match GDI without hardcoding specific pixel values.