Author: tkreuzer Date: Sun Aug 22 23:38:02 2010 New Revision: 48597
URL: http://svn.reactos.org/svn/reactos?rev=48597&view=rev Log: [WIN32K] / [GDI32] - GetTextExtentExPointI and GetTextExtentPointI take an array of glyph indices, not characters. Pass a flag GTEF_INDICES (This is a reactos specific definition and not exactly like on Windows XP, but the real names/values are undocumented and this is the easiest way.) to NtGdiGetTextExtent/NtGdiGetTextExtentExW and handle this flag in TextIntGetTextExtentPoint to account for this. Fixes bug 3481
Modified: trunk/reactos/dll/win32/gdi32/objects/text.c trunk/reactos/include/reactos/win32k/ntgdityp.h trunk/reactos/subsystems/win32/win32k/include/text.h trunk/reactos/subsystems/win32/win32k/objects/font.c trunk/reactos/subsystems/win32/win32k/objects/freetype.c trunk/reactos/subsystems/win32/win32k/objects/text.c
Modified: trunk/reactos/dll/win32/gdi32/objects/text.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/tex... ============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/text.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/objects/text.c [iso-8859-1] Sun Aug 22 23:38:02 2010 @@ -173,7 +173,7 @@ LPSIZE lpSize ) { - return NtGdiGetTextExtent(hdc, (LPWSTR)lpString, cchString, lpSize, 1); + return NtGdiGetTextExtent(hdc, (LPWSTR)lpString, cchString, lpSize, 0); }
@@ -299,7 +299,7 @@ LPINT alpDx, LPSIZE lpSize) { - return NtGdiGetTextExtentExW(hdc,pgiIn,cgi,nMaxExtent,(ULONG *)lpnFit, (PULONG) alpDx,lpSize,1); + return NtGdiGetTextExtentExW(hdc,pgiIn,cgi,nMaxExtent,(ULONG *)lpnFit, (PULONG) alpDx,lpSize,GTEF_INDICES); }
/* @@ -312,7 +312,7 @@ int cgi, LPSIZE lpSize) { - return NtGdiGetTextExtent(hdc,pgiIn,cgi,lpSize,2); + return NtGdiGetTextExtent(hdc,pgiIn,cgi,lpSize,GTEF_INDICES); }
/*
Modified: trunk/reactos/include/reactos/win32k/ntgdityp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntgd... ============================================================================== --- trunk/reactos/include/reactos/win32k/ntgdityp.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntgdityp.h [iso-8859-1] Sun Aug 22 23:38:02 2010 @@ -191,6 +191,9 @@ // NtGdiGetCharABCWidthW Flags #define GCABCW_NOFLOAT 0x0001 #define GCABCW_INDICES 0x0002 + +// NtGdiGetTextExtent* flags (reactos own) +#define GTEF_INDICES 0x1
/* CAPS1 support */ #define CAPS1 94
Modified: trunk/reactos/subsystems/win32/win32k/include/text.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/text.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/text.h [iso-8859-1] Sun Aug 22 23:38:02 2010 @@ -96,7 +96,7 @@ ULONG FASTCALL ftGdiGetGlyphOutline(PDC,WCHAR,UINT,LPGLYPHMETRICS,ULONG,PVOID,LPMAT2,BOOL); INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI,UINT,OUTLINETEXTMETRICW *); BOOL FASTCALL ftGdiGetRasterizerCaps(LPRASTERIZER_STATUS); -BOOL FASTCALL TextIntGetTextExtentPoint(PDC,PTEXTOBJ,LPCWSTR,INT,ULONG,LPINT,LPINT,LPSIZE); +BOOL FASTCALL TextIntGetTextExtentPoint(PDC,PTEXTOBJ,LPCWSTR,INT,ULONG,LPINT,LPINT,LPSIZE,FLONG); BOOL FASTCALL ftGdiGetTextMetricsW(HDC,PTMW_INTERNAL); DWORD FASTCALL IntGetFontLanguageInfo(PDC); INT FASTCALL ftGdiGetTextCharsetInfo(PDC,PFONTSIGNATURE,DWORD);
Modified: trunk/reactos/subsystems/win32/win32k/objects/font.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/font.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/font.c [iso-8859-1] Sun Aug 22 23:38:02 2010 @@ -75,7 +75,7 @@ return Count; }
- +#if 0 DWORD FASTCALL GreGetCharacterPlacementW( @@ -90,13 +90,14 @@
if (!pgcpw) { - if (GreGetTextExtentW( hdc, pwsz, nCount, &Size, 1)) + if (GreGetTextExtentW( hdc, pwsz, nCount, &Size, 0)) return MAKELONG(Size.cx, Size.cy); return 0; } UNIMPLEMENTED; return 0; } +#endif
INT FASTCALL @@ -167,7 +168,7 @@ DC_UnlockDc(pdc); return 0; } - Good = TextIntGetTextExtentPoint(pdc, TextObj, alphabet, 52, 0, NULL, 0, &sz); + Good = TextIntGetTextExtentPoint(pdc, TextObj, alphabet, 52, 0, NULL, 0, &sz, 0); TEXTOBJ_UnlockText(TextObj); DC_UnlockDc(pdc);
Modified: trunk/reactos/subsystems/win32/win32k/objects/freetype.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/freetype.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/freetype.c [iso-8859-1] Sun Aug 22 23:38:02 2010 @@ -2123,7 +2123,8 @@ ULONG MaxExtent, LPINT Fit, LPINT Dx, - LPSIZE Size) + LPSIZE Size, + FLONG fl) { PFONTGDI FontGDI; FT_Face face; @@ -2195,7 +2196,11 @@
for (i = 0; i < Count; i++) { - glyph_index = FT_Get_Char_Index(face, *String); + if (fl & GTEF_INDICES) + glyph_index = *String; + else + glyph_index = FT_Get_Char_Index(face, *String); + if (!(realglyph = ftGdiGlyphCacheGet(face, glyph_index, TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfHeight))) { @@ -4238,16 +4243,17 @@ IntLockFreeType; face = FontGDI->face;
+ if (DefChar == 0xffff && FT_IS_SFNT(face)) + { + TT_OS2 *pOS2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2); + DefChar = (pOS2->usDefaultChar ? FT_Get_Char_Index(face, pOS2->usDefaultChar) : 0); + } + for (i = 0; i < cwc; i++) { - Buffer[i] = FT_Get_Char_Index(face, UnSafepwc[i]); + Buffer[i] = FT_Get_Char_Index(face, UnSafepwc[i]); // FIXME: unsafe! if (Buffer[i] == 0) { - if (DefChar == 0xffff && FT_IS_SFNT(face)) - { - TT_OS2 *pOS2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2); - DefChar = (pOS2->usDefaultChar ? FT_Get_Char_Index(face, pOS2->usDefaultChar) : 0); - } Buffer[i] = DefChar; } }
Modified: trunk/reactos/subsystems/win32/win32k/objects/text.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/text.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/text.c [iso-8859-1] Sun Aug 22 23:38:02 2010 @@ -15,6 +15,7 @@
/** Functions *****************************************************************/
+#if 0 /* flOpts : GetTextExtentPoint32W = 0 @@ -60,7 +61,8 @@ 0, NULL, 0, - psize); + psize, + flOpts); TEXTOBJ_UnlockText(TextObj); } else @@ -123,7 +125,8 @@ MaxExtent, (LPINT)Fit, (LPINT)Dx, - pSize); + pSize, + fl); TEXTOBJ_UnlockText(TextObj); } else @@ -132,6 +135,7 @@ DC_UnlockDc(pdc); return Result; } +#endif
DWORD APIENTRY @@ -347,7 +351,8 @@ MaxExtent, NULL == UnsafeFit ? NULL : &Fit, Dx, - &Size); + &Size, + fl); TEXTOBJ_UnlockText(TextObj); } else @@ -420,7 +425,7 @@ LPSIZE psize, UINT flOpts) { - return NtGdiGetTextExtentExW(hdc, lpwsz, cwc, 0, NULL, NULL, psize, 0); + return NtGdiGetTextExtentExW(hdc, lpwsz, cwc, 0, NULL, NULL, psize, flOpts); }
BOOL