Skip to content

Commit 3bb1e64

Browse files
authored
[NTGDI:FREETYPE] Account for non-breaking spaces in x-dim of IntExtTextOutW (reactos#7479)
CORE-19768 Follow up of PR reactos#7274. This stop WARN's from FF 28 as well. * Make del and nbsp const's based on reviewer comments.
1 parent 3736938 commit 3bb1e64

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

win32ss/gdi/ntgdi/freetype.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6795,7 +6795,8 @@ IntExtTextOutW(
67956795
FONT_CACHE_ENTRY Cache;
67966796
FT_Matrix mat;
67976797
BOOL bNoTransform;
6798-
DWORD ch0, ch1, etx = 3; // etx is ASCII End of Text
6798+
DWORD ch0, ch1;
6799+
const DWORD del = 0x7f, nbsp = 0xa0; // DEL is ASCII DELETE and nbsp is a non-breaking space
67996800
FONTLINK_CHAIN Chain;
68006801
SIZE spaceWidth;
68016802

@@ -7063,13 +7064,14 @@ IntExtTextOutW(
70637064
bitSize.cx = realglyph->bitmap.width;
70647065
bitSize.cy = realglyph->bitmap.rows;
70657066

7066-
/* Do chars other than space and etx have a bitSize.cx of zero? */
7067-
if (ch0 != L' ' && ch0 != etx && bitSize.cx == 0)
7067+
/* Do chars > space & not DEL & not nbsp have a bitSize.cx of zero? */
7068+
if (ch0 > L' ' && ch0 != del && ch0 != nbsp && bitSize.cx == 0)
70687069
DPRINT1("WARNING: WChar 0x%04x has a bitSize.cx of zero\n", ch0);
70697070

7070-
/* Don't ignore spaces when computing offset.
7071+
/* Don't ignore spaces or non-breaking spaces when computing offset.
70717072
* This completes the fix of CORE-11787. */
7072-
if ((pdcattr->flTextAlign & TA_UPDATECP) && ch0 == L' ' && bitSize.cx == 0)
7073+
if ((pdcattr->flTextAlign & TA_UPDATECP) && bitSize.cx == 0 &&
7074+
(ch0 == L' ' || ch0 == nbsp)) // Space chars needing x-dim widths
70737075
{
70747076
IntUnLockFreeType();
70757077
/* Get the width of the space character */

0 commit comments

Comments
 (0)