mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:12:56 +00:00
[WIN32K/NTGDI]
- Fix setting the correct font in certain code paths - non-eisting glyphs should return 0xffff, not 0x001f - Don't set last error on failure, GDI APIs don't do that - Remove GreGetGlyphIndicesW, it was mostly a copy of NtGdiGetGlyphIndicesW and it wasn't used - Fixes the GetGlyphIndices tests and fixes showing invalid fonts in charmap svn path=/trunk/; revision=70315
This commit is contained in:
parent
2a0e21d6cb
commit
fd2a84e434
1 changed files with 21 additions and 118 deletions
|
@ -4368,102 +4368,6 @@ NtGdiGetCharWidthW(
|
||||||
return TRUE;
|
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
|
* @implemented
|
||||||
|
@ -4487,7 +4391,6 @@ NtGdiGetGlyphIndicesW(
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
OUTLINETEXTMETRICW *potm;
|
OUTLINETEXTMETRICW *potm;
|
||||||
INT i;
|
INT i;
|
||||||
FT_Face face;
|
|
||||||
WCHAR DefChar = 0xffff;
|
WCHAR DefChar = 0xffff;
|
||||||
PWSTR Buffer = NULL;
|
PWSTR Buffer = NULL;
|
||||||
ULONG Size, pwcSize;
|
ULONG Size, pwcSize;
|
||||||
|
@ -4506,7 +4409,6 @@ NtGdiGetGlyphIndicesW(
|
||||||
dc = DC_LockDc(hdc);
|
dc = DC_LockDc(hdc);
|
||||||
if (!dc)
|
if (!dc)
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_INVALID_HANDLE);
|
|
||||||
return GDI_ERROR;
|
return GDI_ERROR;
|
||||||
}
|
}
|
||||||
pdcattr = dc->pdcattr;
|
pdcattr = dc->pdcattr;
|
||||||
|
@ -4515,7 +4417,6 @@ NtGdiGetGlyphIndicesW(
|
||||||
DC_UnlockDc(dc);
|
DC_UnlockDc(dc);
|
||||||
if (!TextObj)
|
if (!TextObj)
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_INVALID_HANDLE);
|
|
||||||
return GDI_ERROR;
|
return GDI_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4525,24 +4426,34 @@ NtGdiGetGlyphIndicesW(
|
||||||
Buffer = ExAllocatePoolWithTag(PagedPool, cwc*sizeof(WORD), GDITAG_TEXT);
|
Buffer = ExAllocatePoolWithTag(PagedPool, cwc*sizeof(WORD), GDITAG_TEXT);
|
||||||
if (!Buffer)
|
if (!Buffer)
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
||||||
return GDI_ERROR;
|
return GDI_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iMode & GGI_MARK_NONEXISTING_GLYPHS) DefChar = 0x001f; /* Indicate non existence */
|
if (iMode & GGI_MARK_NONEXISTING_GLYPHS)
|
||||||
|
{
|
||||||
|
DefChar = 0xffff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (FT_IS_SFNT(FontGDI->face))
|
||||||
|
{
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
|
Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
|
||||||
potm = ExAllocatePoolWithTag(PagedPool, Size, GDITAG_TEXT);
|
potm = ExAllocatePoolWithTag(PagedPool, Size, GDITAG_TEXT);
|
||||||
if (!potm)
|
if (!potm)
|
||||||
{
|
{
|
||||||
Status = STATUS_NO_MEMORY;
|
cwc = GDI_ERROR;
|
||||||
goto ErrorRet;
|
goto ErrorRet;
|
||||||
}
|
}
|
||||||
IntGetOutlineTextMetrics(FontGDI, Size, potm);
|
IntGetOutlineTextMetrics(FontGDI, Size, potm);
|
||||||
DefChar = potm->otmTextMetrics.tmDefaultChar; // May need this.
|
DefChar = potm->otmTextMetrics.tmDefaultChar;
|
||||||
ExFreePoolWithTag(potm, GDITAG_TEXT);
|
ExFreePoolWithTag(potm, GDITAG_TEXT);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pwcSize = cwc * sizeof(WCHAR);
|
pwcSize = cwc * sizeof(WCHAR);
|
||||||
Safepwc = ExAllocatePoolWithTag(PagedPool, pwcSize, GDITAG_TEXT);
|
Safepwc = ExAllocatePoolWithTag(PagedPool, pwcSize, GDITAG_TEXT);
|
||||||
|
@ -4567,17 +4478,10 @@ NtGdiGetGlyphIndicesW(
|
||||||
if (!NT_SUCCESS(Status)) goto ErrorRet;
|
if (!NT_SUCCESS(Status)) goto ErrorRet;
|
||||||
|
|
||||||
IntLockFreeType;
|
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++)
|
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)
|
if (Buffer[i] == 0)
|
||||||
{
|
{
|
||||||
Buffer[i] = DefChar;
|
Buffer[i] = DefChar;
|
||||||
|
@ -4604,7 +4508,6 @@ ErrorRet:
|
||||||
ExFreePoolWithTag(Safepwc, GDITAG_TEXT);
|
ExFreePoolWithTag(Safepwc, GDITAG_TEXT);
|
||||||
}
|
}
|
||||||
if (NT_SUCCESS(Status)) return cwc;
|
if (NT_SUCCESS(Status)) return cwc;
|
||||||
SetLastNtError(Status);
|
|
||||||
return GDI_ERROR;
|
return GDI_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue