Date: | September 14, 2006 / year-entry #312 |
Tags: | code |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20060914-02/?p=29743 |
Comments: | 34 |
Summary: | Take care not to hard-code boldfacing or italics into your code. Chinese and Japanese characters (and to a somewhat lesser extent, Korean characters) do not suffer many types of boldface well. (The three scripts Chinese, Japanese and Korean are collectively called "CJK" scripts.) Many characters are very intricate, and making the strokes bolder can result... |
Take care not to hard-code boldfacing or italics into your code. Chinese and Japanese characters (and to a somewhat lesser extent, Korean characters) do not suffer many types of boldface well. (The three scripts Chinese, Japanese and Korean are collectively called "CJK" scripts.) Many characters are very intricate, and making the strokes bolder can result in a big blob of ink. Consider the Traditional Chinese character 慶 which means "celebrate". Making it boldface results in 慶 which, depending on which operating system and fonts you have installed, might come out as an unreadable mess. Similarly, CJK scripts do not often use italics on screen, since they also make the characters harder to read. What should you do in your program if you need to emphasize something? You should let the localizers choose how they want the emphasis to be performed by allowing them to specify the font face, size and attributes. That way, the localizers for Western languages can specify boldface, whereas those localizing for Chinese or Japanese can specify a larger font size or different font face instead. Different versions of Windows cope with boldface CJK fonts with different degrees of success. Windows 2000, as I recall, used a simplified simulated boldface, which didn't handle CJK fonts very well. Windows XP, I'm told, has an enhanced boldface simulation algorithm for CJK fonts. The result is not perfect, but it is much better than what was available in Windows 2000. Windows Vista finally bridges the gap and provides separate boldface fonts for CJK. These custom boldface fonts have been tuned specifically for this purpose and (I'm told) are quite readable. |
Comments (34)
Comments are closed. |
I don’t have the required fonts on my system with Mozilla, so I get question marks. Sometimes I get square boxes.
This is not a complaint, just a comment.
Given your interest in Germanic languages, you might’ve mentioned that the German use letter spacing for emphasis.
Another interesting problem for those of us learning Chinese (or Japanese, in my case), is that the same character can have different stroke counts when displayed in different font sizes, which makes the problem of recognition all the more complex.
That is, complex characters drop strokes as they get smaller to avoid becoming blobs.
@George Jansen:
I have only seen letter spacing for emphasis on typewriter (or with computers where the author wants to emulate a typewriter). Today, it is very uncommon in Germany.
It seems like it should be the responsibility of the OS and font author to ensure that the font is displayed properly with bold and/or italic, and to not use them if it is impossible to do so.
It seems like it should be the responsibility of the OS and font author to ensure that the font is displayed properly with bold and/or italic, and to not use them if it is impossible to do so.
This is exactly what firefox appears to have done with these characters. The normal and bold versions look the same on my screen (nearly unreadably small as it is – bolding it would make certainly make it unreadable)
Chris: I’m also using Firefox, and it definately does something. It’s kind of a horizontal only bolding though. Look especially at the left bar and the little triangle shape of the top. Also, it’s an inky mess. :)
It’s not just bold, italic too. The Japanese fonts on XP don’t have italic, so the system simulates italic by slanting the characters, which looks horrible. Not that the XP fonts need much help with that; since they don’t support ClearType and have no hinting they look pretty awful at small sizes anyway.
Vista’s new Japanese font (called Meiryo) solves these issues by having real italic and bold, and even the base font is such a huge improvement in legibility that it’s not even worth comparing them. I copied Meiryo to my PocketPC too. Seeing that awesome font on a 192DPI display with ClearType enabled is typographic heaven! :)
It should come as no surprise that this font is rather big: the two files that make up all variations of the font (regular, italic, bold and bold italic) together are 15MB!
The downside of course is that it’ll be a long time before third-party apps (and webpages) start using this font, especially since it’s only available on Vista (unlike the C-fonts (Consolas, Cambria, Calibra, etc.) Meiryo isn’t included with Office 2007.
Oh, and in Japanese, words are sometimes emphasised by writing them in katakana; because katakana characters are far more "blocky" than hiragana and (most) kanji, they stand out.
Raymond, yes, you got it. If the choice is only between unreadable bold text and readable plain text, I’d pick readable plain text. Of course, I’d prefer readable bold text.
In short, this isn’t something that we should have to worry about. There’s absolutely no way we can know what font is going to be used, assuming that we’re good citizens and respect the user’s font choice, and whether or not making that font bold or italic will result in readable text. So that means either that bold and italic are simply not usable at all, which is just ridiculous, or it leaves it to the OS and the font writers to make it so that everything degrades gracefully when bold or italic doesn’t work.
Regular readers may recall the following five posts:
Sometimes, uppercasing sucks
A localizability…
GregM: Raymond is right. Presumably, you want the text bold for a reason, and if the system just ignores that and displays it non-bold, then (from my point of view as the developer) it’s just as useless as unreadable text. From the point of view of the user, perhaps, it’s "better", but either way, the app needs to change so that I have SOME way to emphasize my text (maybe a different colour instead?)
Regular readers may recall the following five posts:
Sometimes, uppercasing sucks
A localizability…
if only RGB was signed, then you could specify extra black RGB(-255,-255,-255) and the whole bold thing would be moot…
[Win2k FF here, "regular" size, CRT monitor, both characters came out clearly, one bold, one not.]
Sometimes you must force the display to comply with your specification, even at the expense of readability. In "Print preview" this is clearly critical. Graphics programs, too.
But in most components, style (any font attribute) is far less significant a loss than content (the affected word).
Basic accessibility is something any programmer ought already "worry about". Many systems can’t display our ideal font attributes: text-only monitors, screen readers, systems without suitable fonts, autotranslated pages, mono screens, "small vs large fonts", non-BiDi-aware, mobile devices, etc ad nauseum.
So, since it’s physically impossible to "localise" a program for all systems on which it may be used, I disagree with (my probably-incorrect reading of) the original post, where it claims that it should be left completely to the localisers.
Instead, I feel that the localisers should at best be able to give hints: XHTML’s ’em’ tag is a good example: it means "this ought to be emphasised, where possible", and the client (and ultimately, the end-user) should have the final say on how and whether it is emphasised, *emphasised*, <b>emphasised</b>, EMPHASISED, [b]emphasised[/b], or <font size="+1">emphasised</font>.
These are intuitive concepts to all good web programmers, but may seem alien at first to GUI programmers, and to people accustomed to graphic design for print, as these have traditionally placed layout and style as pre-eminent and immutable, and content as just "that stuff that’ll replace the lorem ipsum".
Thursday, September 14, 2006 10:?? PM by Dean Harding
[Norman Diamond:]
>> No. The way to emphasise a word or phrase
>> or sentence, where the wording has been
>> written in a standard style, is to put
>> a dot next to each character.
>
>Well, that’s the way to do it for CJK. I
>assume it would come under the heading
>of "attributes"
I think it should be the heading of "emphasis".
>> Yeah but not dots ^_^
>
> A font designer could do that in their font.
Double the size of the font file just for dots? In fonts that can be italicized or emboldened, extra storage is needed because italicizing isn’t just slanting and emboldening isn’t just changing more pixels from background colour to foreground colour. But dots for emphasis are displayed just as dots next to an unchanged character.
> Just another reason I find this obsession
> with ClearType so annoying
But ClearType brings enormous improvements in the rendering of characters in fonts that have only simple characters. (For example if you render an English word or a Spanish digit in Tahoma then it’ll be ClearTyped but in MS Gothic it wouldn’t be ClearTyped (except maybe at huge sizes).) ClearType works a lot better than older style smoothing in these cases.
The reason I dislike Meiryo is that the characters still have to be fattened and fewer of them fit in the available space; I do like the ClearTyping but think the "tax" in order to get it is too high.
<i> i </i>
Hey, what’s that slanty i foreign character doing there?
Faux boldface is an abomination, and should *never* be used. The same goes for faux italic/oblique, faux small caps, faux subscript and superscript, faux condensed and expanded, and so on.
If emphasis is needed, the application should substitute a similar typeface that does possess the desired weight and style, rather than resorting to the horrors of algorithmic generation. ("Similar" may be determined via PANOSE or a similar method of classification.) This is not an ideal solution, and it introduces its own problems, but it’s better than the current situation.
The application should be able to choose whether to do this substitution itself or to have the OS do the substitution automatically.
"In Chinese, emphasis in body text is supposed to be indicated by using an "emphasis mark" (着重號), which is a dot placed under each character to be emphasized." (from Wikipedia)
IOW you shouldn’t be bolding the damn things anyway.
The operative word was *should*. I wasn’t talking about "what we have to do to work around the failings of the OS and font designers". I was talking about how this *should* be solved.
Xan: a lot of us keep complaining about the ClearType issue. I like ClearType – on a monitor which can display it well. On a cheap CRT monitor like those I suffer along with at work, it’s terrible.
As for italics, Vista RC1 has a setup error where it installs two copies of Trebuchet MS Bold Italic and no Trebuchet MS Italic. When called upon to do Trebuchet MS Italic, therefore, GDI (et al) fake one up by slanting Trebuchet MS – which looks awful. Vincent Connare went to the trouble of drawing it, so it would be nice if it was included. I have reported this bug but as a Customer Preview Program member, I can’t see the status of it.
Mike Dimmick: have you tried the ClearType tuner (either the powertoy, or the web-based activex)? I found out that it’s possible to make ClearType look good with it even on bad CRTs (and some LCDs, where the default ClearType settings look fuzzy).
@steveg:
If only RGB was complex, then you could specify the angle of the black RGB(0+80i, 0+80i, 0+80i) and then the users could view it through polarized glasses and identify the bold characters just by tilting their heads….
All "decorations" should be considered localizable. This includes font family, font style, color, size, underscore, etc.
The localizer should be able to complete remove it and replace it with other mechanisms: emphasis marks, quotation marks, upercasing, etc.
See here for some examples:
– http://en.wikipedia.org/wiki/Punctuation
– http://en.wikipedia.org/wiki/Boldface
Friday, September 15, 2006 4:41 AM by Xan
[Norman Diamond]
>> But ClearType brings enormous improvements
>
> Having the left side of a character red is a
> big improvement ?!
If ClearType’s default configuration and your screen’s dot layout produce such an unfortunate effect, Microsoft has a page that you can view in Internet Explorer to adjust the ClearType settings. I wonder why the same tool can’t be executed locally under Windows XP, but anyway, it’s there.
If all ClearType options yield such an unfortunate effect then of course you have to turn off ClearType on your screen.
I’ve used a few dozen screens that benefit from ClearType as intended. If I run across one that yields the result you have, I will be glad that ClearType can be disabled on that machine…
> The sad fact is that we’re seeing an increase
> of applications which force ClearType even if
> the user choice is different (Word is not the
> only one) :(
… well, sometimes anyway.
Friday, September 15, 2006 12:38 PM by Mike Dimmick
> I have reported this bug but as a Customer
> Preview Program member, I can’t see the
> status of it.
You’re probably not missing much. If you could see the status and the status would be closed without any explanation, it wouldn’t matter much, right? Or it might be closed as “not reproduceable” because it’s 100% reproducible only outside of Microsoft.
ender: thank you, I’m aware of the tuner – others may not have been, so thanks for posting it. No setting looks right on the (poor) monitors I use at work. I’m very happy with it on this LCD at home.
Raymond, if you want to track it, this was a completely clean install on an empty disk – Beta 2 had been installed, but I deleted the partition and recreated it during Pre-RC1 (5536.16385) setup. I did this again when moving from Pre-RC1 to RC1.
It happened on both Pre-RC1 – where the second copy of Bold Italic was installed with the name of trebucit.ttf, which suggests that the wrong source file was referenced in building setup – and on RC1 (5600.16384) itself, where somehow there were two copies of trebucbi.ttf listed. That is, both copies of Trebuchet MS Bold Italic in the fonts folder indicated that the font file name was trebucbi.ttf. Of trebucit.ttf was there none. I’m running Windows XP right now (dual-booting with RC1, XP is on a different physical hard disk) so can’t look in the registry.
Copying the font file from Windows XP fixes the problem.