Commit 63484057 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Avoid creating a family object just to retrieve the font data.

parent afee133b
...@@ -2983,14 +2983,13 @@ struct fontdir ...@@ -2983,14 +2983,13 @@ struct fontdir
#include <poppack.h> #include <poppack.h>
static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, static void GetEnumStructs(Face *face, const WCHAR *family_name, LPENUMLOGFONTEXW pelf,
NEWTEXTMETRICEXW *pntm, LPDWORD ptype); NEWTEXTMETRICEXW *pntm, LPDWORD ptype);
static BOOL get_fontdir( const char *unix_name, struct fontdir *fd ) static BOOL get_fontdir( const char *unix_name, struct fontdir *fd )
{ {
FT_Face ft_face = new_ft_face( unix_name, NULL, 0, 0, FALSE ); FT_Face ft_face = new_ft_face( unix_name, NULL, 0, 0, FALSE );
Face *face; Face *face;
Family *family;
WCHAR *name, *english_name; WCHAR *name, *english_name;
ENUMLOGFONTEXW elf; ENUMLOGFONTEXW elf;
NEWTEXTMETRICEXW ntm; NEWTEXTMETRICEXW ntm;
...@@ -2999,12 +2998,12 @@ static BOOL get_fontdir( const char *unix_name, struct fontdir *fd ) ...@@ -2999,12 +2998,12 @@ static BOOL get_fontdir( const char *unix_name, struct fontdir *fd )
if (!ft_face) return FALSE; if (!ft_face) return FALSE;
face = create_face( ft_face, 0, unix_name, NULL, 0, 0, FALSE, 0 ); face = create_face( ft_face, 0, unix_name, NULL, 0, 0, FALSE, 0 );
get_family_names( ft_face, &name, &english_name, FALSE ); get_family_names( ft_face, &name, &english_name, FALSE );
family = create_family( name, english_name );
insert_face_in_family_list( face, family );
pFT_Done_Face( ft_face ); pFT_Done_Face( ft_face );
GetEnumStructs( face, &elf, &ntm, &type ); GetEnumStructs( face, name, &elf, &ntm, &type );
free_family( family ); free_face( face );
HeapFree( GetProcessHeap(), 0, name );
HeapFree( GetProcessHeap(), 0, english_name );
if ((type & TRUETYPE_FONTTYPE) == 0) return FALSE; if ((type & TRUETYPE_FONTTYPE) == 0) return FALSE;
...@@ -5091,7 +5090,7 @@ static DWORD create_enum_charset_list(DWORD charset, struct enum_charset_list *l ...@@ -5091,7 +5090,7 @@ static DWORD create_enum_charset_list(DWORD charset, struct enum_charset_list *l
return n; return n;
} }
static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, static void GetEnumStructs(Face *face, const WCHAR *family_name, LPENUMLOGFONTEXW pelf,
NEWTEXTMETRICEXW *pntm, LPDWORD ptype) NEWTEXTMETRICEXW *pntm, LPDWORD ptype)
{ {
GdiFont *font; GdiFont *font;
...@@ -5123,7 +5122,7 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, ...@@ -5123,7 +5122,7 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf,
return; return;
} }
font->name = strdupW(face->family->FamilyName); font->name = strdupW( family_name );
font->ntmFlags = face->ntmFlags; font->ntmFlags = face->ntmFlags;
if (get_outline_text_metrics(font)) if (get_outline_text_metrics(font))
...@@ -5152,11 +5151,11 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf, ...@@ -5152,11 +5151,11 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf,
pntm->ntmTm.ntmCellHeight = pntm->ntmTm.tmHeight; pntm->ntmTm.ntmCellHeight = pntm->ntmTm.tmHeight;
pntm->ntmTm.ntmAvgWidth = pntm->ntmTm.tmAveCharWidth; pntm->ntmTm.ntmAvgWidth = pntm->ntmTm.tmAveCharWidth;
lstrcpynW(pelf->elfLogFont.lfFaceName, face->family->FamilyName, LF_FACESIZE); lstrcpynW(pelf->elfLogFont.lfFaceName, family_name, LF_FACESIZE);
if (face->FullName) if (face->FullName)
lstrcpynW(pelf->elfFullName, face->FullName, LF_FULLFACESIZE); lstrcpynW(pelf->elfFullName, face->FullName, LF_FULLFACESIZE);
else else
lstrcpynW(pelf->elfFullName, face->family->FamilyName, LF_FULLFACESIZE); lstrcpynW(pelf->elfFullName, family_name, LF_FULLFACESIZE);
lstrcpynW(pelf->elfStyle, face->StyleName, LF_FACESIZE); lstrcpynW(pelf->elfStyle, face->StyleName, LF_FACESIZE);
} }
...@@ -5227,7 +5226,7 @@ static BOOL enum_face_charsets(const Family *family, Face *face, struct enum_cha ...@@ -5227,7 +5226,7 @@ static BOOL enum_face_charsets(const Family *family, Face *face, struct enum_cha
DWORD type = 0; DWORD type = 0;
int i; int i;
GetEnumStructs(face, &elf, &ntm, &type); GetEnumStructs(face, face->family->FamilyName, &elf, &ntm, &type);
for(i = 0; i < list->total; i++) { for(i = 0; i < list->total; i++) {
if(!face->scalable && face->fs.fsCsb[0] == 0) { /* OEM bitmap */ if(!face->scalable && face->fs.fsCsb[0] == 0) { /* OEM bitmap */
elf.elfLogFont.lfCharSet = ntm.ntmTm.tmCharSet = OEM_CHARSET; elf.elfLogFont.lfCharSet = ntm.ntmTm.tmCharSet = OEM_CHARSET;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment