Re: Mixing Chinese and Japanese text
Re: Mixing Chinese and Japanese text
- Subject: Re: Mixing Chinese and Japanese text
- From: Douglas Davidson <email@hidden>
- Date: Fri, 15 Sep 2006 12:58:37 -0700
On Sep 15, 2006, at 9:05 AM, Jakob Olesen wrote:
On 15/09/2006, at 16.08, John Stiles wrote:
Explicitly set the font for the Japanese text to a Japanese font,
and the font for the Chinese text to a Chinese font. This should
solve it.
I think I might have to do something like that. The problem is that
modern Chinese and Japanese contains quite a bit of Latin
characters too, check out http://www.sinomac.com/ and http://
www.vodafone.jp/
The Chinese and Japanese fonts typically contain limited support
for Latin characters: US-ASCII and a few accents, but not all. Then
I have the opposite problem with font substitution for Latin text.
I guess I could scan the text for ideographic characters + kana and
set the proper CJK font only for those characters.
Right now it sounds like you're using the default font (Lucida/
Helvetica) and relying on the system to do font substitution. Font
substitution works pretty well, but as you've seen, it is not
perfect—given a CJK character which is shared between Chinese and
Japanese, it has to guess whether it should use a Chinese font or
a Japanese font, and it guesses by looking at your International
prefs.
You are right, I am relying on the system font substitution. It
works really well when it knows the language, so I was hoping for a
way to tell it about the language rather than reinventing the wheel.
Setting an appropriate font based on the characters is probably the
easiest option at the moment. The standard font substitution is
necessarily imperfect. It is possible to override it, however, by
using a custom NSTextStorage and overriding -
fixFontAttributeInRange:. That would allow you to implement a custom
language attribute that you could use to determine a font to
substitute in each individual case.
Douglas Davidson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden