Font substitution and linking #3
by Michael S. Kaplan, published on 2005/06/19 00:20 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/06/18/430507.aspx
Earlier posts about font linking, substitution and fallback were:
Font substitution and linking #1 (About font substitution)
Font substitution and linking #2 (About industrial strength font linking, with MLang)
Anyway, at the end of last month, M.W. Grossman asked me the following question:
Unicode is so much fun. My company has paid me to read through most of your writing today (thanks for the Steve Taylor tip) but haven't found anything that gets into what I'm looking for, namely the method used to determine which font is selected and how to influence this.
My problem lies in a mixed CJK system. The won, yuan and yen characters are being displayed differently depending on the client OS (Win2K, CHT/CHS/KOR/JPN). In JPN, everything displays well but both CHT and CHS mangle all currencies but the yuan and dollar. All machines have a number of CJK fonts in addition to MS Mincho and clearly there's some font substitution going on, but how and where? I can't be the only one wondering about this but I can't find anything on the subject beyond references to "MS Shell Dlg 2".
An interesting problem, one that is rooted in the issues of Han unification that I have discussed previously.
What it comes down to is that there are many characters which can have four different possible looks:
- Japanese will default to using MS UI Gothic (fallback to PMingLIU, then SimSun, then Gulim)
- Korean will default to using Gulim (fallback to PMingLiu, then MS UI Gothic, then SimSun)
- Simplified Chinese will default to using SimSun (fallback to PMingLiu, then MS UI Gothic, then Batang)
- Traditional Chinese will default to using PMingLiu (fallback to SimSun, then MS Mincho, then Batang)
Now there are nuances like when you install HKSCS stuff for Hong Kong or GB18030 stuff for China and other random things that I'll talk some other time. But the above four are the msin font linking rules.
The change depends on the setting of the NLS default system locale (meaning of course that this is a setting that is not just for non-Unicode programs!). It affects the behavior of several things, according to the rules spelled out above for each group -- linking to the fonts in that given order:
- The preferred font for each group (for EA system locales)
- Lucida Sans Unicode
- Microsoft Sans Serif (not MS Sans Serif!)
This is the most common Windows XP/Server 2003 list, it changes a bit between versions depending on default UI fonts -- mainly by adding new entries but leaving the old ones intact. Your mileage may vary, especially as some third party font installs will often try to modify these settings, often with success but occasionally with messed up registry setttings....
Now I have gone on for quite a while here, without explaining what this linking does. The essential task performed is to give the operating system a list of fonts to look in and an order to look in them when the requested character cannot be found in the original font. Given that both Han unification and typographic traditions will dictate a specific look, feel, and glyph design to each font, the list is chosen so that a cirrect choice for the default system locale is most likely to give an intuitive look to the text that is shown on Windows.
The actual mapping is found in the registry; it is seen in the values under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink. A change requires a new windowstation, which for all shipping versions of Windows means either a reboot (which the default system locale requires anyway) or a new Terminal Services session.
Of course, the user can always override these things if he wants to by explicitly choosing the 'right' default system locale; the developer can override these things if she needs to p.r.n. by choosing the fonts to use, explicitly. But in both cases, the user and the developer will often just use the default.
But if you are a developer who is wanting to influence the selection here, PLEASE consider explicitly choosing a font rather than changing a system wide setting....
This post brought to you by "一" (U+4e00, a.k.a. the first CJK Unified Idedograph)
One of the few ideographs used by all languages that use Han/Kanji/Hanja but that does not tend to vary too much in style....
# Mihai on 19 Jun 2005 3:35 PM:
Back in March you wrote:
"In fact, one of the first things I do with each new version of Word is find out how to set the Print TrueType Fonts as Graphics setting..."
To achieve this I go to the printer settings - advanced - printing defaults - advanced, and change Truetype font from "Substitute with Device Font" to "Download as Softfont"
Some printer drivers also give access to the substitution table. I set everything to use downloaded fonts.
This improves the performance, works for all applications, not only Word, and never had a problem.
# Michael S. Kaplan on 19 Jun 2005 7:20 PM:
Yep, that is the setting I mean -- I should have been more specific about whose dialogs moved around -- it is not Word's (although if you go there from Word, *their* dialogs move around, too!). It is either the ones from the Windows print dlg or the ones from the driver. Or sometimes both....
Great tip, though. Thanks!
# Mike Lippert on 29 Jun 2005 11:55 AM:
OK, Supposed my application installs a font that supports some of the specialized math characters (and not much else). Is it really a bad idea to append this font to the font linking list for the system?
I'd like these characters to show up in browsers, and other documents that use these Unicode characters without having to actually select a font each time they're used.
Granted that this would also make displaying these characters in tooltip messages in my app easier.
# Michael S. Kaplan on 29 Jun 2005 12:17 PM:
The thing is that these characters will also be in other fonts. So if you put your math font at the top of the list, people wsill randomly pick up this differently styled text for individual characters. And if you put it at the bottom, your math text will suffer with the same problem.
Font linking should be a last resort if you want things to look right -- and I assume that when you do math you want things to always look right?
# Mike Lippert on 7 Jul 2005 8:26 PM:
Well, your assumption is correct, for the math it had better look right. However, I'm actually working on getting the tooltips to display correctly and we don't need that many characters. Actually right now we only need the U+0192 Latin Small Letter F With Hook and U+2192 Rightwards Arrow. They're even usually available in the normal Arial font. However they aren't both available in Tahoma, and the user is free to change the tooltip font using the Windows Display Properties.
I guess I was hoping that I could have our installer modify a font-linking entry in the registry so that those characters would always be available and not ever be displayed as a square box.
Wouldn't it be better to have the massive Unicode font as a final fallback so that the user sees some reasonable approximation of what character is being displayed, rather than a square box?
# Michael S. Kaplan on 7 Jul 2005 11:07 PM:
Well, one cannot always assume that fonts like Arial Unicode MS will be there (it does not ship with the OS), and in some cases (like CJK) the glyphs in that font may not be preferred at all, which can make it problematic as a fallback that could be seeing so much use, potentially....
# Mike Lippert on 12 Jul 2005 6:29 PM:
OK, so it's really not a good idea to modify the system wide font-linking.
That means I'll have to go back to one of your earlier posts and figure out how to create a font-linked font when displaying tooltips.
Could you give me any advice as to which font I could choose to link that should have the 2 characters named above (U+0192 & U+2192) and exists on all versions of Windows (2000 & above) internationally? (Actually I'm most interested in the English, European and Chinese, Japanese and Korean Windows). Arial on my system has both those characters, but can I assume that will be true on all the Windows systems?
I think that this is likely a common issue, that people want a few rare characters to display and are not sure how to make that happen, or whether they can count on them existing on all systems.
# Michael S. Kaplan on 13 Jul 2005 12:18 AM:
You can actually assume that Arial will be on all of those systems -- it is one of the "core fonts" that is always there.
# Mike Lippert on 13 Jul 2005 10:28 AM:
Thanks for your help Michael. And many many thanks for your blog!
Please consider a donation
to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.
go to newer or older post, or back to index or month or day