gdi32: correct substitutions
Rafał Mużyło
galtgendo at gmail.com
Mon Feb 14 09:41:58 CST 2011
As described in bug 25717, wine doesn't have recursive substitutions.
As such, if substitutions are added in b->c, a->b order, it's transformed
correctly to a->c, however if the order is a->b, b->c, transformation
doesn't happen.
This patch corrects the problem - it may need a bit polish though.
-------------- next part --------------
--- dlls/gdi32/freetype.c.old 2011-02-04 20:06:51.000000000 +0100
+++ dlls/gdi32/freetype.c 2011-02-14 16:23:21.488936305 +0100
@@ -945,11 +945,27 @@
return NULL;
}
+static FontSubst *get_font_subst_reverse(const struct list *subst_list, const WCHAR *to_name,
+ INT to_charset)
+{
+ FontSubst *element;
+
+ LIST_FOR_EACH_ENTRY(element, subst_list, FontSubst, entry)
+ {
+ if(!strcmpiW(element->to.name, to_name) &&
+ (element->to.charset == to_charset ||
+ element->to.charset == -1))
+ return element;
+ }
+
+ return NULL;
+}
+
#define ADD_FONT_SUBST_FORCE 1
static BOOL add_font_subst(struct list *subst_list, FontSubst *subst, INT flags)
{
- FontSubst *from_exist, *to_exist;
+ FontSubst *from_exist, *to_exist, *reverse_to_exist;
from_exist = get_font_subst(subst_list, subst->from.name, subst->from.charset);
@@ -971,9 +987,18 @@
HeapFree(GetProcessHeap(), 0, subst->to.name);
subst->to.name = strdupW(to_exist->to.name);
}
-
+
list_add_tail(subst_list, &subst->entry);
+ reverse_to_exist = get_font_subst_reverse(subst_list, subst->from.name, subst->from.charset);
+ if(reverse_to_exist)
+ {
+ list_remove(&reverse_to_exist->entry);
+ HeapFree(GetProcessHeap(), 0, &reverse_to_exist->to.name);
+ reverse_to_exist->to.name = strdupW(subst->to.name);
+ list_add_tail(subst_list, &reverse_to_exist->entry);
+ }
+
return TRUE;
}
More information about the wine-patches
mailing list