[OpenJDK 2D-Dev] [PATCH] support Mongolian and FVS(Mongolian Free Variation Selector)
Nakajima Akira
nakajima.akira at nttcom.co.jp
Fri Jun 22 02:34:23 UTC 2018
Hi Phil.
Thank you very much for advices.
In Mongolian, particular char + char transform to another char. (similar
as Arabic)
Harfbuzz supports it by using Arabic shaper (including FVS).
So this patch set Mongolian as complex to use Arabic shaper.
I created TestMongolian.java
and I posted to GoogleDrive that TestMongolian.java ScreenShots of
before/after applying this patch
<NG - before>
https://drive.google.com/open?id=1aha8xamB44f5XY6RrKYrI9t9czQuuoU2
<OK - after>
https://drive.google.com/open?id=1e_oxCcoHNJQPgbEFEq9tiCEapwbWqm8j
You can see some sample figures.
http://www.unicode.org/versions/Unicode10.0.0/ch13.pdf#G27803
# e.g. Figure 13-3. Mongolian Glyph Convergence
The title "support Mongolia" is not good. It's mistake.
This patch is "to make display Mongolian"
, Not support writing.
By the way, I guess that original harfbuzz supports IVS/SVS in addition
FVS..
# ./harfbuzz/util/hb-view ~/fonts/ipamjm.ttf -u
795e,795e,FE00,795e,E0103 -o hb.png
<hg.png>
https://drive.google.com/open?id=15jJe5b_4M4jHqiN_OFC7RJKuRILgUbsG
Thanks.
Akira Nakajima
diff --git a/src/java.desktop/share/classes/sun/font/FontUtilities.java
b/src/java.desktop/share/classes/sun/font/FontUtilities.java
--- a/src/java.desktop/share/classes/sun/font/FontUtilities.java
+++ b/src/java.desktop/share/classes/sun/font/FontUtilities.java
@@ -278,6 +278,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;
}
diff --git a/test/jdk/java/awt/font/TextLayout/TestMongolian.java
b/test/jdk/java/awt/font/TextLayout/TestMongolian.java
--- /dev/null
+++ b/test/jdk/java/awt/font/TextLayout/TestMongolian.java
@@ -0,0 +1,84 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/* @test
+ * @summary Verify Mongolian(including Mongolian Free Variation
Selector) display
+ */
+
+import javax.swing.*;
+import javax.swing.border.LineBorder;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+
+public class TestMongolian {
+ public static void main(String[] args) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ new TestMongolian().run();
+ }
+ });
+ }
+
+ private void run() {
+ Font ourFont = null;
+ final String fontName = "mnglartotf.ttf"; // Mongoalian Art Font
+ // download from http://www.mongolfont.com/en/font/mnglartotf.html
+ // place in $(user.home)/fonts/
+ try {
+ ourFont = Font.createFont(Font.TRUETYPE_FONT, new
java.io.File(new java.io.File(System.getProperty("user.home"),"fonts"),
fontName));
+ ourFont = ourFont.deriveFont((float)48.0);
+ } catch(Throwable t) {
+ t.printStackTrace();
+ System.err.println("Fail: " + t);
+ return;
+ }
+ JFrame frame = new JFrame(System.getProperty("java.version"));
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ JPanel panel = new JPanel();
+ final JTextArea label = new JTextArea("(empty)");
+ label.setSize(750, 750);
+ label.setBorder(new LineBorder(Color.black));
+ label.setFont(ourFont);
+
+ // You can see correct form from
http://www.unicode.org/versions/Unicode10.0.0/ch13.pdf
+ // chapter 13.5 Mongolian
+ final String str = "\u1824 \u1837 \u1832 \u1824 -->
\u1824\u1837\u1832\u1824 (urtu)\n"
+ + "\u1823 \u1837 \u1833 \u1824 -->
\u1823\u1837\u1833\u1824 (ordu)\n"
+ + "\u1821 \u1828 \u1833 \u1821 -->
\u1821\u1828\u1833\u1821 (ende)\n"
+ + "\u1820 \u1833 \u1820 -->
\u1820\u1833\u1820 (ada)\n"
+ + "\u1820 \u182A \u1824 -->
\u1820\u182A\u1824 (abu)\n"
+ + "\u1823 \u1833 \u1823 -->
\u1823\u1833\u1823 (odo)\n"
+ + "\u1821 \u1828 \u1821 -->
\u1821\u1828\u1821 (ene)\n"
+ + "\u182D \u1820 \u182F -->
\u182D\u1820\u182F (gal)\n"
+ + "\u182D\u180B \u1820 \u182F -->
\u182D\u180B\u1820\u182F (gal with FVS1)\n"
+ + "\u1835 \u1820 \u1837 \u182F \u1822 \u182D
--> \u1835\u1820\u1837\u182F\u1822\u182D (jarlig)\n"
+ + "\u1834 \u1821 \u1837 \u1822 \u182D -->
\u1834\u1821\u1837\u1822\u182D (cherig)\n";
+
+ label.setText(str);
+ panel.add(label);
+
+ frame.getContentPane().add(panel);
+ frame.pack();
+ frame.setVisible(true);
+ }
+}
--------------------------------------
Company: NTT Comware Corporation
Name: Akira Nakajima
E-Mail: nakajima.akira at nttcom.co.jp
--------------------------------------
More information about the 2d-dev
mailing list