From ef857c3d80ee1f2eeb58a945f660cfffb4e7d603 Mon Sep 17 00:00:00 2001 From: Byeongsik Jeon Date: Fri, 8 Feb 2019 10:51:32 +0900 Subject: [PATCH] gdi32: Add a helper macro for FreeType version check. Signed-off-by: Byeongsik Jeon Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard (cherry picked from commit 9d92acaa56a7649840adfa0485d632e6b76a0d9f) Signed-off-by: Michael Stefaniuc --- dlls/gdi32/freetype.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index c38108eece5..0f1390f6631 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -130,6 +130,7 @@ typedef struct } FT_Version_t; static FT_Version_t FT_Version; static DWORD FT_SimpleVersion; +#define FT_VERSION_VALUE(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch)) static void *ft_handle = NULL; @@ -1003,7 +1004,7 @@ static BOOL is_subpixel_rendering_enabled( void ) if (enabled == -1) { /* FreeType >= 2.8.1 offers LCD-optimezed rendering without lcd filters. */ - if (FT_SimpleVersion >= ((2 << 16) | (8 << 8) | (1 << 0))) + if (FT_SimpleVersion >= FT_VERSION_VALUE(2, 8, 1)) enabled = TRUE; #ifdef FT_LCD_FILTER_H else if (pFT_Library_SetLcdFilter && @@ -2188,7 +2189,7 @@ static FT_Face new_ft_face( const char *file, void *font_data_ptr, DWORD font_da } /* There are too many bugs in FreeType < 2.1.9 for bitmap font support */ - if (!FT_IS_SCALABLE( ft_face ) && FT_SimpleVersion < ((2 << 16) | (1 << 8) | (9 << 0))) + if (!FT_IS_SCALABLE( ft_face ) && FT_SimpleVersion < FT_VERSION_VALUE(2, 1, 9)) { WARN("FreeType version < 2.1.9, skipping bitmap font %s/%p\n", debugstr_a(file), font_data_ptr); goto fail; @@ -7119,7 +7120,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, vertical_metrics = (tategaki && FT_HAS_VERTICAL(ft_face)); /* there is a freetype bug where vertical metrics are only properly scaled and correct in 2.4.0 or greater */ - if ((vertical_metrics) && (FT_Version.major < 2 || (FT_Version.major == 2 && FT_Version.minor < 4))) + if (vertical_metrics && FT_SimpleVersion < FT_VERSION_VALUE(2, 4, 0)) vertical_metrics = FALSE; if (needsTransform || format != GGO_BITMAP) load_flags |= FT_LOAD_NO_BITMAP;