X Tutup
Skip to content

GRIM: Fix failed assertion on font rendering with TinyGL#6631

Merged
orgads merged 1 commit intoscummvm:masterfrom
orgads:grim-assertion
May 18, 2025
Merged

GRIM: Fix failed assertion on font rendering with TinyGL#6631
orgads merged 1 commit intoscummvm:masterfrom
orgads:grim-assertion

Conversation

@orgads
Copy link
Contributor

@orgads orgads commented May 18, 2025

Opening the menu (F1) in a debug build triggers a crash due to an assertion failure in surface.h:

assert(x >= 0 && x < w && y >= 0 && y < h).

This problem occurs because setPixel is called with x equal to w. It's especially noticeable when rendering a single "Q" character, where the kerned width is 12, but the bitmap width is 14 pixels.

getBitmapStringLength returns the sum of character advance widths Kerning applies to spacing between glyphs not bitmap widths.

Since no subsequent glyph follows the final character, kerning is unused. Therefore the final character's bitmap width must be used This prevents setPixel from receiving x coordinates equal to w.

Opening the menu (F1) in a debug build triggers a crash due to an
assertion failure in surface.h:
assert(x >= 0 && x < w && y >= 0 && y < h).

This problem occurs because setPixel is called with x equal to w.
It's especially noticeable when rendering a single "Q" character,
where the kerned width is 12, but the bitmap width is 14 pixels.

getBitmapStringLength returns the sum of character advance widths
Kerning applies to spacing between glyphs not bitmap widths.

Since no subsequent glyph follows the final character, kerning is
unused. Therefore the final character's bitmap width must be used
This prevents setPixel from receiving x coordinates equal to w.
@orgads orgads requested a review from aquadran May 18, 2025 05:55
@orgads orgads merged commit 2b4ce79 into scummvm:master May 18, 2025
8 checks passed
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

X Tutup