Commit bdfef823 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdi32: AddFontResource should return a number of added font faces.

parent 71929ffc
...@@ -953,7 +953,7 @@ static WCHAR *get_familyname(FT_Face ft_face) ...@@ -953,7 +953,7 @@ static WCHAR *get_familyname(FT_Face ft_face)
#define ADDFONT_EXTERNAL_FONT 0x01 #define ADDFONT_EXTERNAL_FONT 0x01
#define ADDFONT_FORCE_BITMAP 0x02 #define ADDFONT_FORCE_BITMAP 0x02
static BOOL AddFontFileToList(const char *file, char *fake_family, const WCHAR *target_family, DWORD flags) static INT AddFontFileToList(const char *file, char *fake_family, const WCHAR *target_family, DWORD flags)
{ {
FT_Face ft_face; FT_Face ft_face;
TT_OS2 *pOS2; TT_OS2 *pOS2;
...@@ -987,7 +987,7 @@ static BOOL AddFontFileToList(const char *file, char *fake_family, const WCHAR * ...@@ -987,7 +987,7 @@ static BOOL AddFontFileToList(const char *file, char *fake_family, const WCHAR *
} }
HeapFree(GetProcessHeap(), 0, mac_list); HeapFree(GetProcessHeap(), 0, mac_list);
if(had_one) if(had_one)
return TRUE; return 1;
} }
} }
#endif /* HAVE_CARBON_CARBON_H */ #endif /* HAVE_CARBON_CARBON_H */
...@@ -998,20 +998,20 @@ static BOOL AddFontFileToList(const char *file, char *fake_family, const WCHAR * ...@@ -998,20 +998,20 @@ static BOOL AddFontFileToList(const char *file, char *fake_family, const WCHAR *
TRACE("Loading font file %s index %ld\n", debugstr_a(file), face_index); TRACE("Loading font file %s index %ld\n", debugstr_a(file), face_index);
if((err = pFT_New_Face(library, file, face_index, &ft_face)) != 0) { if((err = pFT_New_Face(library, file, face_index, &ft_face)) != 0) {
WARN("Unable to load font file %s err = %x\n", debugstr_a(file), err); WARN("Unable to load font file %s err = %x\n", debugstr_a(file), err);
return FALSE; return 0;
} }
if(!FT_IS_SFNT(ft_face) && (FT_IS_SCALABLE(ft_face) || !(flags & ADDFONT_FORCE_BITMAP))) { /* for now we'll accept TT/OT or bitmap fonts*/ if(!FT_IS_SFNT(ft_face) && (FT_IS_SCALABLE(ft_face) || !(flags & ADDFONT_FORCE_BITMAP))) { /* for now we'll accept TT/OT or bitmap fonts*/
WARN("Ignoring font %s\n", debugstr_a(file)); WARN("Ignoring font %s\n", debugstr_a(file));
pFT_Done_Face(ft_face); pFT_Done_Face(ft_face);
return FALSE; return 0;
} }
/* There are too many bugs in FreeType < 2.1.9 for bitmap font support */ /* 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 < ((2 << 16) | (1 << 8) | (9 << 0))) {
WARN("FreeType version < 2.1.9, skipping bitmap font %s\n", debugstr_a(file)); WARN("FreeType version < 2.1.9, skipping bitmap font %s\n", debugstr_a(file));
pFT_Done_Face(ft_face); pFT_Done_Face(ft_face);
return FALSE; return 0;
} }
if(FT_IS_SFNT(ft_face) && (!pFT_Get_Sfnt_Table(ft_face, ft_sfnt_os2) || if(FT_IS_SFNT(ft_face) && (!pFT_Get_Sfnt_Table(ft_face, ft_sfnt_os2) ||
...@@ -1020,13 +1020,13 @@ static BOOL AddFontFileToList(const char *file, char *fake_family, const WCHAR * ...@@ -1020,13 +1020,13 @@ static BOOL AddFontFileToList(const char *file, char *fake_family, const WCHAR *
TRACE("Font file %s lacks either an OS2, HHEA or HEAD table.\n" TRACE("Font file %s lacks either an OS2, HHEA or HEAD table.\n"
"Skipping this font.\n", debugstr_a(file)); "Skipping this font.\n", debugstr_a(file));
pFT_Done_Face(ft_face); pFT_Done_Face(ft_face);
return FALSE; return 0;
} }
if(!ft_face->family_name || !ft_face->style_name) { if(!ft_face->family_name || !ft_face->style_name) {
TRACE("Font file %s lacks either a family or style name\n", debugstr_a(file)); TRACE("Font file %s lacks either a family or style name\n", debugstr_a(file));
pFT_Done_Face(ft_face); pFT_Done_Face(ft_face);
return FALSE; return 0;
} }
if (target_family) if (target_family)
...@@ -1140,13 +1140,13 @@ static BOOL AddFontFileToList(const char *file, char *fake_family, const WCHAR * ...@@ -1140,13 +1140,13 @@ static BOOL AddFontFileToList(const char *file, char *fake_family, const WCHAR *
TRACE("This font is a replacement but the original really exists, so we'll skip the replacement\n"); TRACE("This font is a replacement but the original really exists, so we'll skip the replacement\n");
HeapFree(GetProcessHeap(), 0, StyleW); HeapFree(GetProcessHeap(), 0, StyleW);
pFT_Done_Face(ft_face); pFT_Done_Face(ft_face);
return FALSE; return 0;
} }
if(!pHeader || pHeader->Font_Revision <= face->font_version) { if(!pHeader || pHeader->Font_Revision <= face->font_version) {
TRACE("Original font is newer so skipping this one\n"); TRACE("Original font is newer so skipping this one\n");
HeapFree(GetProcessHeap(), 0, StyleW); HeapFree(GetProcessHeap(), 0, StyleW);
pFT_Done_Face(ft_face); pFT_Done_Face(ft_face);
return FALSE; return 0;
} else { } else {
TRACE("Replacing original with this one\n"); TRACE("Replacing original with this one\n");
list_remove(&face->entry); list_remove(&face->entry);
...@@ -1218,7 +1218,7 @@ static BOOL AddFontFileToList(const char *file, char *fake_family, const WCHAR * ...@@ -1218,7 +1218,7 @@ static BOOL AddFontFileToList(const char *file, char *fake_family, const WCHAR *
TRACE("Added font %s %s\n", debugstr_w(family->FamilyName), TRACE("Added font %s %s\n", debugstr_w(family->FamilyName),
debugstr_w(StyleW)); debugstr_w(StyleW));
} while(num_faces > ++face_index); } while(num_faces > ++face_index);
return TRUE; return num_faces;
} }
static void DumpFontList(void) static void DumpFontList(void)
......
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