[PATCH] gdi32: Use font substitution for source font when linking fonts.

Lei Zhang thestig at google.com
Fri Dec 5 18:46:23 CST 2008


This is sort of related to bug 16325. I've noticed some applications
use the "MS Shell Dlg" font to display CJK text and fails.

In HKLM\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes,
MS Shell Dlg is set to Tahoma.

I tried adding a font link for Tahoma in
HKLM\Software\Microsoft\Windows NT\CurrentVersion\FontLink\Systemlink,
but that didn't seem to help. I then tried adding a font link for MS
Shell Dlg, but that didn't have any effect either.

Taking a closer look, in init_system_links(), both the Tahoma and MS
Shell Dlg entries in Systemlink create a Tahoma entry in memory, due
to the MS Shell Dlg -> Tahoma font substitution. However, in
create_child_font_list(), we check the in-memory list for MS Shell
Dlg, which can never be found.

With this additional font substitution, create_child_font_list() looks
for Tahoma instead, and the CJK text gets displayed properly.
-------------- next part --------------
From 4493c7440eed695dbbef6df37e85a8cee830e06c Mon Sep 17 00:00:00 2001
From: Lei Zhang <thestig at google.com>
Date: Fri, 5 Dec 2008 16:22:31 -0800
Subject: [PATCH] gdi32: Use font substitution for source font when linking fonts.

 dlls/gdi32/freetype.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 2894dca..479c57a 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -3180,10 +3180,11 @@ static BOOL create_child_font_list(GdiFont *font)
     BOOL ret = FALSE;
     SYSTEM_LINKS *font_link;
     CHILD_FONT *font_link_entry, *new_child;
+    FontSubst *psub = get_font_subst(&font_subst_list, font->name, -1);
     LIST_FOR_EACH_ENTRY(font_link, &system_links, SYSTEM_LINKS, entry)
-        if(!strcmpW(font_link->font_name, font->name))
+        if(!strcmpW(font_link->font_name, psub ? psub->to.name : font->name))
             TRACE("found entry in system list\n");
             LIST_FOR_EACH_ENTRY(font_link_entry, &font_link->links, CHILD_FONT, entry)

More information about the wine-patches mailing list