gdi32: correct substitutions (take 2)
Rafał Mużyło
galtgendo at gmail.com
Mon Feb 14 14:23:49 CST 2011
Corrected version of the previous patch.
This time I'm not adding a new helper function, just putting it in one
place.
Corrections:
- as oppossed to get_font_subst, reverse check can have more than one
result, so changed to adjust all of them
- just in case a->a substitution would result, explicitly prevent that
(perhaps gdi32 handles it gracefully, but it's still redundant)
-------------- next part --------------
--- dlls/gdi32/freetype.c.old 2011-02-04 20:06:51.000000000 +0100
+++ dlls/gdi32/freetype.c 2011-02-14 21:11:25.556395305 +0100
@@ -949,7 +949,7 @@
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;
from_exist = get_font_subst(subst_list, subst->from.name, subst->from.charset);
@@ -971,7 +971,26 @@
HeapFree(GetProcessHeap(), 0, subst->to.name);
subst->to.name = strdupW(to_exist->to.name);
}
-
+
+ LIST_FOR_EACH_ENTRY(reverse_to, subst_list, FontSubst, entry)
+ {
+ if(!strcmpiW(reverse_to->to.name, subst->from.name) &&
+ (reverse_to->to.charset == subst->from.charset ||
+ reverse_to->to.charset == -1))
+ {
+ list_remove(&reverse_to->entry);
+ HeapFree(GetProcessHeap(), 0, reverse_to->to.name);
+ if (strcmpiW(reverse_to->from.name, subst->to.name))
+ {
+ reverse_to->to.name = strdupW(subst->to.name);
+ list_add_tail(subst_list, &reverse_to->entry);
+ } else {
+ HeapFree(GetProcessHeap(), 0, &reverse_to->from.name);
+ HeapFree(GetProcessHeap(), 0, reverse_to);
+ }
+ }
+ }
+
list_add_tail(subst_list, &subst->entry);
return TRUE;
More information about the wine-patches
mailing list