From: Bill C. <bi...@vi...> - 2011-02-18 17:10:18
|
Hi ICU Support, Our Java application is having a problem rendering certain characters in the Malayalam language. A ligature is not being formed for a particular character sequence which prevents the correct rendering of a particular letter. The sequence includes these unicode characters, 0D28 0D4D 200D, which should form the Malayalam letter "Chillu N". It seems that the "Zero Width Joiner" (200D) is not being interpreted correctly. We are using a font called "Kartika" which includes the correct glyph substitution data for this sequence. This issue has been logged as Java bug 7017058. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7017058 I am wondering if there has been any communication from Sun/Oracle on this issue. This is a very critical problem for our Indian customers. Do you have any idea how long it might take for something like this to be fixed? I'm including two short examples. The .html example correctly renders the sequence, while the .java examples does not. Thanks, Bill MalayalamTest.html ================== <html> <head> <title>Malayalam Test</title> </head> <body> <font face="Kartika"> <h3>Testing glyph substitution for Malayalam language</h3> <br> <h1>ബാലന്</h1> <code>0D2C 0D3E 0D32 0D28 0D4D</code> <br><br><br> <h1>ബാലന്‍</h1> <code>0D2C 0D3E 0D32 0D28 0D4D 200D</code> <br> The last three unicode characters form a ligature (glyph substitution) </font> </body> </html> MalayalamTest.java ================== import java.awt.*; import java.awt.font.*; import java.util.*; import javax.swing.*; public class MalayalamTest extends JFrame { private static String[] TEXT = { "Testing glyph substitution for Malayalam language.", "\u0D2C\u0D3E\u0D32\u0D28\u0D4D", "0D2C 0D3E 0D32 0D28 0D4D", "\u0D2C\u0D3E\u0D32\u0D28\u0D4D\u200D", "0D2C 0D3E 0D32 0D28 0D4D 200D", }; private static Font font; public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // set the language to Malayalam Locale.setDefault(new Locale("ml")); // create the rendering font HashMap attrs = new HashMap(); attrs.put(TextAttribute.LIGATURES, TextAttribute.LIGATURES_ON); attrs.put(TextAttribute.KERNING, TextAttribute.KERNING_ON); font = new Font("Kartika", Font.PLAIN, 24).deriveFont(attrs); // display the test JFrame MalayalamTest f = new MalayalamTest(); f.setTitle("Malayalam Test"); f.setSize(600, 500); f.setForeground(Color.black); f.show(); } public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; FontRenderContext frc = g2.getFontRenderContext(); for (int i = 0; i < TEXT.length; i++) { String text = TEXT[i]; int x = 10; int y = 60 + 40*i + 20*((i+1)/2); // render using TextLayout TextLayout layout = new TextLayout(text, font, frc); layout.draw(g2, x, y); // render using GlyphVector // GlyphVector gv = font.layoutGlyphVector(frc, text.toCharArray(), 0, // text.length(), Font.LAYOUT_LEFT_TO_RIGHT); // g2.drawGlyphVector(gv, x, y); } } } |