Commit d77104b9 authored by Kusanagi Kouichi's avatar Kusanagi Kouichi Committed by Alexandre Julliard

gdi32: Remove unused parameters and code, and a useless wrapper function.

parent eab02574
...@@ -1490,7 +1490,7 @@ static WCHAR *prepend_at(WCHAR *family) ...@@ -1490,7 +1490,7 @@ static WCHAR *prepend_at(WCHAR *family)
#define ADDFONT_FORCE_BITMAP 0x02 #define ADDFONT_FORCE_BITMAP 0x02
#define ADDFONT_ADD_TO_CACHE 0x04 #define ADDFONT_ADD_TO_CACHE 0x04
static void AddFaceToList(FT_Face ft_face, char *fake_family, const char *file, void *font_data_ptr, DWORD font_data_size, FT_Long face_index, DWORD flags, BOOL vertical) static void AddFaceToList(FT_Face ft_face, const char *file, void *font_data_ptr, DWORD font_data_size, FT_Long face_index, DWORD flags, BOOL vertical)
{ {
int bitmap_num = 0; int bitmap_num = 0;
Family *family; Family *family;
...@@ -1511,24 +1511,16 @@ static void AddFaceToList(FT_Face ft_face, char *fake_family, const char *file, ...@@ -1511,24 +1511,16 @@ static void AddFaceToList(FT_Face ft_face, char *fake_family, const char *file,
if(!FT_IS_SCALABLE(ft_face)) if(!FT_IS_SCALABLE(ft_face))
size = (My_FT_Bitmap_Size *)ft_face->available_sizes + bitmap_num; size = (My_FT_Bitmap_Size *)ft_face->available_sizes + bitmap_num;
if (fake_family) english_family = get_face_name(ft_face, TT_NAME_ID_FONT_FAMILY, TT_MS_LANGID_ENGLISH_UNITED_STATES);
if (!english_family)
english_family = towstr(CP_ACP, ft_face->family_name);
localised_family = get_face_name(ft_face, TT_NAME_ID_FONT_FAMILY, GetUserDefaultLCID());
if (localised_family && !strcmpiW(localised_family, english_family))
{ {
english_family = towstr(CP_ACP, fake_family); HeapFree(GetProcessHeap(), 0, localised_family);
localised_family = NULL; localised_family = NULL;
} }
else
{
english_family = get_face_name(ft_face, TT_NAME_ID_FONT_FAMILY, TT_MS_LANGID_ENGLISH_UNITED_STATES);
if (!english_family)
english_family = towstr(CP_ACP, ft_face->family_name);
localised_family = get_face_name(ft_face, TT_NAME_ID_FONT_FAMILY, GetUserDefaultLCID());
if (localised_family && !strcmpiW(localised_family, english_family))
{
HeapFree(GetProcessHeap(), 0, localised_family);
localised_family = NULL;
}
}
if (vertical) if (vertical)
{ {
...@@ -1597,11 +1589,6 @@ static void AddFaceToList(FT_Face ft_face, char *fake_family, const char *file, ...@@ -1597,11 +1589,6 @@ static void AddFaceToList(FT_Face ft_face, char *fake_family, const char *file,
debugstr_w(family->FamilyName), debugstr_w(StyleW), debugstr_w(family->FamilyName), debugstr_w(StyleW),
face->font_version, pHeader ? pHeader->Font_Revision : 0); face->font_version, pHeader ? pHeader->Font_Revision : 0);
if(fake_family) {
TRACE("This font is a replacement but the original really exists, so we'll skip the replacement\n");
HeapFree(GetProcessHeap(), 0, StyleW);
return;
}
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);
...@@ -1706,12 +1693,11 @@ static void AddFaceToList(FT_Face ft_face, char *fake_family, const char *file, ...@@ -1706,12 +1693,11 @@ static void AddFaceToList(FT_Face ft_face, char *fake_family, const char *file,
debugstr_w(StyleW)); debugstr_w(StyleW));
} }
static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_size, char *fake_family, const WCHAR *target_family, DWORD flags) static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_size, DWORD flags)
{ {
FT_Face ft_face; FT_Face ft_face;
TT_OS2 *pOS2; TT_OS2 *pOS2;
TT_Header *pHeader = NULL; TT_Header *pHeader = NULL;
WCHAR *localised_family;
FT_Error err; FT_Error err;
FT_Long face_index = 0, num_faces; FT_Long face_index = 0, num_faces;
INT ret = 0; INT ret = 0;
...@@ -1720,7 +1706,7 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_ ...@@ -1720,7 +1706,7 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_
assert(file || !(flags & ADDFONT_EXTERNAL_FONT)); assert(file || !(flags & ADDFONT_EXTERNAL_FONT));
#ifdef HAVE_CARBON_CARBON_H #ifdef HAVE_CARBON_CARBON_H
if(file && !fake_family) if(file)
{ {
char **mac_list = expand_mac_font(file); char **mac_list = expand_mac_font(file);
if(mac_list) if(mac_list)
...@@ -1730,7 +1716,7 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_ ...@@ -1730,7 +1716,7 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_
for(cursor = mac_list; *cursor; cursor++) for(cursor = mac_list; *cursor; cursor++)
{ {
had_one = TRUE; had_one = TRUE;
AddFontToList(*cursor, NULL, 0, NULL, NULL, flags); AddFontToList(*cursor, NULL, 0, flags);
HeapFree(GetProcessHeap(), 0, *cursor); HeapFree(GetProcessHeap(), 0, *cursor);
} }
HeapFree(GetProcessHeap(), 0, mac_list); HeapFree(GetProcessHeap(), 0, mac_list);
...@@ -1809,26 +1795,12 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_ ...@@ -1809,26 +1795,12 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_
return 0; return 0;
} }
if (target_family) AddFaceToList(ft_face, file, font_data_ptr, font_data_size, face_index, flags, FALSE);
{
localised_family = get_face_name(ft_face, TT_NAME_ID_FONT_FAMILY, GetUserDefaultLCID());
if (localised_family && strcmpiW(localised_family,target_family)!=0)
{
TRACE("Skipping Index %i: Incorrect Family name for replacement\n",(INT)face_index);
HeapFree(GetProcessHeap(), 0, localised_family);
num_faces = ft_face->num_faces;
pFT_Done_Face(ft_face);
continue;
}
HeapFree(GetProcessHeap(), 0, localised_family);
}
AddFaceToList(ft_face, fake_family, file, font_data_ptr, font_data_size, face_index, flags, FALSE);
++ret; ++ret;
if (FT_HAS_VERTICAL(ft_face)) if (FT_HAS_VERTICAL(ft_face))
{ {
AddFaceToList(ft_face, fake_family, file, font_data_ptr, font_data_size, face_index, flags, TRUE); AddFaceToList(ft_face, file, font_data_ptr, font_data_size, face_index, flags, TRUE);
++ret; ++ret;
} }
...@@ -1838,11 +1810,6 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_ ...@@ -1838,11 +1810,6 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_
return ret; return ret;
} }
static INT AddFontFileToList(const char *file, char *fake_family, const WCHAR *target_family, DWORD flags)
{
return AddFontToList(file, NULL, 0, fake_family, target_family, flags);
}
static void DumpFontList(void) static void DumpFontList(void)
{ {
Family *family; Family *family;
...@@ -2270,7 +2237,7 @@ static BOOL ReadFontDir(const char *dirname, BOOL external_fonts) ...@@ -2270,7 +2237,7 @@ static BOOL ReadFontDir(const char *dirname, BOOL external_fonts)
{ {
DWORD addfont_flags = ADDFONT_ADD_TO_CACHE; DWORD addfont_flags = ADDFONT_ADD_TO_CACHE;
if(external_fonts) addfont_flags |= ADDFONT_EXTERNAL_FONT; if(external_fonts) addfont_flags |= ADDFONT_EXTERNAL_FONT;
AddFontFileToList(path, NULL, NULL, addfont_flags); AddFontToList(path, NULL, 0, addfont_flags);
} }
} }
closedir(dir); closedir(dir);
...@@ -2339,7 +2306,7 @@ LOAD_FUNCPTR(FcPatternGetString); ...@@ -2339,7 +2306,7 @@ LOAD_FUNCPTR(FcPatternGetString);
if(len < 4) continue; if(len < 4) continue;
ext = &file[ len - 3 ]; ext = &file[ len - 3 ];
if(strcasecmp(ext, "pfa") && strcasecmp(ext, "pfb")) if(strcasecmp(ext, "pfa") && strcasecmp(ext, "pfb"))
AddFontFileToList(file, NULL, NULL, ADDFONT_EXTERNAL_FONT | ADDFONT_ADD_TO_CACHE); AddFontToList(file, NULL, 0, ADDFONT_EXTERNAL_FONT | ADDFONT_ADD_TO_CACHE);
} }
pFcFontSetDestroy(fontset); pFcFontSetDestroy(fontset);
pFcObjectSetDestroy(os); pFcObjectSetDestroy(os);
...@@ -2371,7 +2338,7 @@ static BOOL load_font_from_data_dir(LPCWSTR file) ...@@ -2371,7 +2338,7 @@ static BOOL load_font_from_data_dir(LPCWSTR file)
WideCharToMultiByte(CP_UNIXCP, 0, file, -1, unix_name + strlen(unix_name), len, NULL, NULL); WideCharToMultiByte(CP_UNIXCP, 0, file, -1, unix_name + strlen(unix_name), len, NULL, NULL);
EnterCriticalSection( &freetype_cs ); EnterCriticalSection( &freetype_cs );
ret = AddFontFileToList(unix_name, NULL, NULL, ADDFONT_FORCE_BITMAP | ADDFONT_ADD_TO_CACHE); ret = AddFontToList(unix_name, NULL, 0, ADDFONT_FORCE_BITMAP | ADDFONT_ADD_TO_CACHE);
LeaveCriticalSection( &freetype_cs ); LeaveCriticalSection( &freetype_cs );
HeapFree(GetProcessHeap(), 0, unix_name); HeapFree(GetProcessHeap(), 0, unix_name);
} }
...@@ -2391,7 +2358,7 @@ static BOOL load_font_from_winfonts_dir(LPCWSTR file) ...@@ -2391,7 +2358,7 @@ static BOOL load_font_from_winfonts_dir(LPCWSTR file)
strcatW(windowsdir, file); strcatW(windowsdir, file);
if ((unixname = wine_get_unix_file_name(windowsdir))) { if ((unixname = wine_get_unix_file_name(windowsdir))) {
EnterCriticalSection( &freetype_cs ); EnterCriticalSection( &freetype_cs );
ret = AddFontFileToList(unixname, NULL, NULL, ADDFONT_FORCE_BITMAP); ret = AddFontToList(unixname, NULL, 0, ADDFONT_FORCE_BITMAP);
LeaveCriticalSection( &freetype_cs ); LeaveCriticalSection( &freetype_cs );
HeapFree(GetProcessHeap(), 0, unixname); HeapFree(GetProcessHeap(), 0, unixname);
} }
...@@ -2418,7 +2385,7 @@ static void load_system_fonts(void) ...@@ -2418,7 +2385,7 @@ static void load_system_fonts(void)
sprintfW(pathW, fmtW, windowsdir, data); sprintfW(pathW, fmtW, windowsdir, data);
if((unixname = wine_get_unix_file_name(pathW))) { if((unixname = wine_get_unix_file_name(pathW))) {
added = AddFontFileToList(unixname, NULL, NULL, ADDFONT_FORCE_BITMAP | ADDFONT_ADD_TO_CACHE); added = AddFontToList(unixname, NULL, 0, ADDFONT_FORCE_BITMAP | ADDFONT_ADD_TO_CACHE);
HeapFree(GetProcessHeap(), 0, unixname); HeapFree(GetProcessHeap(), 0, unixname);
} }
if (!added) if (!added)
...@@ -2594,7 +2561,7 @@ INT WineEngAddFontResourceEx(LPCWSTR file, DWORD flags, PVOID pdv) ...@@ -2594,7 +2561,7 @@ INT WineEngAddFontResourceEx(LPCWSTR file, DWORD flags, PVOID pdv)
if(!(flags & FR_PRIVATE)) addfont_flags |= ADDFONT_ADD_TO_CACHE; if(!(flags & FR_PRIVATE)) addfont_flags |= ADDFONT_ADD_TO_CACHE;
EnterCriticalSection( &freetype_cs ); EnterCriticalSection( &freetype_cs );
ret = AddFontFileToList(unixname, NULL, NULL, addfont_flags); ret = AddFontToList(unixname, NULL, 0, addfont_flags);
LeaveCriticalSection( &freetype_cs ); LeaveCriticalSection( &freetype_cs );
HeapFree(GetProcessHeap(), 0, unixname); HeapFree(GetProcessHeap(), 0, unixname);
} }
...@@ -2628,7 +2595,7 @@ HANDLE WineEngAddFontMemResourceEx(PVOID pbFont, DWORD cbFont, PVOID pdv, DWORD ...@@ -2628,7 +2595,7 @@ HANDLE WineEngAddFontMemResourceEx(PVOID pbFont, DWORD cbFont, PVOID pdv, DWORD
memcpy(pFontCopy, pbFont, cbFont); memcpy(pFontCopy, pbFont, cbFont);
EnterCriticalSection( &freetype_cs ); EnterCriticalSection( &freetype_cs );
*pcFonts = AddFontToList(NULL, pFontCopy, cbFont, NULL, NULL, ADDFONT_FORCE_BITMAP); *pcFonts = AddFontToList(NULL, pFontCopy, cbFont, ADDFONT_FORCE_BITMAP);
LeaveCriticalSection( &freetype_cs ); LeaveCriticalSection( &freetype_cs );
if (*pcFonts == 0) if (*pcFonts == 0)
...@@ -3091,7 +3058,7 @@ static void init_font_list(void) ...@@ -3091,7 +3058,7 @@ static void init_font_list(void)
{ {
if((unixname = wine_get_unix_file_name(data))) if((unixname = wine_get_unix_file_name(data)))
{ {
AddFontFileToList(unixname, NULL, NULL, ADDFONT_FORCE_BITMAP | ADDFONT_ADD_TO_CACHE); AddFontToList(unixname, NULL, 0, ADDFONT_FORCE_BITMAP | ADDFONT_ADD_TO_CACHE);
HeapFree(GetProcessHeap(), 0, unixname); HeapFree(GetProcessHeap(), 0, unixname);
} }
} }
...@@ -3104,7 +3071,7 @@ static void init_font_list(void) ...@@ -3104,7 +3071,7 @@ static void init_font_list(void)
sprintfW(pathW, fmtW, windowsdir, data); sprintfW(pathW, fmtW, windowsdir, data);
if((unixname = wine_get_unix_file_name(pathW))) if((unixname = wine_get_unix_file_name(pathW)))
{ {
added = AddFontFileToList(unixname, NULL, NULL, ADDFONT_FORCE_BITMAP | ADDFONT_ADD_TO_CACHE); added = AddFontToList(unixname, NULL, 0, ADDFONT_FORCE_BITMAP | ADDFONT_ADD_TO_CACHE);
HeapFree(GetProcessHeap(), 0, unixname); HeapFree(GetProcessHeap(), 0, unixname);
} }
if (!added) if (!added)
......
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