From dc241a83711465e6373a35cc4e9b8cde8a6bd94f Mon Sep 17 00:00:00 2001 From: Akihiro Sagawa Date: Wed, 31 Jul 2013 23:16:26 +0900 Subject: [PATCH] gdi32: Add a helper function to get bitmap size. --- dlls/gdi32/freetype.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index a994132e4b6..abdc25d963f 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -1895,15 +1895,23 @@ static inline DWORD get_ntm_flags( FT_Face ft_face ) return flags; } -static inline int get_bitmap_internal_leading( FT_Face ft_face ) +static inline void get_bitmap_size( FT_Face ft_face, Bitmap_Size *face_size ) { - int internal_leading = 0; + My_FT_Bitmap_Size *size; FT_WinFNT_HeaderRec winfnt_header; - if (!pFT_Get_WinFNT_Header( ft_face, &winfnt_header )) - internal_leading = winfnt_header.internal_leading; + size = (My_FT_Bitmap_Size *)ft_face->available_sizes; + TRACE("Adding bitmap size h %d w %d size %ld x_ppem %ld y_ppem %ld\n", + size->height, size->width, size->size >> 6, + size->x_ppem >> 6, size->y_ppem >> 6); + face_size->height = size->height; + face_size->width = size->width; + face_size->size = size->size; + face_size->x_ppem = size->x_ppem; + face_size->y_ppem = size->y_ppem; - return internal_leading; + if (!pFT_Get_WinFNT_Header( ft_face, &winfnt_header )) + face_size->internal_leading = winfnt_header.internal_leading; } static inline void get_fontsig( FT_Face ft_face, FONTSIGNATURE *fs ) @@ -1974,7 +1982,6 @@ static Face *create_face( FT_Face ft_face, FT_Long face_index, const char *file, { struct stat st; Face *face = HeapAlloc( GetProcessHeap(), 0, sizeof(*face) ); - My_FT_Bitmap_Size *size = (My_FT_Bitmap_Size *)ft_face->available_sizes; face->refcount = 1; face->StyleName = get_face_name( ft_face, TT_NAME_ID_FONT_SUBFAMILY, GetSystemDefaultLangID() ); @@ -2016,15 +2023,7 @@ static Face *create_face( FT_Face ft_face, FT_Long face_index, const char *file, } else { - TRACE("Adding bitmap size h %d w %d size %ld x_ppem %ld y_ppem %ld\n", - size->height, size->width, size->size >> 6, - size->x_ppem >> 6, size->y_ppem >> 6); - face->size.height = size->height; - face->size.width = size->width; - face->size.size = size->size; - face->size.x_ppem = size->x_ppem; - face->size.y_ppem = size->y_ppem; - face->size.internal_leading = get_bitmap_internal_leading( ft_face ); + get_bitmap_size( ft_face, &face->size ); face->scalable = FALSE; }