https://git.reactos.org/?p=reactos.git;a=commitdiff;h=82b7d4f3da9db3786cf84…
commit 82b7d4f3da9db3786cf84820fea4d2768a433e37
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Jan 18 22:33:00 2025 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Jan 18 22:33:00 2025 +0900
[FREETYPE][NTGDI] Fix ftGdiGetTextMetricsW return for raster fonts (#7635)
Try to get ready to support raster fonts.
JIRA issue: CORE-17327
- Fix the return value of
ftGdiGetTextMetricsW function
for raster fonts.
---
win32ss/gdi/ntgdi/freetype.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c
index 8deb9e6820b..86e3c7a4106 100644
--- a/win32ss/gdi/ntgdi/freetype.c
+++ b/win32ss/gdi/ntgdi/freetype.c
@@ -3164,7 +3164,7 @@ IntGetOutlineTextMetrics(PFONTGDI FontGDI,
Otm->otmSize = Cache->OutlineRequiredSize;
- FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, !Error ? &WinFNT : 0);
+ FillTM(&Otm->otmTextMetrics, FontGDI, pOS2, pHori, (Error ? NULL :
&WinFNT));
if (!pOS2)
goto skip_os2;
@@ -5318,25 +5318,26 @@ ftGdiGetTextMetricsW(
Status = STATUS_SUCCESS;
IntLockFreeType();
+
+ Error = FT_Get_WinFNT_Header(Face, &Win);
pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
- if (NULL == pOS2)
+ pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
+
+ if (!pOS2 && Error)
{
DPRINT1("Can't find OS/2 table - not TT font?\n");
Status = STATUS_INTERNAL_ERROR;
}
- pHori = FT_Get_Sfnt_Table(Face, ft_sfnt_hhea);
- if (NULL == pHori)
+ if (!pHori && Error)
{
DPRINT1("Can't find HHEA table - not TT font?\n");
Status = STATUS_INTERNAL_ERROR;
}
- Error = FT_Get_WinFNT_Header(Face, &Win);
-
- if (NT_SUCCESS(Status) || !Error)
+ if (NT_SUCCESS(Status))
{
- FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win
: 0);
+ FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, (Error ? NULL :
&Win));
/* FIXME: Fill Diff member */
}