1 /**
2  *  Yudit Unicode Editor Source File
3  *
4  *  GNU Copyright (C) 1997-2006  Gaspar Sinai <gaspar@yudit.org>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License, version 2,
8  *  dated June 1991. See file COPYYING for details.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef SCluster_h
21 #define SCluster_h
22 #include "stoolkit/STypes.h"
23 
24 #define SD_YUDIT 0
25 /* ligature 0x8001xxxx */
26 #define SD_DEVANAGARI 1
27 /* ligature 0x8002xxxx */
28 #define SD_BENGALI 2
29 /* ligature 0x8003xxxx */
30 #define SD_GURMUKHI 3
31 /* ligature 0x8004xxxx */
32 #define SD_GUJARATI 4
33 /* ligature 0x8005xxxx */
34 #define SD_ORIYA 5
35 /* ligature 0x8006xxxx */
36 #define SD_TAMIL 6
37 /* ligature 0x8007xxxx */
38 #define SD_TELUGU 7
39 /* ligature 0x8008xxxx */
40 #define SD_KANNADA 8
41 /* ligature 0x8009xxxx */
42 #define SD_MALAYALAM 9
43 /* ligature 0x800axxxx */
44 #define SD_SINHALA 10
45 /* Hangul */
46 #define SD_HANGUL_JAMO 11
47 
48 /* Precomposed Unicode JAMOS */
49 #define SD_HANGUL_PREC 12
50 
51 /* Thai, Lao and Tibetan will need positioning */
52 #define SD_THAI 13
53 #define SD_LAO 14
54 #define SD_TIBETAN 15
55 
56 /* complex combining ligature
57   a ligature that has combining marks in the middle  */
58 #define SD_COMBINING_LIGATURE 16
59 
60 /* bengali Ra+Ya in the beginning of the word. */
61 #define SD_BENGALI_BEGIN 17
62 
63 /* Old Hungarian */
64 #define SD_PUA_ROVAS 18
65 
66 // AKA OLD HUNGARIAN from Unicode 7.0.0
67 #define SD_ROVASIRAS 19
68 
69 #define SD_REGIONAL_INDICATOR_SYMBOL 20
70 
71 #define SD_SCRIPT_MAX 21
72 
73 /* Arabic and Syriac shapes A000[1234]000. */
74 /* if we are not this lucky we would need one for each */
75 #define SD_AS_SHAPES 0x2000
76 
77 /* Escape 9fffffxx */
78 #define SD_AS_LITERAL 0x1fff
79 
80 /* get the name of OTF font shaping feature name */
81 const char* getShapeCode (unsigned int icode);
82 
83 /**
84  * This one generates ligature on the non-displayable cluster
85  */
86 unsigned int getCluster (const SV_UCS4& ucs4, unsigned int index,
87    SV_UCS4* ret, int* finished=0);
88 
89 SS_UCS4 addCombiningLigature (const SS_UCS4* unicode, unsigned int ul,
90   const SS_UCS4* ligAndMarks, unsigned int cl);
91 
92 void putLigatureUnicode (SS_UCS4 ligature, const SS_UCS4* code,
93  unsigned int size);
94 
95 void putLigatureCluster (SS_UCS4 ligature, const SS_UCS4* code,
96  unsigned int size);
97 
98 unsigned int getLigatureUnicode (SS_UCS4 ligature, SS_UCS4* buffer);
99 unsigned int getLigatureCluster (SS_UCS4 ligature, SS_UCS4* buffer);
100 
101 bool isLigature (SS_UCS4 _comp);
102 
103 /* get script name or null */
104 const char* getLigatureScript (SS_UCS4 comp);
105 int   getLigatureScriptCode (SS_UCS4 comp);
106 
107 int getCharType (SS_UCS4 unchar);
108 
109 #define SD_JAMO_X 0 /* non-jamo */
110 #define SD_JAMO_L 1 /* choseong:  leanding consonants or syllable initials */
111 #define SD_JAMO_V 2 /* jungseong: vowels or syllable-peak characters */
112 #define SD_JAMO_T 3 /* jongseong: trailing consonants or syllable final characters  */
113 int getJamoClass (SS_UCS4 uc);
114 
115 /* get the index */
116 int getUnicodeScript (SS_UCS4 comp);
117 bool isCoveredScipt (SS_UCS4 comp, int scipt);
118 
119 SS_UCS4 getHalant (int index);
120 
121 SS_UCS4 getLRVowelLeft (SS_UCS4 u);
122 SS_UCS4 getLRVowelRight (SS_UCS4 u);
123 /**
124  * Some encoders will give back values in yudit ligature range.
125  * Expand those ligatures.
126  */
127 void expandYuditLigatures (SV_UCS4* decd);
128 
129 /* 1,2 is rovas, 3 is already a cluster */
130 int getRovasType (SS_UCS4 chr);
131 
132 int getPUARovasType (SS_UCS4 chr);
133 
134 
135 #define SD_INDIC_CONSONANT_BELOW_BASE 0x1
136 #define SD_INDIC_HALANT 0x2
137 #define SD_INDIC_INDEP_VOWEL 0x3
138 #define SD_INDIC_LEFT_VOWEL 0x4
139 #define SD_INDIC_RIGHT_VOWEL 0x5
140 #define SD_INDIC_TOP_VOWEL 0x6
141 #define SD_INDIC_BOTTOM_VOWEL 0x7
142 #define SD_INDIC_SIGN 0x8
143 #define SD_INDIC_ZWJ 0x9
144 #define SD_INDIC_ZWNJ 0xa
145 
146 #define SD_INDIC_NUKTA 0xc
147 #define SD_INDIC_MODIFIER 0xd
148 #define SD_INDIC_LEFT_RIGHT_VOWEL 0xe
149 
150 #define SD_INDIC_CONSONANT_BASE 0xf
151 #define SD_INDIC_CONSONANT_POST_BASE 0x10
152 #define SD_INDIC_CONSONANT_DEAD 0x11
153 
154 #endif /* SCluster_h */
155