[NTGDI:FREETYPE] Account for non-breaking spaces in x-dim of IntExtTextOutW (#7479)

CORE-19768
Follow up of PR #7274. This stop WARN's from FF 28 as well.

* Make del and nbsp const's based on reviewer comments.
This commit is contained in:
Doug Lyons 2024-10-26 16:44:39 -05:00 committed by GitHub
parent 3736938030
commit 3bb1e64408
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6795,7 +6795,8 @@ IntExtTextOutW(
FONT_CACHE_ENTRY Cache; FONT_CACHE_ENTRY Cache;
FT_Matrix mat; FT_Matrix mat;
BOOL bNoTransform; BOOL bNoTransform;
DWORD ch0, ch1, etx = 3; // etx is ASCII End of Text DWORD ch0, ch1;
const DWORD del = 0x7f, nbsp = 0xa0; // DEL is ASCII DELETE and nbsp is a non-breaking space
FONTLINK_CHAIN Chain; FONTLINK_CHAIN Chain;
SIZE spaceWidth; SIZE spaceWidth;
@ -7063,13 +7064,14 @@ IntExtTextOutW(
bitSize.cx = realglyph->bitmap.width; bitSize.cx = realglyph->bitmap.width;
bitSize.cy = realglyph->bitmap.rows; bitSize.cy = realglyph->bitmap.rows;
/* Do chars other than space and etx have a bitSize.cx of zero? */ /* Do chars > space & not DEL & not nbsp have a bitSize.cx of zero? */
if (ch0 != L' ' && ch0 != etx && bitSize.cx == 0) if (ch0 > L' ' && ch0 != del && ch0 != nbsp && bitSize.cx == 0)
DPRINT1("WARNING: WChar 0x%04x has a bitSize.cx of zero\n", ch0); DPRINT1("WARNING: WChar 0x%04x has a bitSize.cx of zero\n", ch0);
/* Don't ignore spaces when computing offset. /* Don't ignore spaces or non-breaking spaces when computing offset.
* This completes the fix of CORE-11787. */ * This completes the fix of CORE-11787. */
if ((pdcattr->flTextAlign & TA_UPDATECP) && ch0 == L' ' && bitSize.cx == 0) if ((pdcattr->flTextAlign & TA_UPDATECP) && bitSize.cx == 0 &&
(ch0 == L' ' || ch0 == nbsp)) // Space chars needing x-dim widths
{ {
IntUnLockFreeType(); IntUnLockFreeType();
/* Get the width of the space character */ /* Get the width of the space character */