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