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