"Aric Stewart" aric@codeweavers.com wrote:
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 145be9b..c427694 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -3408,8 +3408,8 @@ GdiFont *WineEngCreateFontInstance(DC *dc, HFONT hfont) */ LIST_FOR_EACH(family_elem_ptr, &font_list) { family = LIST_ENTRY(family_elem_ptr, Family, entry);
if (!strcmpiW(family->FamilyName, FaceName) ||
(psub && !strcmpiW(family->FamilyName, psub->to.name)))
if (( psub && !strcmpiW(family->FamilyName, psub->to.name)) ||
(!psub && !strcmpiW(family->FamilyName, FaceName))) { LIST_FOR_EACH(face_elem_ptr, &family->faces) { face = LIST_ENTRY(face_elem_ptr, Face, entry);
After loking at this change once more I think it's not correct. It will lead to failures to find a font if there is a substitution but a face specified by substitution doesn't exist. I'd suggest to test what Windows does in that case, and if Windows allows to substitute existing faces at all. Do you have a test cases which passes with your patch but doesn't without it?
You are mostly correct. It looks like windows totally ignores the font substitute if it finds the correct font. So this patch is incorrect.
Is there a good mechanic to get wine to force a substitution for a broken font? If the user has FontX however their FontX does not render correctly with freetype so we want to replace it with FontY...
-aric
Dmitry Timoshkov wrote:
"Aric Stewart" aric@codeweavers.com wrote:
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 145be9b..c427694 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -3408,8 +3408,8 @@ GdiFont *WineEngCreateFontInstance(DC *dc, HFONT hfont) */ LIST_FOR_EACH(family_elem_ptr, &font_list) { family = LIST_ENTRY(family_elem_ptr, Family, entry);
if (!strcmpiW(family->FamilyName, FaceName) ||
(psub && !strcmpiW(family->FamilyName, psub->to.name)))
if (( psub && !strcmpiW(family->FamilyName,
psub->to.name)) ||
(!psub && !strcmpiW(family->FamilyName, FaceName))) { LIST_FOR_EACH(face_elem_ptr, &family->faces) { face = LIST_ENTRY(face_elem_ptr, Face, entry);
After loking at this change once more I think it's not correct. It will lead to failures to find a font if there is a substitution but a face specified by substitution doesn't exist. I'd suggest to test what Windows does in that case, and if Windows allows to substitute existing faces at all. Do you have a test cases which passes with your patch but doesn't without it?
"Aric Stewart" aric@codeweavers.com wrote:
You are mostly correct. It looks like windows totally ignores the font substitute if it finds the correct font. So this patch is incorrect.
Is there a good mechanic to get wine to force a substitution for a broken font? If the user has FontX however their FontX does not render correctly with freetype so we want to replace it with FontY...
Does font render correctly in other programs beside Wine? If no, there is no point IMO to add any workarounds, just ask the user to move the font out of the way. Is there a way to detect if the font is broken? What if either freetype or the font get fixed later?