[OpenJDK 2D-Dev] [PATCH] support Mongolian and FVS(Mongolian Free Variation Selector)

Nakajima Akira nakajima.akira at nttcom.co.jp
Wed Jun 20 07:41:53 UTC 2018


Hi All.

Now, SWING does not display Mongolian correctly.

  # See "Mongolian Glyph Convergence", etc..
http://www.unicode.org/versions/Unicode10.0.0/ch13.pdf#G27803


This is patch for support Mongolian and FVS(Mongolian Free Variation 
Selector).
  # This patch is separated from JDK-8187100.

I checked on CentOS 7.5 and Windows7 SP1 x64.
Patch works properly or not is unknown on other OS(Mac etc..).
It will be helpful if person having environment check it.

Thanks.
Akira Nakajima


====================
PATCH
====================
diff -r e1b3def12624 
src/java.desktop/share/classes/sun/font/FontUtilities.java
--- a/src/java.desktop/share/classes/sun/font/FontUtilities.java    Wed 
Jun 13 06:35:04 2018 +0200
+++ b/src/java.desktop/share/classes/sun/font/FontUtilities.java    Wed 
Jun 13 14:14:08 2018 +0900
@@ -299,6 +299,9 @@
          else if (code <= 0x17ff) { // 1780 - 17FF Khmer
              return true;
          }
+        else if (code <= 0x18af) { // 1800 - 18AF Mongolian (including FVS)
+            return true;
+        }
          else if (code < 0x200c) {
              return false;
          }



====================
Sample (mongol2.java)
====================
import javax.swing.*;
import java.awt.Font;
import java.awt.BorderLayout;

public class mongol2 extends JFrame{

   public static void main(String[] args) {
     mongol2 frame = new mongol2();

     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     frame.setBounds(10, 10, 650, 700);
     frame.setVisible(true);
   }

   mongol2() {
     String family = "Mongolian Art";

     String str[] = new String[9];
     str[0] = new String("ᠤ ᠷ ᠲ ᠤ   --> ᠤᠷᠲᠤ (urtu)\n");
     str[1] = new String("ᠣ ᠷ ᠳ ᠤ   --> ᠣᠷᠳᠤ (ordu)\n");
     str[2] = new String("ᠡ ᠨ ᠳ ᠡ   --> ᠡᠨᠳᠡ (ende)\n");
     str[3] = new String("ᠠ ᠳ ᠠ     --> ᠠᠳᠠ  (ada)\n");
     str[4] = new String("ᠠ ᠪ ᠤ   --> ᠠᠪᠤ (abu)\n");
     str[5] = new String("ᠣ ᠳ ᠣ   --> ᠣᠳᠣ (odo)\n");
     str[6] = new String("ᠡ ᠨ ᠡ   --> ᠡᠨᠡ (ene)\n");
     str[7] = new String("ᠭ ᠠ  --> ᠭᠠ (gal)\n");
     str[8] = new String("ᠭ᠋ ᠠ  --> ᠭ᠋ᠠ (gal+U+180B)\n");

     String str_for_area = new String("");
     for (int i=0; i<9; i++) {
       str_for_area += str[i].toString();
     }

     JTextArea area = new JTextArea(str_for_area, 9, 10);
     area.setFont(new Font(family, 0, 48));

     JPanel p = new JPanel();
     p.add(area);
     getContentPane().add(p, BorderLayout.CENTER);
   }
}


--------------------------------------
Company: NTT Comware Corporation
Name: Akira Nakajima
E-Mail: nakajima.akira at nttcom.co.jp
--------------------------------------


More information about the 2d-dev mailing list