author | prr |
Tue, 08 May 2018 10:55:09 -0700 | |
changeset 50137 | 941d432aee8b |
parent 50134 | 6064cd8725fa |
permissions | -rw-r--r-- |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
1 |
/* |
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
4 |
* |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
8 |
* |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
13 |
* accompanied this code). |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
14 |
* |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
18 |
* |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
21 |
* questions. |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
22 |
*/ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
23 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
24 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
25 |
/* @test |
50137
941d432aee8b
8202767: java/awt/font/GlyphVector/TestLayoutFlags.java is missing null check
prr
parents:
50134
diff
changeset
|
26 |
@bug 4328745 5090704 8166111 8176510 8202767 |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
27 |
@summary exercise getLayoutFlags, getGlyphCharIndex, getGlyphCharIndices |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
28 |
*/ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
29 |
|
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
30 |
import java.awt.Font; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
31 |
import static java.awt.Font.*; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
32 |
import java.awt.GraphicsEnvironment; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
33 |
import java.awt.font.FontRenderContext; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
34 |
import java.awt.font.GlyphVector; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
35 |
import static java.awt.font.GlyphVector.*; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
36 |
import java.awt.geom.AffineTransform; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
37 |
import java.awt.geom.Point2D; |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
38 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
39 |
public class TestLayoutFlags { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
40 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
41 |
static public void main(String[] args) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
42 |
new TestLayoutFlags().runTest(); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
43 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
44 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
45 |
void runTest() { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
46 |
|
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
47 |
Font font = findFont("abcde"); |
50137
941d432aee8b
8202767: java/awt/font/GlyphVector/TestLayoutFlags.java is missing null check
prr
parents:
50134
diff
changeset
|
48 |
if (font == null) { |
941d432aee8b
8202767: java/awt/font/GlyphVector/TestLayoutFlags.java is missing null check
prr
parents:
50134
diff
changeset
|
49 |
return; // this system is no use for this test. |
941d432aee8b
8202767: java/awt/font/GlyphVector/TestLayoutFlags.java is missing null check
prr
parents:
50134
diff
changeset
|
50 |
} |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
51 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
52 |
String latin1 = "This is a latin1 string"; // none |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
53 |
String hebrew = "\u05d0\u05d1\u05d2\u05d3"; // rtl |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
54 |
String arabic = "\u0646\u0644\u0622\u0646"; // rtl + mc/g |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
55 |
String hindi = "\u0939\u093f\u0923\u094d\u0921\u0940"; // ltr + reorder |
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
56 |
String tamil = "\u0b9c\u0bcb"; // ltr + mg/c + split |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
57 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
58 |
FontRenderContext frc = new FontRenderContext(null, true, true); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
59 |
|
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
60 |
// get glyph char indices needs to initializes layoutFlags before |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
61 |
// use (5090704) |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
62 |
{ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
63 |
GlyphVector gv = font.createGlyphVector(frc, "abcde"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
64 |
int ix = gv.getGlyphCharIndex(0); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
65 |
if (ix != 0) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
66 |
throw new Error("glyph 0 incorrectly mapped to char " + ix); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
67 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
68 |
int[] ixs = gv.getGlyphCharIndices(0, gv.getNumGlyphs(), null); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
69 |
for (int i = 0; i < ixs.length; ++i) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
70 |
if (ixs[i] != i) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
71 |
throw new Error("glyph " + i + " incorrectly mapped to char " + ixs[i]); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
72 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
73 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
74 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
75 |
|
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
76 |
GlyphVector latinGV = makeGlyphVector("latin", latin1, false, frc); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
77 |
GlyphVector hebrewGV = makeGlyphVector("hebrew", hebrew, true, frc); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
78 |
GlyphVector arabicGV = makeGlyphVector("arabic", arabic, true, frc); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
79 |
GlyphVector hindiGV = makeGlyphVector("devanagari", hindi, false, frc); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
80 |
GlyphVector tamilGV = makeGlyphVector("tamil", tamil, false, frc); |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
81 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
82 |
GlyphVector latinPos = font.createGlyphVector(frc, latin1); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
83 |
Point2D pt = latinPos.getGlyphPosition(0); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
84 |
pt.setLocation(pt.getX(), pt.getY() + 1.0); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
85 |
latinPos.setGlyphPosition(0, pt); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
86 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
87 |
GlyphVector latinTrans = font.createGlyphVector(frc, latin1); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
88 |
latinTrans.setGlyphTransform(0, AffineTransform.getRotateInstance(.15)); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
89 |
|
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
90 |
test("latin", latinGV, true, 0); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
91 |
test("hebrew", hebrewGV, true, FLAG_RUN_RTL); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
92 |
test("arabic", arabicGV, true, FLAG_COMPLEX_GLYPHS | FLAG_RUN_RTL); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
93 |
test("hindi", hindiGV, true, FLAG_COMPLEX_GLYPHS); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
94 |
test("tamil", tamilGV, true, FLAG_COMPLEX_GLYPHS); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
95 |
test("pos", latinPos, true, 0); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
96 |
test("trans", latinTrans, false, 0); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
97 |
} |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
98 |
|
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
99 |
static boolean isLogicalFont(Font f) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
100 |
String family = f.getFamily().toLowerCase(); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
101 |
switch (family) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
102 |
case "dialog": |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
103 |
case "dialoginput": |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
104 |
case "serif": |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
105 |
case "sansserif": |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
106 |
case "monospaced": return true; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
107 |
default: return false; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
108 |
} |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
109 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
110 |
|
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
111 |
Font[] allFonts = null; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
112 |
|
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
113 |
Font findFont(String text) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
114 |
if (allFonts == null) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
115 |
allFonts = |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
116 |
GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
117 |
} |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
118 |
for (Font f : allFonts) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
119 |
if (isLogicalFont(f)) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
120 |
continue; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
121 |
} |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
122 |
if (f.canDisplayUpTo(text) == -1) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
123 |
return f.deriveFont(Font.PLAIN, 24); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
124 |
} |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
125 |
} |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
126 |
return null; |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
127 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
128 |
|
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
129 |
GlyphVector makeGlyphVector(String script, String text, |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
130 |
boolean rtl, FontRenderContext frc) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
131 |
|
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
132 |
Font font = findFont(text); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
133 |
if (font == null) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
134 |
System.out.println("No font found for script " + script); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
135 |
return null; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
136 |
} else { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
137 |
System.out.println("Using " + font.getFontName() + |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
138 |
" for script " + script); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
139 |
} |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
140 |
int flags = rtl ? LAYOUT_RIGHT_TO_LEFT : LAYOUT_LEFT_TO_RIGHT; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
141 |
return font.layoutGlyphVector(frc, text.toCharArray(), |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
142 |
0, text.length(), flags); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
143 |
} |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
144 |
|
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
145 |
void test(String name, GlyphVector gv, boolean layout, int allowedFlags) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
146 |
|
50137
941d432aee8b
8202767: java/awt/font/GlyphVector/TestLayoutFlags.java is missing null check
prr
parents:
50134
diff
changeset
|
147 |
if (gv == null) { |
941d432aee8b
8202767: java/awt/font/GlyphVector/TestLayoutFlags.java is missing null check
prr
parents:
50134
diff
changeset
|
148 |
return; |
941d432aee8b
8202767: java/awt/font/GlyphVector/TestLayoutFlags.java is missing null check
prr
parents:
50134
diff
changeset
|
149 |
} |
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
150 |
int iv = (layout) ? FLAG_HAS_POSITION_ADJUSTMENTS : 0; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
151 |
|
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
152 |
int computedFlags = computeFlags(gv, iv) & gv.FLAG_MASK; |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
153 |
int actualFlags = gv.getLayoutFlags() & gv.FLAG_MASK; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
154 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
155 |
System.out.println("\n*** " + name + " ***"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
156 |
System.out.println(" test flags"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
157 |
System.out.print("computed "); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
158 |
printFlags(computedFlags); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
159 |
System.out.print(" actual "); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
160 |
printFlags(actualFlags); |
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
161 |
System.out.print("allowed layout "); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
162 |
printFlags(allowedFlags); |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
163 |
|
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
164 |
if (computedFlags != actualFlags) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
165 |
// Depending on the font, if layout is run for a RTL script |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
166 |
// you might get that flag set, or COMPLEX_GLYPHS instead. |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
167 |
boolean error = false; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
168 |
int COMPLEX_RTL = FLAG_COMPLEX_GLYPHS | FLAG_RUN_RTL; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
169 |
if (allowedFlags == 0) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
170 |
error = (allowedFlags & COMPLEX_RTL) != 0; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
171 |
} |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
172 |
if (allowedFlags == FLAG_RUN_RTL) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
173 |
error = (actualFlags & FLAG_COMPLEX_GLYPHS) != 0; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
174 |
} |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
175 |
if (allowedFlags == FLAG_COMPLEX_GLYPHS) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
176 |
error = (actualFlags & FLAG_RUN_RTL) != 0; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
177 |
} |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
178 |
if (allowedFlags == COMPLEX_RTL) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
179 |
error = (actualFlags & COMPLEX_RTL) == 0; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
180 |
} |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
181 |
if (error) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
182 |
throw new Error("layout flags in test: " + name + |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
183 |
" expected: " + Integer.toHexString(computedFlags) + |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
184 |
" but got: " + Integer.toHexString(actualFlags)); |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
185 |
} |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
186 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
187 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
188 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
189 |
static public void printFlags(int flags) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
190 |
System.out.print("flags:"); |
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
191 |
if ((flags & FLAG_HAS_POSITION_ADJUSTMENTS) != 0) { |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
192 |
System.out.print(" pos"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
193 |
} |
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
194 |
if ((flags & FLAG_HAS_TRANSFORMS) != 0) { |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
195 |
System.out.print(" trans"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
196 |
} |
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
197 |
if ((flags & FLAG_RUN_RTL) != 0) { |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
198 |
System.out.print(" rtl"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
199 |
} |
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
200 |
if ((flags & FLAG_COMPLEX_GLYPHS) != 0) { |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
201 |
System.out.print(" complex"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
202 |
} |
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
203 |
if ((flags & FLAG_MASK) == 0) { |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
204 |
System.out.print(" none"); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
205 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
206 |
System.out.println(); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
207 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
208 |
|
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
209 |
int computeFlags(GlyphVector gv, int initValue) { |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
210 |
validateCharIndexMethods(gv); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
211 |
|
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
212 |
int result = initValue; |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
213 |
if (glyphsAreRTL(gv)) { |
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
214 |
result |= FLAG_RUN_RTL; |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
215 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
216 |
if (hasComplexGlyphs(gv)) { |
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
217 |
result |= FLAG_COMPLEX_GLYPHS; |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
218 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
219 |
|
50134
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
220 |
if (gv.getFont().isTransformed()) { |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
221 |
result |= FLAG_HAS_TRANSFORMS; |
6064cd8725fa
8176510: java/awt/font/GlyphVector/TestLayoutFlags.java fails with OpenJDK
prr
parents:
47216
diff
changeset
|
222 |
} |
31660
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
223 |
return result; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
224 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
225 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
226 |
/** |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
227 |
* throw an exception if getGlyphCharIndices returns a different result than |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
228 |
* you get from iterating through getGlyphCharIndex one at a time. |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
229 |
*/ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
230 |
void validateCharIndexMethods(GlyphVector gv) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
231 |
int[] indices = gv.getGlyphCharIndices(0, gv.getNumGlyphs(), null); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
232 |
for (int i = 0; i < gv.getNumGlyphs(); ++i) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
233 |
if (gv.getGlyphCharIndex(i) != indices[i]) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
234 |
throw new Error("glyph index mismatch at " + i); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
235 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
236 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
237 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
238 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
239 |
/** |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
240 |
* Return true if the glyph indices are pure ltr |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
241 |
*/ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
242 |
boolean glyphsAreLTR(GlyphVector gv) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
243 |
int[] indices = gv.getGlyphCharIndices(0, gv.getNumGlyphs(), null); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
244 |
for (int i = 0; i < indices.length; ++i) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
245 |
if (indices[i] != i) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
246 |
return false; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
247 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
248 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
249 |
return true; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
250 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
251 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
252 |
/** |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
253 |
* Return true if the glyph indices are pure rtl |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
254 |
*/ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
255 |
boolean glyphsAreRTL(GlyphVector gv) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
256 |
int[] indices = gv.getGlyphCharIndices(0, gv.getNumGlyphs(), null); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
257 |
for (int i = 0; i < indices.length; ++i) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
258 |
if (indices[i] != indices.length - i - 1) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
259 |
return false; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
260 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
261 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
262 |
return true; |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
263 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
264 |
|
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
265 |
/** |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
266 |
* Return true if there is a local reordering (the run is not ltr or rtl). |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
267 |
* !!! We can't have mixed bidi runs in the glyphs. |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
268 |
*/ |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
269 |
boolean hasComplexGlyphs(GlyphVector gv) { |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
270 |
return !glyphsAreLTR(gv) && !glyphsAreRTL(gv); |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
271 |
} |
1a4e2e5c15e1
8130125: [TEST_BUG] add @modules to the several client tests unaffected by the automated bulk update
yan
parents:
diff
changeset
|
272 |
} |