author | erikj |
Mon, 01 Oct 2018 11:02:33 -0700 | |
branch | JEP-230-microbenchmarks-branch |
changeset 56912 | d434fc4d10aa |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
34414
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
1 |
/* |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
4 |
* |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
10 |
* |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
15 |
* accompanied this code). |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
16 |
* |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
20 |
* |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
23 |
* questions. |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
24 |
*/ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
25 |
|
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
26 |
#include "scriptMapping.h" |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
27 |
/* |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
28 |
* Java level-code has a script code indexes that correspond to |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
29 |
* the indexes used by the ICU layout library. In order to call |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
30 |
* harfbuzz we must map these to the equivalent harfbuzz codes. |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
31 |
* Some of these happen to be the same but not many. |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
32 |
*/ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
33 |
|
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
34 |
hb_script_t ICU_to_Harfbuzz_ScriptCode[] = { |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
35 |
|
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
36 |
HB_SCRIPT_COMMON, /* 0 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
37 |
HB_SCRIPT_INHERITED, /* 1 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
38 |
HB_SCRIPT_ARABIC, /* 2 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
39 |
HB_SCRIPT_ARMENIAN, /* 3 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
40 |
HB_SCRIPT_BENGALI, /* 4 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
41 |
HB_SCRIPT_BOPOMOFO, /* 5 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
42 |
HB_SCRIPT_CHEROKEE, /* 6 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
43 |
HB_SCRIPT_COPTIC, /* 7 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
44 |
HB_SCRIPT_CYRILLIC, /* 8 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
45 |
HB_SCRIPT_DESERET, /* 9 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
46 |
HB_SCRIPT_DEVANAGARI, /* 10 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
47 |
HB_SCRIPT_ETHIOPIC, /* 11 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
48 |
HB_SCRIPT_GEORGIAN, /* 12 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
49 |
HB_SCRIPT_GOTHIC, /* 13 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
50 |
HB_SCRIPT_GREEK, /* 14 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
51 |
HB_SCRIPT_GUJARATI, /* 15 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
52 |
HB_SCRIPT_GURMUKHI, /* 16 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
53 |
HB_SCRIPT_HAN, /* 17 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
54 |
HB_SCRIPT_HANGUL, /* 18 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
55 |
HB_SCRIPT_HEBREW, /* 19 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
56 |
HB_SCRIPT_HIRAGANA, /* 20 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
57 |
HB_SCRIPT_KANNADA, /* 21 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
58 |
HB_SCRIPT_KATAKANA, /* 22 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
59 |
HB_SCRIPT_KHMER, /* 23 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
60 |
HB_SCRIPT_LAO, /* 24 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
61 |
HB_SCRIPT_LATIN, /* 25 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
62 |
HB_SCRIPT_MALAYALAM, /* 26 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
63 |
HB_SCRIPT_MONGOLIAN, /* 27 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
64 |
HB_SCRIPT_MYANMAR, /* 28 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
65 |
HB_SCRIPT_OGHAM, /* 29 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
66 |
HB_SCRIPT_OLD_ITALIC, /* 30 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
67 |
HB_SCRIPT_ORIYA, /* 31 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
68 |
HB_SCRIPT_RUNIC, /* 32 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
69 |
HB_SCRIPT_SINHALA, /* 33 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
70 |
HB_SCRIPT_SYRIAC, /* 34 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
71 |
HB_SCRIPT_TAMIL, /* 35 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
72 |
HB_SCRIPT_TELUGU, /* 36 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
73 |
HB_SCRIPT_THAANA, /* 37 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
74 |
HB_SCRIPT_THAI, /* 38 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
75 |
HB_SCRIPT_TIBETAN, /* 39 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
76 |
HB_SCRIPT_CANADIAN_SYLLABICS, /* 40 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
77 |
HB_SCRIPT_YI, /* 41 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
78 |
HB_SCRIPT_TAGALOG, /* 42 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
79 |
HB_SCRIPT_HANUNOO, /* 43 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
80 |
HB_SCRIPT_BUHID, /* 44 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
81 |
HB_SCRIPT_TAGBANWA, /* 45 */ |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
82 |
|
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
83 |
}; |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
84 |
|
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
85 |
int MAX_ICU_SCRIPTCODE = 45; |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
86 |
|
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
87 |
hb_script_t getHBScriptCode(int code) { |
39549 | 88 |
if ((code < 0) || (code > MAX_ICU_SCRIPTCODE)) { |
34414
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
89 |
return HB_SCRIPT_INVALID; |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
90 |
} |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
91 |
return ICU_to_Harfbuzz_ScriptCode[code]; |
e496a8d8fc8a
8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff
changeset
|
92 |
} |