1 /* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. 7 * 8 * This code is distributed in the hope that it will be useful, but WITHOUT 9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 * version 2 for more details (a copy is included in the LICENSE file that 12 * accompanied this code). 13 * 14 * You should have received a copy of the GNU General Public License version 15 * 2 along with this work; if not, write to the Free Software Foundation, 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 * 18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 * or visit www.oracle.com if you need additional information or have any 20 * questions. 21 * 22 */ 23 24 /* @test @(#)TestTibetan.java 25 * @summary verify tibetan output 26 * @bug 6886358 27 * @ignore Requires a special font installed 28 */ 29 30 import javax.swing.*; 31 import javax.swing.border.LineBorder; 32 import java.awt.*; 33 import java.awt.event.ActionEvent; 34 35 public class TestTibetan { main(String[] args)36 public static void main(String[] args) { 37 SwingUtilities.invokeLater(new Runnable() { 38 public void run() { 39 new TestTibetan().run(); 40 } 41 }); 42 } 43 public static boolean AUTOMATIC_TEST=true; // true; run test automatically, else manually at button push 44 run()45 private void run() { 46 Font ourFont = null; 47 try { 48 //For best results: Font from: http://download.savannah.gnu.org/releases/free-tibetan/jomolhari/ 49 // place in $(user.home)/fonts/ 50 ourFont = Font.createFont(Font.TRUETYPE_FONT, new java.io.File(new java.io.File(System.getProperty("user.home"),"fonts"), "Jomolhari-alpha3c-0605331.ttf")); 51 52 //ourFont = new Font("serif",Font.PLAIN, 24); 53 ourFont = ourFont.deriveFont((float)24.0); 54 } catch(Throwable t) { 55 t.printStackTrace(); 56 System.err.println("Fail: " + t); 57 return; 58 } 59 JFrame frame = new JFrame(System.getProperty("java.version")); 60 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 61 JPanel panel = new JPanel(); 62 final JTextArea label = new JTextArea("(empty)"); 63 label.setSize(400, 300); 64 label.setBorder(new LineBorder(Color.black)); 65 label.setFont(ourFont); 66 67 final String str = "\u0F04\u0F05\u0F0D\u0F0D\u0020\u0F4F\u0F72\u0F53\u0F0B\u0F4F\u0F72\u0F53\u0F0B\u0F42\u0FB1\u0F72\u0F0B\u0F51\u0F54\u0F60\u0F0B\u0F62\u0FA9\u0F63"; // TinTin. 68 69 if(AUTOMATIC_TEST) { /* run the test automatically (else, manually) */ 70 label.setText(str); 71 } else { 72 JButton button = new JButton("Set Char x0DDD"); 73 button.addActionListener(new AbstractAction() { 74 public void actionPerformed(ActionEvent actionEvent) { 75 label.setText(str); 76 } 77 }); 78 panel.add(button); 79 } 80 panel.add(label); 81 82 frame.getContentPane().add(panel); 83 frame.pack(); 84 frame.setVisible(true); 85 } 86 } 87 88