1 /* 2 * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 /* @test 26 * @bug 8031462 8198406 27 * @requires (os.family == "mac") 28 * @summary verify rendering of MORX fonts on OS X. 29 */ 30 31 import java.awt.Font; 32 import java.awt.Graphics; 33 import java.awt.Graphics2D; 34 import java.awt.RenderingHints; 35 import java.awt.image.BufferedImage; 36 37 import static java.awt.image.BufferedImage.TYPE_INT_ARGB; 38 39 public class TestAATMorxFont { main(String[] args)40 public static void main(String[] args) { 41 String osName = System.getProperty("os.name"); 42 System.out.println("OS is " + osName); 43 osName = osName.toLowerCase(); 44 if (!osName.startsWith("mac")) { 45 return; 46 } 47 BufferedImage bi = new BufferedImage(1200, 400, TYPE_INT_ARGB); 48 Graphics g = bi.getGraphics(); 49 test(g); 50 g.dispose(); 51 } 52 test(Graphics g)53 private static void test(Graphics g) { 54 Graphics2D g2d = (Graphics2D)g; 55 g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, 56 RenderingHints.VALUE_TEXT_ANTIALIAS_ON); 57 int y = 50; 58 g.setFont(new Font("Gujarati MT", Font.PLAIN, 40)); 59 System.out.println(g.getFont()); 60 g.drawString("\u0A95\u0ACD \u0A95\u0A95\u0A95 \u0A95\u0ACD\u0A95\u0ACD\u0A95", 20, y); 61 y += 50; 62 g.setFont(new Font("Tamil Sangam MN", Font.PLAIN, 40)); 63 System.out.println(g.getFont()); 64 g.drawString("\u0b95\u0bCD \u0b95\u0b95\u0b95 \u0b95\u0bCD\u0b95\u0bCD\u0b95", 20, y); 65 y += 50; 66 g.setFont(new Font("Telugu Sangam MN", Font.PLAIN, 40)); 67 System.out.println(g.getFont()); 68 g.drawString("\u0c15\u0c4D \u0c15\u0c15\u0c15 \u0c15\u0c4D\u0c15\u0c4D\u0c15", 20, y); 69 y += 50; 70 g.setFont(new Font("Devanagari Sangam MN", Font.PLAIN, 40)); 71 System.out.println(g.getFont()); 72 g.drawString("\u0915\u0940 \u0915\u0947 \u0915\u0942", 20, y); 73 y += 50; 74 g.drawString("\u0907\u0930\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915", 20, y); 75 y += 50; 76 g.drawString("\u0930\u093F\u0935\u094D\u092F\u0942 \u0915\u0947 \u092C\u093E\u0926 \u0935\u093F\u0915\u093E\u0938 \u0913\u0932\u0902\u092A\u093F\u0915 \u0938\u0947 \u092C\u093E\u0939\u0930 (\u0926\u0947\u0935\u0928\u093E\u0917\u0930\u0940) (\u0939\u093F\u0928\u094D\u0926\u0940) \u0907\u0930\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915\u094D\u0915", 20, y); 77 78 } 79 } 80 81