I'm trying to get Devanagari ligatures (in Unicode strings) rendered correctly on Mac OS X 10.6.
The strings are drawn on a JComponent
and take RenderingHints
for Antialiasing. The ligatures are displayed correctly in Windows XP SP2 and 7, and Ubuntu, but in Mac OS X, the ligatures are decomposed (or rather, not merged correctly), diacritics are moved away from their positions, etc. (cf. screenshots below, correct rendering example from Win XP SP2 on the left (with RenderingHints
Antialiasing Key ON
), wrong rendering example from Mac OS X 10.6.7 on the right (Antialising DEFAULT
= OFF
).
I have set the font as follows, so it should use a default font on any system:
new Font(null,Font.PLAIN,20);
I believe all this might have something to do with the fact that the default character encoding on Macs is MacRoman (NOT a UTF-8 subset), and that other systems (like Windows) use a UTF-8 subset (such as WinLatin-1) or cp1252 or such.
Even with this information at hand, I'm in the dark about how to handle this problem. Thus I would be very grateful if someone was able to point me in the right direction.
I've tried a number of things already:
- Setting the font to Devanagari MT didn't solve the issue
TextAttribute
LIGATURES_ON
didn't solve the problem
I'd be extremely thankful for any hints, or code snippets by other developers (preferrably with a Hindi background who develop on Mac).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…