3 Replies Latest reply on Jul 8, 2009 10:16 PM by 843810

    How to display Chinese Character(s) in a image on a Linux platform?


      I have the following code that runs perfect on Windows XP system after I installed the Chinese fonts on it, and set the fontconfig file under jre.
      What the program does is: load an image file, write some Chinese chars in it and redisplay the image, so that the image will contain the Chinese characters in it.

      I ported the generating image with Chinese Characers part of code into a web application which the servlet returns the modified image to client. The web application is running on a linux box. However, when a user views the image on the browser, the Chinese chars are not well displayed (they are just several squares).

      My question is, does the problem comes from the Chinese fonts settings on the linux system where the servlet is running on? And, how to fix the problem, any simple links on how to do that?


      public void paint(Graphics g) {

      ImageIcon photo = new ImageIcon("C:\\image.jpg");

      Graphics2D g2 = (Graphics2D)g;
      g2.drawImage(photo.getImage(), 0, 0, null);

      g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      Font font = new Font("Arial Unicode MS", Font.PLAIN, 16);

      g2.drawString("’†•¶", 140, 220);