mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 12:14:32 +00:00
[WIN32K] Fix NtGdiGetTextFaceW to report face name correctly (#173)
Initialize TEXTOBJ.FaceName member in TextIntRealizeFont and use it in NtGdiGetTextFaceW CORE-14071
This commit is contained in:
parent
e95751ab78
commit
ea4daf8b68
2 changed files with 33 additions and 7 deletions
|
@ -4504,6 +4504,7 @@ TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
UNICODE_STRING NameW;
|
||||||
PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT);
|
PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT);
|
||||||
// Need hdev, when freetype is loaded need to create DEVOBJ for
|
// Need hdev, when freetype is loaded need to create DEVOBJ for
|
||||||
// Consumer and Producer.
|
// Consumer and Producer.
|
||||||
|
@ -4518,6 +4519,17 @@ TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
|
||||||
else
|
else
|
||||||
FontGdi->RequestWeight = FW_NORMAL;
|
FontGdi->RequestWeight = FW_NORMAL;
|
||||||
|
|
||||||
|
/* store the localized family name */
|
||||||
|
RtlInitUnicodeString(&NameW, NULL);
|
||||||
|
Status = IntGetFontLocalizedName(&NameW, FontGdi->SharedFace,
|
||||||
|
TT_NAME_ID_FONT_FAMILY, gusLanguageID);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
RtlCopyMemory(TextObj->FaceName, NameW.Buffer, NameW.Length);
|
||||||
|
TextObj->FaceName[NameW.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||||
|
RtlFreeUnicodeString(&NameW);
|
||||||
|
}
|
||||||
|
|
||||||
Face = FontGdi->SharedFace->Face;
|
Face = FontGdi->SharedFace->Face;
|
||||||
|
|
||||||
//FontGdi->OriginalWeight = WeightFromStyle(Face->style_name);
|
//FontGdi->OriginalWeight = WeightFromStyle(Face->style_name);
|
||||||
|
|
|
@ -3,7 +3,11 @@
|
||||||
* LICENSE: GPL - See COPYING in the top level directory
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
* FILE: win32ss/gdi/ntgdi/text.c
|
* FILE: win32ss/gdi/ntgdi/text.c
|
||||||
* PURPOSE: Text/Font
|
* PURPOSE: Text/Font
|
||||||
* PROGRAMMER:
|
* PROGRAMMERS: Amine Khaldi <amine.khaldi@reactos.org>
|
||||||
|
* Timo Kreuzer <timo.kreuzer@reactos.org>
|
||||||
|
* James Tabor <james.tabor@reactos.org>
|
||||||
|
* Hermes Belusca-Maito <hermes.belusca@sfr.fr>
|
||||||
|
* Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Includes ******************************************************************/
|
/** Includes ******************************************************************/
|
||||||
|
@ -512,12 +516,14 @@ NtGdiGetTextFaceW(
|
||||||
|
|
||||||
TextObj = RealizeFontInit(hFont);
|
TextObj = RealizeFontInit(hFont);
|
||||||
ASSERT(TextObj != NULL);
|
ASSERT(TextObj != NULL);
|
||||||
fLen = wcslen(TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfFaceName) + 1;
|
fLen = wcslen(TextObj->FaceName) + 1;
|
||||||
|
if (fLen > LF_FACESIZE)
|
||||||
|
fLen = LF_FACESIZE;
|
||||||
|
|
||||||
if (FaceName != NULL)
|
if (FaceName != NULL)
|
||||||
{
|
{
|
||||||
Count = min(Count, fLen);
|
Count = min(Count, fLen);
|
||||||
Status = MmCopyToCaller(FaceName, TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfFaceName, Count * sizeof(WCHAR));
|
Status = MmCopyToCaller(FaceName, TextObj->FaceName, Count * sizeof(WCHAR));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
TEXTOBJ_UnlockText(TextObj);
|
TEXTOBJ_UnlockText(TextObj);
|
||||||
|
@ -525,11 +531,19 @@ NtGdiGetTextFaceW(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Terminate if we copied only part of the font name */
|
/* Terminate if we copied only part of the font name */
|
||||||
if (Count > 0 && Count < fLen)
|
|
||||||
{
|
|
||||||
FaceName[Count - 1] = '\0';
|
|
||||||
}
|
|
||||||
ret = Count;
|
ret = Count;
|
||||||
|
if (Count > 0 && Count <= fLen)
|
||||||
|
{
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
FaceName[Count - 1] = '\0';
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue