https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3bb1e644082b59f0d8d18dc0cf529cae31e2fb70

commit 3bb1e644082b59f0d8d18dc0cf529cae31e2fb70
Author:     Doug Lyons <dougly...@douglyons.com>
AuthorDate: Sat Oct 26 16:44:39 2024 -0500
Commit:     GitHub <nore...@github.com>
CommitDate: Sat Oct 26 16:44:39 2024 -0500

    [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.
---
 win32ss/gdi/ntgdi/freetype.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c
index 5a6f8479bbc..8deb9e6820b 100644
--- a/win32ss/gdi/ntgdi/freetype.c
+++ b/win32ss/gdi/ntgdi/freetype.c
@@ -6795,7 +6795,8 @@ IntExtTextOutW(
     FONT_CACHE_ENTRY Cache;
     FT_Matrix mat;
     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;
     SIZE spaceWidth;
 
@@ -7063,13 +7064,14 @@ IntExtTextOutW(
         bitSize.cx = realglyph->bitmap.width;
         bitSize.cy = realglyph->bitmap.rows;
 
-        /* Do chars other than space and etx have a bitSize.cx of zero? */
-        if (ch0 != L' ' && ch0 != etx && bitSize.cx == 0)
+        /* Do chars > space & not DEL & not nbsp have a bitSize.cx of zero? */
+        if (ch0 > L' ' && ch0 != del && ch0 != nbsp && bitSize.cx == 0)
             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. */
-        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();
             /* Get the width of the space character */

Reply via email to