unicode script and language code

This commit is contained in:
Vincent Wei
2019-01-19 12:57:34 +08:00
parent 856126c72e
commit a10d28dd11
14 changed files with 7002 additions and 434 deletions
+14
View File
@@ -694,6 +694,20 @@ typedef UINT_PTR LPARAM;
*/
#define MAKEWORD16(low, high) ((WORD16)(((BYTE)(low)) | (((WORD16)((BYTE)(high))) << 8)))
/**
* \def MAKEWORD32(first, second, third, fourth)
* \brief Makes a WORD32 value with four bytes.
*
* \sa MAKEWORD16, FIRSTBYTE, SECONDBYTE, THIRDBYTE, FOURTHBYTE
*/
#define MAKEDWORD32(first, second, third, fourth) \
((DWORD32)( \
((BYTE)(first)) | \
(((DWORD32)((BYTE)(second))) << 8) | \
(((DWORD32)((BYTE)(third))) << 16) | \
(((DWORD32)((BYTE)(fourth))) << 24) \
))
/**
* \def MAKEWPARAM(first, second, third, fourth)
* \brief Makes a WPARAM value with four bytes.
+954 -169
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -2,7 +2,8 @@ SUBDIRS = in-core
noinst_LTLIBRARIES = libfont.la
SRC_FILES = charset.c charset-arabic.c charset-bidi.c unicode-comp.c \
SRC_FILES = charset.c charset-arabic.c charset-bidi.c \
unicode-comp.c unicode-script.c language-code.c \
sysfont.c logfont.c devfont.c fontname.c \
rawbitmap.c varbitmap.c qpf.c upf.c \
fontcache.c freetype2.c font-engines.c\
+217
View File
@@ -0,0 +1,217 @@
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Or,
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "common.h"
#include "minigui.h"
#include "gdi.h"
#ifdef _MGCHARSET_UNICODE
static const Uint16 iso639_1_codes[] =
{
#define PACK(a,b) ((Uint16)((((Uint8)(a))<<8)|((Uint8)(b))))
PACK('a', 'a'), // Afar
PACK('a', 'b'), // Abkhazian
PACK('a', 'f'), // Afrikaans
PACK('a', 'm'), // Amharic
PACK('a', 'r'), // Arabic
PACK('a', 's'), // Assamese
PACK('a', 'y'), // Aymara
PACK('a', 'z'), // Azerbaijani
PACK('b', 'a'), // Bashkir
PACK('b', 'e'), // Byelorussian
PACK('b', 'g'), // Bulgarian
PACK('b', 'h'), // Bihari
PACK('b', 'i'), // Bislama
PACK('b', 'n'), // Bengali
PACK('b', 'o'), // Tibetan
PACK('b', 'r'), // Breton
PACK('c', 'a'), // Catalan
PACK('c', 'o'), // Corsican
PACK('c', 's'), // Czech
PACK('c', 'y'), // Welch
PACK('d', 'a'), // Danish
PACK('d', 'e'), // German
PACK('d', 'z'), // Bhutani
PACK('e', 'l'), // Greek
PACK('e', 'n'), // English
PACK('e', 'o'), // Esperanto
PACK('e', 's'), // Spanish
PACK('e', 't'), // Estonian
PACK('e', 'u'), // Basque
PACK('f', 'a'), // Persian
PACK('f', 'i'), // Finnish
PACK('f', 'j'), // Fiji
PACK('f', 'o'), // Faeroese
PACK('f', 'r'), // French
PACK('f', 'y'), // Frisian
PACK('g', 'a'), // Irish
PACK('g', 'd'), // Scots Gaelic
PACK('g', 'l'), // Galician
PACK('g', 'n'), // Guarani
PACK('g', 'u'), // Gujarati
PACK('h', 'a'), // Hausa
PACK('h', 'i'), // Hindi
PACK('h', 'e'), // Hebrew
PACK('h', 'r'), // Croatian
PACK('h', 'u'), // Hungarian
PACK('h', 'y'), // Armenian
PACK('i', 'a'), // Interlingua
PACK('i', 'd'), // Indonesian
PACK('i', 'e'), // Interlingue
PACK('i', 'k'), // Inupiak
PACK('i', 'n'), // former Indonesian
PACK('i', 's'), // Icelandic
PACK('i', 't'), // Italian
PACK('i', 'u'), // Inuktitut (Eskimo)
PACK('i', 'w'), // former Hebrew
PACK('j', 'a'), // Japanese
PACK('j', 'i'), // former Yiddish
PACK('j', 'w'), // Javanese
PACK('k', 'a'), // Georgian
PACK('k', 'k'), // Kazakh
PACK('k', 'l'), // Greenlandic
PACK('k', 'm'), // Cambodian
PACK('k', 'n'), // Kannada
PACK('k', 'o'), // Korean
PACK('k', 's'), // Kashmiri
PACK('k', 'u'), // Kurdish
PACK('k', 'y'), // Kirghiz
PACK('l', 'a'), // Latin
PACK('l', 'n'), // Lingala
PACK('l', 'o'), // Laothian
PACK('l', 't'), // Lithuanian
PACK('l', 'v'), // Latvian, Lettish
PACK('m', 'g'), // Malagasy
PACK('m', 'i'), // Maori
PACK('m', 'k'), // Macedonian
PACK('m', 'l'), // Malayalam
PACK('m', 'n'), // Mongolian
PACK('m', 'o'), // Moldavian
PACK('m', 'r'), // Marathi
PACK('m', 's'), // Malay
PACK('m', 't'), // Maltese
PACK('m', 'y'), // Burmese
PACK('n', 'a'), // Nauru
PACK('n', 'e'), // Nepali
PACK('n', 'l'), // Dutch
PACK('n', 'o'), // Norwegian
PACK('o', 'c'), // Occitan
PACK('o', 'm'), // (Afan) Oromo
PACK('o', 'r'), // Oriya
PACK('p', 'a'), // Punjabi
PACK('p', 'l'), // Polish
PACK('p', 's'), // Pashto, Pushto
PACK('p', 't'), // Portuguese
PACK('q', 'u'), // Quechua
PACK('r', 'm'), // Rhaeto-Romance
PACK('r', 'n'), // Kirundi
PACK('r', 'o'), // Romanian
PACK('r', 'u'), // Russian
PACK('r', 'w'), // Kinyarwanda
PACK('s', 'a'), // Sanskrit
PACK('s', 'd'), // Sindhi
PACK('s', 'g'), // Sangro
PACK('s', 'h'), // Serbo-Croatian
PACK('s', 'i'), // Singhalese
PACK('s', 'k'), // Slovak
PACK('s', 'l'), // Slovenian
PACK('s', 'm'), // Samoan
PACK('s', 'n'), // Shona
PACK('s', 'o'), // Somali
PACK('s', 'q'), // Albanian
PACK('s', 'r'), // Serbian
PACK('s', 's'), // Siswati
PACK('s', 't'), // Sesotho
PACK('s', 'u'), // Sudanese
PACK('s', 'v'), // Swedish
PACK('s', 'w'), // Swahili
PACK('t', 'a'), // Tamil
PACK('t', 'e'), // Tegulu
PACK('t', 'g'), // Tajik
PACK('t', 'h'), // Thai
PACK('t', 'i'), // Tigrinya
PACK('t', 'k'), // Turkmen
PACK('t', 'l'), // Tagalog
PACK('t', 'n'), // Setswana
PACK('t', 'o'), // Tonga
PACK('t', 'r'), // Turkish
PACK('t', 's'), // Tsonga
PACK('t', 't'), // Tatar
PACK('t', 'w'), // Twi
PACK('u', 'g'), // Uigur
PACK('u', 'k'), // Ukrainian
PACK('u', 'r'), // Urdu
PACK('u', 'z'), // Uzbek
PACK('v', 'i'), // Vietnamese
PACK('v', 'o'), // Volapuk
PACK('w', 'o'), // Wolof
PACK('x', 'h'), // Xhosa
PACK('y', 'i'), // Yiddish
PACK('y', 'o'), // Yoruba
PACK('z', 'a'), // Zhuang
PACK('z', 'h'), // Chinese
PACK('z', 'u'), // Zulu
#undef PACK
};
int GUIAPI LanguageCodeFromISO639s1 (Uint16 iso639_1)
{
unsigned int lower = 0;
unsigned int upper = TABLESIZE (iso639_1_codes) - 1;
unsigned int mid = TABLESIZE (iso639_1_codes) / 2;
if (!iso639_1)
return LANGCODE_unknown;
do {
if (iso639_1 < iso639_1_codes[mid])
upper = mid - 1;
else if (iso639_1 > iso639_1_codes[mid])
lower = mid + 1;
else
return (int)mid;
mid = (lower + upper) / 2;
} while (lower <= upper);
return LANGCODE_unknown;
}
#endif /* _MGCHARSET_UNICODE */
+3 -31
View File
@@ -1,36 +1,8 @@
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Or,
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
* This file is copied from LGPL'd glib 2.59.
* It is automatically generated by gen-unicode-tables.pl
*/
#ifndef BREAKTABLES_H
#define BREAKTABLES_H
+5
View File
@@ -1,3 +1,8 @@
/*
* This file is copied from LGPL'd glib 2.59.
* It is automatically generated by gen-unicode-tables.pl
*/
#define COMPOSE_FIRST_START 1
#define COMPOSE_FIRST_SINGLE_START 149
#define COMPOSE_SECOND_START 377
+4 -1
View File
@@ -1,4 +1,7 @@
/* This file is automatically generated. DO NOT EDIT! */
/*
* This file is copied from LGPL'd glib 2.59.
* It is automatically generated by gen-unicode-tables.pl
*/
#ifndef DECOMP_H
#define DECOMP_H
-201
View File
@@ -1,201 +0,0 @@
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Or,
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
#ifndef __UCHAR_TYPE_H__
#define __UCHAR_TYPE_H__
/* These are the possible character classifications.
* See http://www.unicode.org/Public/UNIDATA/UCD.html#General_Category_Values
*/
#if 0 /* VincentWei: Moved to gid.h */
typedef enum
{
UCHAR_TYPE_CONTROL,
UCHAR_TYPE_FORMAT,
UCHAR_TYPE_UNASSIGNED,
UCHAR_TYPE_PRIVATE_USE,
UCHAR_TYPE_SURROGATE,
UCHAR_TYPE_LOWERCASE_LETTER,
UCHAR_TYPE_MODIFIER_LETTER,
UCHAR_TYPE_OTHER_LETTER,
UCHAR_TYPE_TITLECASE_LETTER,
UCHAR_TYPE_UPPERCASE_LETTER,
UCHAR_TYPE_COMBINING_MARK,
UCHAR_TYPE_ENCLOSING_MARK,
UCHAR_TYPE_NON_SPACING_MARK,
UCHAR_TYPE_DECIMAL_NUMBER,
UCHAR_TYPE_LETTER_NUMBER,
UCHAR_TYPE_OTHER_NUMBER,
UCHAR_TYPE_CONNECT_PUNCTUATION,
UCHAR_TYPE_DASH_PUNCTUATION,
UCHAR_TYPE_CLOSE_PUNCTUATION,
UCHAR_TYPE_FINAL_PUNCTUATION,
UCHAR_TYPE_INITIAL_PUNCTUATION,
UCHAR_TYPE_OTHER_PUNCTUATION,
UCHAR_TYPE_OPEN_PUNCTUATION,
UCHAR_TYPE_CURRENCY_SYMBOL,
UCHAR_TYPE_MODIFIER_SYMBOL,
UCHAR_TYPE_MATH_SYMBOL,
UCHAR_TYPE_OTHER_SYMBOL,
UCHAR_TYPE_LINE_SEPARATOR,
UCHAR_TYPE_PARAGRAPH_SEPARATOR,
UCHAR_TYPE_SPACE_SEPARATOR
} GUnicodeType;
/* These are the possible line break classifications.
* Note that new types may be added in the future.
* Implementations may regard unknown values like UCHAR_BREAK_UNKNOWN
* See http://www.unicode.org/unicode/reports/tr14/
*/
typedef enum
{
UCHAR_BREAK_MANDATORY,
UCHAR_BREAK_CARRIAGE_RETURN,
UCHAR_BREAK_LINE_FEED,
UCHAR_BREAK_COMBINING_MARK,
UCHAR_BREAK_SURROGATE,
UCHAR_BREAK_ZERO_WIDTH_SPACE,
UCHAR_BREAK_INSEPARABLE,
UCHAR_BREAK_NON_BREAKING_GLUE,
UCHAR_BREAK_CONTINGENT,
UCHAR_BREAK_SPACE,
UCHAR_BREAK_AFTER,
UCHAR_BREAK_BEFORE,
UCHAR_BREAK_BEFORE_AND_AFTER,
UCHAR_BREAK_HYPHEN,
UCHAR_BREAK_NON_STARTER,
UCHAR_BREAK_OPEN_PUNCTUATION,
UCHAR_BREAK_CLOSE_PUNCTUATION,
UCHAR_BREAK_QUOTATION,
UCHAR_BREAK_EXCLAMATION,
UCHAR_BREAK_IDEOGRAPHIC,
UCHAR_BREAK_NUMERIC,
UCHAR_BREAK_INFIX_SEPARATOR,
UCHAR_BREAK_SYMBOL,
UCHAR_BREAK_ALPHABETIC,
UCHAR_BREAK_PREFIX,
UCHAR_BREAK_POSTFIX,
UCHAR_BREAK_COMPLEX_CONTEXT,
UCHAR_BREAK_AMBIGUOUS,
UCHAR_BREAK_UNKNOWN,
UCHAR_BREAK_NEXT_LINE,
UCHAR_BREAK_WORD_JOINER,
UCHAR_BREAK_HANGUL_L_JAMO,
UCHAR_BREAK_HANGUL_V_JAMO,
UCHAR_BREAK_HANGUL_T_JAMO,
UCHAR_BREAK_HANGUL_LV_SYLLABLE,
UCHAR_BREAK_HANGUL_LVT_SYLLABLE
} GUnicodeBreakType;
#endif /* VincentWei: Moved to gid.h */
typedef enum
{ /* ISO 15924 code */
UCHAR_TYPE_SCRIPT_INVALID_CODE = -1,
UCHAR_TYPE_SCRIPT_COMMON = 0, /* Zyyy */
UCHAR_TYPE_SCRIPT_INHERITED, /* Qaai */
UCHAR_TYPE_SCRIPT_ARABIC, /* Arab */
UCHAR_TYPE_SCRIPT_ARMENIAN, /* Armn */
UCHAR_TYPE_SCRIPT_BENGALI, /* Beng */
UCHAR_TYPE_SCRIPT_BOPOMOFO, /* Bopo */
UCHAR_TYPE_SCRIPT_CHEROKEE, /* Cher */
UCHAR_TYPE_SCRIPT_COPTIC, /* Qaac */
UCHAR_TYPE_SCRIPT_CYRILLIC, /* Cyrl (Cyrs) */
UCHAR_TYPE_SCRIPT_DESERET, /* Dsrt */
UCHAR_TYPE_SCRIPT_DEVANAGARI, /* Deva */
UCHAR_TYPE_SCRIPT_ETHIOPIC, /* Ethi */
UCHAR_TYPE_SCRIPT_GEORGIAN, /* Geor (Geon, Geoa) */
UCHAR_TYPE_SCRIPT_GOTHIC, /* Goth */
UCHAR_TYPE_SCRIPT_GREEK, /* Grek */
UCHAR_TYPE_SCRIPT_GUJARATI, /* Gujr */
UCHAR_TYPE_SCRIPT_GURMUKHI, /* Guru */
UCHAR_TYPE_SCRIPT_HAN, /* Hani */
UCHAR_TYPE_SCRIPT_HANGUL, /* Hang */
UCHAR_TYPE_SCRIPT_HEBREW, /* Hebr */
UCHAR_TYPE_SCRIPT_HIRAGANA, /* Hira */
UCHAR_TYPE_SCRIPT_KANNADA, /* Knda */
UCHAR_TYPE_SCRIPT_KATAKANA, /* Kana */
UCHAR_TYPE_SCRIPT_KHMER, /* Khmr */
UCHAR_TYPE_SCRIPT_LAO, /* Laoo */
UCHAR_TYPE_SCRIPT_LATIN, /* Latn (Latf, Latg) */
UCHAR_TYPE_SCRIPT_MALAYALAM, /* Mlym */
UCHAR_TYPE_SCRIPT_MONGOLIAN, /* Mong */
UCHAR_TYPE_SCRIPT_MYANMAR, /* Mymr */
UCHAR_TYPE_SCRIPT_OGHAM, /* Ogam */
UCHAR_TYPE_SCRIPT_OLD_ITALIC, /* Ital */
UCHAR_TYPE_SCRIPT_ORIYA, /* Orya */
UCHAR_TYPE_SCRIPT_RUNIC, /* Runr */
UCHAR_TYPE_SCRIPT_SINHALA, /* Sinh */
UCHAR_TYPE_SCRIPT_SYRIAC, /* Syrc (Syrj, Syrn, Syre) */
UCHAR_TYPE_SCRIPT_TAMIL, /* Taml */
UCHAR_TYPE_SCRIPT_TELUGU, /* Telu */
UCHAR_TYPE_SCRIPT_THAANA, /* Thaa */
UCHAR_TYPE_SCRIPT_THAI, /* Thai */
UCHAR_TYPE_SCRIPT_TIBETAN, /* Tibt */
UCHAR_TYPE_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */
UCHAR_TYPE_SCRIPT_YI, /* Yiii */
UCHAR_TYPE_SCRIPT_TAGALOG, /* Tglg */
UCHAR_TYPE_SCRIPT_HANUNOO, /* Hano */
UCHAR_TYPE_SCRIPT_BUHID, /* Buhd */
UCHAR_TYPE_SCRIPT_TAGBANWA, /* Tagb */
/* Unicode-4.0 additions */
UCHAR_TYPE_SCRIPT_BRAILLE, /* Brai */
UCHAR_TYPE_SCRIPT_CYPRIOT, /* Cprt */
UCHAR_TYPE_SCRIPT_LIMBU, /* Limb */
UCHAR_TYPE_SCRIPT_OSMANYA, /* Osma */
UCHAR_TYPE_SCRIPT_SHAVIAN, /* Shaw */
UCHAR_TYPE_SCRIPT_LINEAR_B, /* Linb */
UCHAR_TYPE_SCRIPT_TAI_LE, /* Tale */
UCHAR_TYPE_SCRIPT_UGARITIC, /* Ugar */
/* Unicode-4.1 additions */
UCHAR_TYPE_SCRIPT_NEW_TAI_LUE, /* Talu */
UCHAR_TYPE_SCRIPT_BUGINESE, /* Bugi */
UCHAR_TYPE_SCRIPT_GLAGOLITIC, /* Glag */
UCHAR_TYPE_SCRIPT_TIFINAGH, /* Tfng */
UCHAR_TYPE_SCRIPT_SYLOTI_NAGRI, /* Sylo */
UCHAR_TYPE_SCRIPT_OLD_PERSIAN, /* Xpeo */
UCHAR_TYPE_SCRIPT_KHAROSHTHI, /* Khar */
/* Unicode-5.0 additions */
UCHAR_TYPE_SCRIPT_UNKNOWN, /* Zzzz */
UCHAR_TYPE_SCRIPT_BALINESE, /* Bali */
UCHAR_TYPE_SCRIPT_CUNEIFORM, /* Xsux */
UCHAR_TYPE_SCRIPT_PHOENICIAN, /* Phnx */
UCHAR_TYPE_SCRIPT_PHAGS_PA, /* Phag */
UCHAR_TYPE_SCRIPT_NKO /* Nkoo */
} GUnicodeScript;
#endif /* __UCHAR_TYPE_H__ */
+287
View File
@@ -0,0 +1,287 @@
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Or,
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "common.h"
#include "minigui.h"
#include "gdi.h"
#ifdef _MGCHARSET_UNICODE
#include "unicode-scripttable.h"
#define G_SCRIPT_TABLE_MIDPOINT (TABLESIZE (g_script_table) / 2)
static inline int g_unichar_get_script_bsearch (Uchar32 ch)
{
int lower = 0;
int upper = (int)TABLESIZE (g_script_table) - 1;
static int saved_mid = G_SCRIPT_TABLE_MIDPOINT;
int mid = saved_mid;
do {
if (ch < g_script_table[mid].start)
upper = mid - 1;
else if (ch >= g_script_table[mid].start + g_script_table[mid].chars)
lower = mid + 1;
else
return g_script_table[saved_mid = mid].script;
mid = (lower + upper) / 2;
} while (lower <= upper);
return UCHAR_SCRIPT_UNKNOWN;
}
int GUIAPI UCharGetScriptType (Uchar32 ch)
{
if (ch < G_EASY_SCRIPTS_RANGE)
return g_script_easy_table[ch];
else
return g_unichar_get_script_bsearch (ch);
}
/* http://unicode.org/iso15924/ */
static const Uint32 iso15924_tags[] =
{
#define PACK(a,b,c,d) ((Uint32)((((Uint8)(a))<<24)|(((Uint8)(b))<<16)|(((Uint8)(c))<<8)|((Uint8)(d))))
PACK ('Z','y','y','y'), /* UCHAR_SCRIPT_COMMON */
PACK ('Z','i','n','h'), /* UCHAR_SCRIPT_INHERITED */
PACK ('A','r','a','b'), /* UCHAR_SCRIPT_ARABIC */
PACK ('A','r','m','n'), /* UCHAR_SCRIPT_ARMENIAN */
PACK ('B','e','n','g'), /* UCHAR_SCRIPT_BENGALI */
PACK ('B','o','p','o'), /* UCHAR_SCRIPT_BOPOMOFO */
PACK ('C','h','e','r'), /* UCHAR_SCRIPT_CHEROKEE */
PACK ('C','o','p','t'), /* UCHAR_SCRIPT_COPTIC */
PACK ('C','y','r','l'), /* UCHAR_SCRIPT_CYRILLIC */
PACK ('D','s','r','t'), /* UCHAR_SCRIPT_DESERET */
PACK ('D','e','v','a'), /* UCHAR_SCRIPT_DEVANAGARI */
PACK ('E','t','h','i'), /* UCHAR_SCRIPT_ETHIOPIC */
PACK ('G','e','o','r'), /* UCHAR_SCRIPT_GEORGIAN */
PACK ('G','o','t','h'), /* UCHAR_SCRIPT_GOTHIC */
PACK ('G','r','e','k'), /* UCHAR_SCRIPT_GREEK */
PACK ('G','u','j','r'), /* UCHAR_SCRIPT_GUJARATI */
PACK ('G','u','r','u'), /* UCHAR_SCRIPT_GURMUKHI */
PACK ('H','a','n','i'), /* UCHAR_SCRIPT_HAN */
PACK ('H','a','n','g'), /* UCHAR_SCRIPT_HANGUL */
PACK ('H','e','b','r'), /* UCHAR_SCRIPT_HEBREW */
PACK ('H','i','r','a'), /* UCHAR_SCRIPT_HIRAGANA */
PACK ('K','n','d','a'), /* UCHAR_SCRIPT_KANNADA */
PACK ('K','a','n','a'), /* UCHAR_SCRIPT_KATAKANA */
PACK ('K','h','m','r'), /* UCHAR_SCRIPT_KHMER */
PACK ('L','a','o','o'), /* UCHAR_SCRIPT_LAO */
PACK ('L','a','t','n'), /* UCHAR_SCRIPT_LATIN */
PACK ('M','l','y','m'), /* UCHAR_SCRIPT_MALAYALAM */
PACK ('M','o','n','g'), /* UCHAR_SCRIPT_MONGOLIAN */
PACK ('M','y','m','r'), /* UCHAR_SCRIPT_MYANMAR */
PACK ('O','g','a','m'), /* UCHAR_SCRIPT_OGHAM */
PACK ('I','t','a','l'), /* UCHAR_SCRIPT_OLD_ITALIC */
PACK ('O','r','y','a'), /* UCHAR_SCRIPT_ORIYA */
PACK ('R','u','n','r'), /* UCHAR_SCRIPT_RUNIC */
PACK ('S','i','n','h'), /* UCHAR_SCRIPT_SINHALA */
PACK ('S','y','r','c'), /* UCHAR_SCRIPT_SYRIAC */
PACK ('T','a','m','l'), /* UCHAR_SCRIPT_TAMIL */
PACK ('T','e','l','u'), /* UCHAR_SCRIPT_TELUGU */
PACK ('T','h','a','a'), /* UCHAR_SCRIPT_THAANA */
PACK ('T','h','a','i'), /* UCHAR_SCRIPT_THAI */
PACK ('T','i','b','t'), /* UCHAR_SCRIPT_TIBETAN */
PACK ('C','a','n','s'), /* UCHAR_SCRIPT_CANADIAN_ABORIGINAL */
PACK ('Y','i','i','i'), /* UCHAR_SCRIPT_YI */
PACK ('T','g','l','g'), /* UCHAR_SCRIPT_TAGALOG */
PACK ('H','a','n','o'), /* UCHAR_SCRIPT_HANUNOO */
PACK ('B','u','h','d'), /* UCHAR_SCRIPT_BUHID */
PACK ('T','a','g','b'), /* UCHAR_SCRIPT_TAGBANWA */
/* Unicode-4.0 additions */
PACK ('B','r','a','i'), /* UCHAR_SCRIPT_BRAILLE */
PACK ('C','p','r','t'), /* UCHAR_SCRIPT_CYPRIOT */
PACK ('L','i','m','b'), /* UCHAR_SCRIPT_LIMBU */
PACK ('O','s','m','a'), /* UCHAR_SCRIPT_OSMANYA */
PACK ('S','h','a','w'), /* UCHAR_SCRIPT_SHAVIAN */
PACK ('L','i','n','b'), /* UCHAR_SCRIPT_LINEAR_B */
PACK ('T','a','l','e'), /* UCHAR_SCRIPT_TAI_LE */
PACK ('U','g','a','r'), /* UCHAR_SCRIPT_UGARITIC */
/* Unicode-4.1 additions */
PACK ('T','a','l','u'), /* UCHAR_SCRIPT_NEW_TAI_LUE */
PACK ('B','u','g','i'), /* UCHAR_SCRIPT_BUGINESE */
PACK ('G','l','a','g'), /* UCHAR_SCRIPT_GLAGOLITIC */
PACK ('T','f','n','g'), /* UCHAR_SCRIPT_TIFINAGH */
PACK ('S','y','l','o'), /* UCHAR_SCRIPT_SYLOTI_NAGRI */
PACK ('X','p','e','o'), /* UCHAR_SCRIPT_OLD_PERSIAN */
PACK ('K','h','a','r'), /* UCHAR_SCRIPT_KHAROSHTHI */
/* Unicode-5.0 additions */
PACK ('Z','z','z','z'), /* UCHAR_SCRIPT_UNKNOWN */
PACK ('B','a','l','i'), /* UCHAR_SCRIPT_BALINESE */
PACK ('X','s','u','x'), /* UCHAR_SCRIPT_CUNEIFORM */
PACK ('P','h','n','x'), /* UCHAR_SCRIPT_PHOENICIAN */
PACK ('P','h','a','g'), /* UCHAR_SCRIPT_PHAGS_PA */
PACK ('N','k','o','o'), /* UCHAR_SCRIPT_NKO */
/* Unicode-5.1 additions */
PACK ('K','a','l','i'), /* UCHAR_SCRIPT_KAYAH_LI */
PACK ('L','e','p','c'), /* UCHAR_SCRIPT_LEPCHA */
PACK ('R','j','n','g'), /* UCHAR_SCRIPT_REJANG */
PACK ('S','u','n','d'), /* UCHAR_SCRIPT_SUNDANESE */
PACK ('S','a','u','r'), /* UCHAR_SCRIPT_SAURASHTRA */
PACK ('C','h','a','m'), /* UCHAR_SCRIPT_CHAM */
PACK ('O','l','c','k'), /* UCHAR_SCRIPT_OL_CHIKI */
PACK ('V','a','i','i'), /* UCHAR_SCRIPT_VAI */
PACK ('C','a','r','i'), /* UCHAR_SCRIPT_CARIAN */
PACK ('L','y','c','i'), /* UCHAR_SCRIPT_LYCIAN */
PACK ('L','y','d','i'), /* UCHAR_SCRIPT_LYDIAN */
/* Unicode-5.2 additions */
PACK ('A','v','s','t'), /* UCHAR_SCRIPT_AVESTAN */
PACK ('B','a','m','u'), /* UCHAR_SCRIPT_BAMUM */
PACK ('E','g','y','p'), /* UCHAR_SCRIPT_EGYPTIAN_HIEROGLYPHS */
PACK ('A','r','m','i'), /* UCHAR_SCRIPT_IMPERIAL_ARAMAIC */
PACK ('P','h','l','i'), /* UCHAR_SCRIPT_INSCRIPTIONAL_PAHLAVI */
PACK ('P','r','t','i'), /* UCHAR_SCRIPT_INSCRIPTIONAL_PARTHIAN */
PACK ('J','a','v','a'), /* UCHAR_SCRIPT_JAVANESE */
PACK ('K','t','h','i'), /* UCHAR_SCRIPT_KAITHI */
PACK ('L','i','s','u'), /* UCHAR_SCRIPT_LISU */
PACK ('M','t','e','i'), /* UCHAR_SCRIPT_MEETEI_MAYEK */
PACK ('S','a','r','b'), /* UCHAR_SCRIPT_OLD_SOUTH_ARABIAN */
PACK ('O','r','k','h'), /* UCHAR_SCRIPT_OLD_TURKIC */
PACK ('S','a','m','r'), /* UCHAR_SCRIPT_SAMARITAN */
PACK ('L','a','n','a'), /* UCHAR_SCRIPT_TAI_THAM */
PACK ('T','a','v','t'), /* UCHAR_SCRIPT_TAI_VIET */
/* Unicode-6.0 additions */
PACK ('B','a','t','k'), /* UCHAR_SCRIPT_BATAK */
PACK ('B','r','a','h'), /* UCHAR_SCRIPT_BRAHMI */
PACK ('M','a','n','d'), /* UCHAR_SCRIPT_MANDAIC */
/* Unicode-6.1 additions */
PACK ('C','a','k','m'), /* UCHAR_SCRIPT_CHAKMA */
PACK ('M','e','r','c'), /* UCHAR_SCRIPT_MEROITIC_CURSIVE */
PACK ('M','e','r','o'), /* UCHAR_SCRIPT_MEROITIC_HIEROGLYPHS */
PACK ('P','l','r','d'), /* UCHAR_SCRIPT_MIAO */
PACK ('S','h','r','d'), /* UCHAR_SCRIPT_SHARADA */
PACK ('S','o','r','a'), /* UCHAR_SCRIPT_SORA_SOMPENG */
PACK ('T','a','k','r'), /* UCHAR_SCRIPT_TAKRI */
/* Unicode 7.0 additions */
PACK ('B','a','s','s'), /* UCHAR_SCRIPT_BASSA_VAH */
PACK ('A','g','h','b'), /* UCHAR_SCRIPT_CAUCASIAN_ALBANIAN */
PACK ('D','u','p','l'), /* UCHAR_SCRIPT_DUPLOYAN */
PACK ('E','l','b','a'), /* UCHAR_SCRIPT_ELBASAN */
PACK ('G','r','a','n'), /* UCHAR_SCRIPT_GRANTHA */
PACK ('K','h','o','j'), /* UCHAR_SCRIPT_KHOJKI*/
PACK ('S','i','n','d'), /* UCHAR_SCRIPT_KHUDAWADI */
PACK ('L','i','n','a'), /* UCHAR_SCRIPT_LINEAR_A */
PACK ('M','a','h','j'), /* UCHAR_SCRIPT_MAHAJANI */
PACK ('M','a','n','u'), /* UCHAR_SCRIPT_MANICHAEAN */
PACK ('M','e','n','d'), /* UCHAR_SCRIPT_MENDE_KIKAKUI */
PACK ('M','o','d','i'), /* UCHAR_SCRIPT_MODI */
PACK ('M','r','o','o'), /* UCHAR_SCRIPT_MRO */
PACK ('N','b','a','t'), /* UCHAR_SCRIPT_NABATAEAN */
PACK ('N','a','r','b'), /* UCHAR_SCRIPT_OLD_NORTH_ARABIAN */
PACK ('P','e','r','m'), /* UCHAR_SCRIPT_OLD_PERMIC */
PACK ('H','m','n','g'), /* UCHAR_SCRIPT_PAHAWH_HMONG */
PACK ('P','a','l','m'), /* UCHAR_SCRIPT_PALMYRENE */
PACK ('P','a','u','c'), /* UCHAR_SCRIPT_PAU_CIN_HAU */
PACK ('P','h','l','p'), /* UCHAR_SCRIPT_PSALTER_PAHLAVI */
PACK ('S','i','d','d'), /* UCHAR_SCRIPT_SIDDHAM */
PACK ('T','i','r','h'), /* UCHAR_SCRIPT_TIRHUTA */
PACK ('W','a','r','a'), /* UCHAR_SCRIPT_WARANG_CITI */
/* Unicode 8.0 additions */
PACK ('A','h','o','m'), /* UCHAR_SCRIPT_AHOM */
PACK ('H','l','u','w'), /* UCHAR_SCRIPT_ANATOLIAN_HIEROGLYPHS */
PACK ('H','a','t','r'), /* UCHAR_SCRIPT_HATRAN */
PACK ('M','u','l','t'), /* UCHAR_SCRIPT_MULTANI */
PACK ('H','u','n','g'), /* UCHAR_SCRIPT_OLD_HUNGARIAN */
PACK ('S','g','n','w'), /* UCHAR_SCRIPT_SIGNWRITING */
/* Unicode 9.0 additions */
PACK ('A','d','l','m'), /* UCHAR_SCRIPT_ADLAM */
PACK ('B','h','k','s'), /* UCHAR_SCRIPT_BHAIKSUKI */
PACK ('M','a','r','c'), /* UCHAR_SCRIPT_MARCHEN */
PACK ('N','e','w','a'), /* UCHAR_SCRIPT_NEWA */
PACK ('O','s','g','e'), /* UCHAR_SCRIPT_OSAGE */
PACK ('T','a','n','g'), /* UCHAR_SCRIPT_TANGUT */
/* Unicode 10.0 additions */
PACK ('G','o','n','m'), /* UCHAR_SCRIPT_MASARAM_GONDI */
PACK ('N','s','h','u'), /* UCHAR_SCRIPT_NUSHU */
PACK ('S','o','y','o'), /* UCHAR_SCRIPT_SOYOMBO */
PACK ('Z','a','n','b'), /* UCHAR_SCRIPT_ZANABAZAR_SQUARE */
/* Unicode 11.0 additions */
PACK ('D','o','g','r'), /* UCHAR_SCRIPT_DOGRA */
PACK ('G','o','n','g'), /* UCHAR_SCRIPT_GUNJALA_GONDI */
PACK ('R','o','h','g'), /* UCHAR_SCRIPT_HANIFI_ROHINGYA */
PACK ('M','a','k','a'), /* UCHAR_SCRIPT_MAKASAR */
PACK ('M','e','d','f'), /* UCHAR_SCRIPT_MEDEFAIDRIN */
PACK ('S','o','g','o'), /* UCHAR_SCRIPT_OLD_SOGDIAN */
PACK ('S','o','g','d'), /* UCHAR_SCRIPT_SOGDIAN */
#undef PACK
};
Uint32 GUIAPI UCharScriptTypeToISO15924 (int script)
{
if (script == UCHAR_SCRIPT_INVALID_CODE)
return 0;
if (script < 0 || script >= (int) TABLESIZE (iso15924_tags))
return 0x5A7A7A7A;
return iso15924_tags[script];
}
int GUIAPI UCharScriptTypeFromISO15924 (Uint32 iso15924)
{
unsigned int i;
if (!iso15924)
return UCHAR_SCRIPT_INVALID_CODE;
for (i = 0; i < TABLESIZE (iso15924_tags); i++)
if (iso15924_tags[i] == iso15924)
return (int) i;
return UCHAR_SCRIPT_UNKNOWN;
}
#endif /* _MGCHARSET_UNICODE */
File diff suppressed because it is too large Load Diff
+2 -31
View File
@@ -1,35 +1,6 @@
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Or,
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
* This file is copied from LGPL'd glib 2.59.
* It is automatically generated by gen-unicode-tables.pl
*/
#ifndef CHARTABLES_H
+1552
View File
File diff suppressed because it is too large Load Diff
+142
View File
@@ -0,0 +1,142 @@
aa Afar
ab Abkhazian
af Afrikaans
am Amharic
ar Arabic
as Assamese
ay Aymara
az Azerbaijani
ba Bashkir
be Byelorussian
bg Bulgarian
bh Bihari
bi Bislama
bn Bengali
bo Tibetan
br Breton
ca Catalan
co Corsican
cs Czech
cy Welch
da Danish
de German
dz Bhutani
el Greek
en English
eo Esperanto
es Spanish
et Estonian
eu Basque
fa Persian
fi Finnish
fj Fiji
fo Faeroese
fr French
fy Frisian
ga Irish
gd Scots Gaelic
gl Galician
gn Guarani
gu Gujarati
ha Hausa
hi Hindi
he Hebrew
hr Croatian
hu Hungarian
hy Armenian
ia Interlingua
id Indonesian
ie Interlingue
ik Inupiak
in former Indonesian
is Icelandic
it Italian
iu Inuktitut (Eskimo)
iw former Hebrew
ja Japanese
ji former Yiddish
jw Javanese
ka Georgian
kk Kazakh
kl Greenlandic
km Cambodian
kn Kannada
ko Korean
ks Kashmiri
ku Kurdish
ky Kirghiz
la Latin
ln Lingala
lo Laothian
lt Lithuanian
lv Latvian, Lettish
mg Malagasy
mi Maori
mk Macedonian
ml Malayalam
mn Mongolian
mo Moldavian
mr Marathi
ms Malay
mt Maltese
my Burmese
na Nauru
ne Nepali
nl Dutch
no Norwegian
oc Occitan
om (Afan) Oromo
or Oriya
pa Punjabi
pl Polish
ps Pashto, Pushto
pt Portuguese
qu Quechua
rm Rhaeto-Romance
rn Kirundi
ro Romanian
ru Russian
rw Kinyarwanda
sa Sanskrit
sd Sindhi
sg Sangro
sh Serbo-Croatian
si Singhalese
sk Slovak
sl Slovenian
sm Samoan
sn Shona
so Somali
sq Albanian
sr Serbian
ss Siswati
st Sesotho
su Sudanese
sv Swedish
sw Swahili
ta Tamil
te Tegulu
tg Tajik
th Thai
ti Tigrinya
tk Turkmen
tl Tagalog
tn Setswana
to Tonga
tr Turkish
ts Tsonga
tt Tatar
tw Twi
ug Uigur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
vo Volapuk
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
za Zhuang
zh Chinese
zu Zulu
File diff suppressed because it is too large Load Diff