Jactry Zeng : gdi32: Add a helper to map font replacement.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jul 17 08:03:41 CDT 2015
Module: wine
Branch: master
Commit: cb59350ed9e0eee83284bcd1f889315c9ea8607e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cb59350ed9e0eee83284bcd1f889315c9ea8607e
Author: Jactry Zeng <jzeng at codeweavers.com>
Date: Wed Jul 8 21:53:52 2015 +0800
gdi32: Add a helper to map font replacement.
---
dlls/gdi32/freetype.c | 45 +++++++++++++++++++++++----------------------
1 file changed, 23 insertions(+), 22 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 73824ea..e20e390 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -2240,6 +2240,27 @@ static void DumpFontList(void)
}
}
+static BOOL map_font_family(const WCHAR *orig, const WCHAR *repl)
+{
+ Family *family = find_family_from_any_name(repl);
+ if (family != NULL)
+ {
+ Family *new_family = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_family));
+ if (new_family != NULL)
+ {
+ TRACE("mapping %s to %s\n", debugstr_w(repl), debugstr_w(orig));
+ new_family->FamilyName = strdupW(orig);
+ new_family->EnglishName = NULL;
+ list_init(&new_family->faces);
+ new_family->replacement = &family->faces;
+ list_add_tail(&font_list, &new_family->entry);
+ return TRUE;
+ }
+ }
+ TRACE("%s is not available. Skip this replacement.\n", debugstr_w(repl));
+ return FALSE;
+}
+
/***********************************************************
* The replacement list is a way to map an entire font
* family onto another family. For example adding
@@ -2276,30 +2297,10 @@ static void LoadReplaceList(void)
TRACE("Got %s=%s\n", debugstr_w(value), debugstr_w(data));
/* "NewName"="Oldname" */
if(!find_family_from_any_name(value))
- {
- Family * const family = find_family_from_any_name(data);
- if (family != NULL)
- {
- Family * const new_family = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_family));
- if (new_family != NULL)
- {
- TRACE("mapping %s to %s\n", debugstr_w(data), debugstr_w(value));
- new_family->FamilyName = strdupW(value);
- new_family->EnglishName = NULL;
- list_init(&new_family->faces);
- new_family->replacement = &family->faces;
- list_add_tail(&font_list, &new_family->entry);
- }
- }
- else
- {
- TRACE("%s is not available. Skip this replacement.\n", debugstr_w(data));
- }
- }
+ map_font_family(value, data);
else
- {
TRACE("%s is available. Skip this replacement.\n", debugstr_w(value));
- }
+
/* reset dlen and vlen */
dlen = datalen;
vlen = valuelen;
More information about the wine-cvs
mailing list