I am using unicode truetype fonts for telugu.I want to input a sequence of unicode characters in the range specified for telugu and use java functions to display the corresponding letters.Which part of java handles breaking the sequence into clusters ? I 开发者_Go百科believe that in windows UNISCRIBE does it .I would like to know if java has something similar to it
sivachanderIf I understand correctly, you're looking for BreakIterator.getCharacterInstance.
From the documentation:
Character boundary analysis allows users to interact with characters as they expect to, for example, when moving the cursor through a text string. Character boundary analysis provides correct navigation through character strings, regardless of how the character is stored. The boundaries returned may be those of supplementary characters, combining character sequences, or ligature clusters. For example, an accented character might be stored as a base character and a diacritical mark. What users consider to be a character can differ between languages.
Java relies on the underlying libraries for its display routines, but if you want tighter control over them, java-gnome has bindings for both Cairo and Pango.
unless you are developing a new font, you need not know about how the java renders the glyphs based on the unicode code points.
Where ever a string is expected, you can pass in a sequence of unicode code points, and java renders those correctly (vowels, consonants, diacritics on consonants, consonant blending). here is an example
g.drawString("\u0C36\u0C3F\u0C35 \u0C1C\u0C3E\u0C38\u0C4D\u0C24\u0C3F", 75,100);
精彩评论