diff --git a/reactos/win32ss/gdi/ntgdi/freetype.c b/reactos/win32ss/gdi/ntgdi/freetype.c index 9678ca4eb7c..4f1b300ab91 100644 --- a/reactos/win32ss/gdi/ntgdi/freetype.c +++ b/reactos/win32ss/gdi/ntgdi/freetype.c @@ -4368,102 +4368,6 @@ NtGdiGetCharWidthW( return TRUE; } -#if 0 -DWORD -FASTCALL -GreGetGlyphIndicesW( - _In_ HDC hdc, - _In_reads_(cwc) LPWSTR pwc, - _In_ INT cwc, - _Out_writes_opt_(cwc) LPWORD pgi, - _In_ DWORD iMode, - _In_ DWORD dwUnknown) -{ - PDC dc; - PDC_ATTR pdcattr; - PTEXTOBJ TextObj; - PFONTGDI FontGDI; - HFONT hFont = 0; - OUTLINETEXTMETRICW *potm; - INT i; - FT_Face face; - WCHAR DefChar = 0xffff; - PWSTR Buffer = NULL; - ULONG Size; - - if ((!pwc) && (!pgi)) return cwc; - - dc = DC_LockDc(hdc); - if (!dc) - { - EngSetLastError(ERROR_INVALID_HANDLE); - return GDI_ERROR; - } - pdcattr = dc->pdcattr; - hFont = pdcattr->hlfntNew; - TextObj = RealizeFontInit(hFont); - DC_UnlockDc(dc); - if (!TextObj) - { - EngSetLastError(ERROR_INVALID_HANDLE); - return GDI_ERROR; - } - - FontGDI = ObjToGDI(TextObj->Font, FONT); - TEXTOBJ_UnlockText(TextObj); - - Buffer = ExAllocatePoolWithTag(PagedPool, cwc*sizeof(WORD), GDITAG_TEXT); - if (!Buffer) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - return GDI_ERROR; - } - - if (iMode & GGI_MARK_NONEXISTING_GLYPHS) DefChar = 0x001f; /* Indicate non existence */ - else - { - Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL); - potm = ExAllocatePoolWithTag(PagedPool, Size, GDITAG_TEXT); - if (!potm) - { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); - cwc = GDI_ERROR; - goto ErrorRet; - } - IntGetOutlineTextMetrics(FontGDI, Size, potm); - DefChar = potm->otmTextMetrics.tmDefaultChar; // May need this. - ExFreePoolWithTag(potm, GDITAG_TEXT); - } - - IntLockFreeType; - face = FontGDI->face; - - for (i = 0; i < cwc; i++) - { - Buffer[i] = FT_Get_Char_Index(face, pwc[i]); - 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; - } - } - - IntUnLockFreeType; - - if (pgi != NULL) - { - RtlCopyMemory(pgi, Buffer, cwc * sizeof(WORD)); - } - -ErrorRet: - if (Buffer) ExFreePoolWithTag(Buffer, GDITAG_TEXT); - return cwc; -} -#endif // 0 /* * @implemented @@ -4487,7 +4391,6 @@ NtGdiGetGlyphIndicesW( NTSTATUS Status = STATUS_SUCCESS; OUTLINETEXTMETRICW *potm; INT i; - FT_Face face; WCHAR DefChar = 0xffff; PWSTR Buffer = NULL; ULONG Size, pwcSize; @@ -4506,7 +4409,6 @@ NtGdiGetGlyphIndicesW( dc = DC_LockDc(hdc); if (!dc) { - EngSetLastError(ERROR_INVALID_HANDLE); return GDI_ERROR; } pdcattr = dc->pdcattr; @@ -4515,7 +4417,6 @@ NtGdiGetGlyphIndicesW( DC_UnlockDc(dc); if (!TextObj) { - EngSetLastError(ERROR_INVALID_HANDLE); return GDI_ERROR; } @@ -4525,23 +4426,33 @@ NtGdiGetGlyphIndicesW( Buffer = ExAllocatePoolWithTag(PagedPool, cwc*sizeof(WORD), GDITAG_TEXT); if (!Buffer) { - EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); return GDI_ERROR; } - if (iMode & GGI_MARK_NONEXISTING_GLYPHS) DefChar = 0x001f; /* Indicate non existence */ + if (iMode & GGI_MARK_NONEXISTING_GLYPHS) + { + DefChar = 0xffff; + } else { - Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL); - potm = ExAllocatePoolWithTag(PagedPool, Size, GDITAG_TEXT); - if (!potm) + if (FT_IS_SFNT(FontGDI->face)) { - Status = STATUS_NO_MEMORY; - goto ErrorRet; + TT_OS2 *pOS2 = FT_Get_Sfnt_Table(FontGDI->face, ft_sfnt_os2); + DefChar = (pOS2->usDefaultChar ? FT_Get_Char_Index(FontGDI->face, pOS2->usDefaultChar) : 0); + } + else + { + Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL); + potm = ExAllocatePoolWithTag(PagedPool, Size, GDITAG_TEXT); + if (!potm) + { + cwc = GDI_ERROR; + goto ErrorRet; + } + IntGetOutlineTextMetrics(FontGDI, Size, potm); + DefChar = potm->otmTextMetrics.tmDefaultChar; + ExFreePoolWithTag(potm, GDITAG_TEXT); } - IntGetOutlineTextMetrics(FontGDI, Size, potm); - DefChar = potm->otmTextMetrics.tmDefaultChar; // May need this. - ExFreePoolWithTag(potm, GDITAG_TEXT); } pwcSize = cwc * sizeof(WCHAR); @@ -4567,17 +4478,10 @@ NtGdiGetGlyphIndicesW( if (!NT_SUCCESS(Status)) goto ErrorRet; 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, Safepwc[i]); + Buffer[i] = FT_Get_Char_Index(FontGDI->face, Safepwc[i]); if (Buffer[i] == 0) { Buffer[i] = DefChar; @@ -4604,7 +4508,6 @@ ErrorRet: ExFreePoolWithTag(Safepwc, GDITAG_TEXT); } if (NT_SUCCESS(Status)) return cwc; - SetLastNtError(Status); return GDI_ERROR; }