Akihiro Sagawa : gdi32: Get rid of redundant ntmCellHeight member.

Alexandre Julliard julliard at winehq.org
Wed Apr 7 15:48:31 CDT 2021


Module: wine
Branch: master
Commit: 629ba19200ef6ef53d2ddb2503d198299f1f0921
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=629ba19200ef6ef53d2ddb2503d198299f1f0921

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Tue Apr  6 21:34:22 2021 +0900

gdi32: Get rid of redundant ntmCellHeight member.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/font.c        | 6 ++++--
 dlls/gdi32/freetype.c    | 1 -
 dlls/gdi32/gdi_private.h | 1 -
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index fd03580a754..067d76ba9fd 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -2714,10 +2714,12 @@ static BOOL get_face_enum_data( struct gdi_font_face *face, ENUMLOGFONTEXW *elf,
     if (font_funcs->set_outline_text_metrics( font ))
     {
         static const DWORD ntm_ppem = 32;
+        UINT cell_height;
 
 #define TM font->otm.otmTextMetrics
 #define SCALE_NTM(value) (MulDiv( ntm->ntmTm.tmHeight, (value), TM.tmHeight ))
-        ntm->ntmTm.tmHeight = MulDiv( ntm_ppem, font->ntmCellHeight, font->otm.otmEMSquare );
+        cell_height = TM.tmHeight / ( -lf.lfHeight / font->otm.otmEMSquare );
+        ntm->ntmTm.tmHeight = MulDiv( ntm_ppem, cell_height, font->otm.otmEMSquare );
         ntm->ntmTm.tmAscent = SCALE_NTM( TM.tmAscent );
         ntm->ntmTm.tmDescent = ntm->ntmTm.tmHeight - ntm->ntmTm.tmAscent;
         ntm->ntmTm.tmInternalLeading = SCALE_NTM( TM.tmInternalLeading );
@@ -2729,7 +2731,7 @@ static BOOL get_face_enum_data( struct gdi_font_face *face, ENUMLOGFONTEXW *elf,
                (const char *)&TM + offsetof( TEXTMETRICW, tmWeight ),
                sizeof(TEXTMETRICW) - offsetof( TEXTMETRICW, tmWeight ));
         ntm->ntmTm.ntmSizeEM = font->otm.otmEMSquare;
-        ntm->ntmTm.ntmCellHeight = font->ntmCellHeight;
+        ntm->ntmTm.ntmCellHeight = cell_height;
         ntm->ntmTm.ntmAvgWidth = font->ntmAvgWidth;
 #undef SCALE_NTM
 #undef TM
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index c66db289ab1..b29d9fcc88e 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -3775,7 +3775,6 @@ static BOOL CDECL freetype_set_outline_text_metrics( struct gdi_font *font )
         descent = windescent;
     }
 
-    font->ntmCellHeight = ascent + descent;
     font->ntmAvgWidth = pOS2->xAvgCharWidth;
 
 #define SCALE_X(x) (pFT_MulFix(x, em_scale))
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 2bf16e8eaf8..71493c185b6 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -344,7 +344,6 @@ struct gdi_font
     SHORT                  yMax;
     SHORT                  yMin;
     UINT                   ntmFlags;
-    UINT                   ntmCellHeight;
     UINT                   ntmAvgWidth;
     UINT                   aa_flags;
     ULONG                  ttc_item_offset;    /* 0 if font is not a part of TrueType collection */




More information about the wine-cvs mailing list