4 * Copyright (C) 2001, 2002 IBM Corporation. All Rights Reserved.
5 * Author: Eric Mader <mader@jtcsv.com>
7 * Permission is hereby granted, free of charge, to any person
8 * obtaining a copy of this software and associated documentation
9 * files (the "Software"), to deal in the Software without
10 * restriction, including without limitation the rights to use, copy,
11 * modify, merge, publish, distribute, and/or sell copies of the
12 * Software, and to permit persons to whom the Software is furnished
13 * to do so, provided that the above copyright notice(s) and this
14 * permission notice appear in all copies of the Software and that
15 * both the above copyright notice(s) and this permission notice
16 * appear in supporting documentation.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR
23 * ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
24 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
25 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
26 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
29 * Except as contained in this notice, the name of a copyright holder
30 * shall not be used in advertising or otherwise to promote the sale,
31 * use or other dealings in this Software without prior written
32 * authorization of the copyright holder.
35 #ifndef __INDIC_OT_H__
36 #define __INDIC_OT_H__
38 #include <pango/pango-glyph.h>
39 #include <pango/pango-types.h>
40 #include "mprefixups.h"
44 #ifdef PANGO_ENABLE_ENGINE
46 /* Characters that get refered to by name... */
47 #define C_SIGN_ZWNJ 0x200C
48 #define C_SIGN_ZWJ 0x200D
49 #define C_DOTTED_CIRCLE 0x25CC
52 * The characters that a split matra splits into.
53 * Unused characters will be zero.
55 typedef gunichar IndicOTSplitMatra[3];
58 * Character class values
63 CC_MODIFYING_MARK_ABOVE,
64 CC_MODIFYING_MARK_POST,
67 CC_CONSONANT_WITH_NUKTA,
74 } IndicOTCharClassValues;
77 * Character class flags
79 #define CF_CLASS_MASK 0x0000FFFFU
81 #define CF_CONSONANT 0x80000000U
83 #define CF_REPH 0x40000000U
84 #define CF_VATTU 0x20000000U
85 #define CF_BELOW_BASE 0x10000000U
86 #define CF_POST_BASE 0x08000000U
88 #define CF_MATRA_PRE 0x04000000U
89 #define CF_MATRA_BELOW 0x02000000U
90 #define CF_MATRA_ABOVE 0x01000000U
91 #define CF_MATRA_POST 0x00800000U
92 #define CF_LENGTH_MARK 0x00400000U
94 #define CF_INDEX_MASK 0x000F0000U
95 #define CF_INDEX_SHIFT 16
98 * Character class: a character class value
99 * ORed with character class flags.
101 typedef glong IndicOTCharClass;
106 #define SF_MATRAS_AFTER_BASE 0x80000000U
107 #define SF_REPH_AFTER_BELOW 0x40000000U
108 #define SF_EYELASH_RA 0x20000000U
109 #define SF_MPRE_FIXUP 0x10000000U
110 #define SF_PROCESS_ZWJ 0x08000000U
112 #define SF_POST_BASE_LIMIT_MASK 0x0000FFFFU
113 #define SF_NO_POST_BASE_LIMIT 0x00007FFFU
115 typedef guint32 IndicOTScriptFlags;
118 * Bit flags for the indic feature tags
120 enum indic_glyph_feature_
142 * Complement of the feature flags that
143 * will be assigned to specific glyphs.
145 * The names come from the ICU implementation,
146 * which listed the actual tags in an order
147 * such that tags could be assigned using the
148 * address of the first one: &tags[0], &tags[1],
149 * &tags[2], &tags[3]. The name of each set here
150 * is the name of the first tag in the ICU list.
152 enum indic_glyph_property_
154 rphf_p = (junk | dist | init),
155 blwf_p = (junk | dist | init | rphf),
156 half_p = (junk | dist | init | rphf | blwf),
157 pstf_p = (junk | dist | init | rphf | blwf | half),
158 nukt_p = (junk | dist | init | rphf | blwf | half | pstf)
162 * Macros to test the charClass flags for various things.
164 #define IS_VM_ABOVE(charClass) ((charClass & CF_CLASS_MASK) == CC_MODIFYING_MARK_ABOVE)
165 #define IS_VM_POST(charClass) ((charClass & CF_CLASS_MASK) == CC_MODIFYING_MARK_POST)
166 #define IS_CONSONANT(charClass) ((charClass & CF_CONSONANT) != 0)
167 #define IS_REPH(charClass) ((charClass & CF_REPH) != 0)
168 #define IS_NUKTA(charClass) ((charClass & CF_CLASS_MASK) == CC_NUKTA)
169 #define IS_VIRAMA(charClass) ((charClass & CF_CLASS_MASK) == CC_VIRAMA)
170 #define IS_AL_LAKUNA(charClass) ((charClass & CF_CLASS_MASK) == CC_AL_LAKUNA)
171 #define IS_VATTU(charClass) ((charClass & CF_VATTU) != 0)
172 #define IS_MATRA(charClass) ((charClass & CF_CLASS_MASK) == CC_DEPENDENT_VOWEL)
173 #define IS_SPLIT_MATRA(charClass) ((charClass & CF_INDEX_MASK) != 0)
174 #define IS_M_PRE(charClass) ((charClass & CF_MATRA_PRE) != 0)
175 #define IS_M_BELOW(charClass) ((charClass & CF_MATRA_BELOW) != 0)
176 #define IS_M_ABOVE(charClass) ((charClass & CF_MATRA_ABOVE) != 0)
177 #define IS_M_POST(charClass) ((charClass & CF_MATRA_POST) != 0)
178 #define IS_LENGTH_MARK(charClass) ((charClass & CF_LENGTH_MARK) != 0)
179 #define HAS_POST_OR_BELOW_BASE_FORM(charClass) ((charClass & (CF_POST_BASE | CF_BELOW_BASE)) != 0)
180 #define HAS_POST_BASE_FORM(charClass) ((charClass & CF_POST_BASE) != 0)
181 #define HAS_BELOW_BASE_FORM(charClass) ((charClass & CF_BELOW_BASE) != 0)
183 struct _IndicOTClassTable
187 glong worstCaseExpansion;
188 IndicOTScriptFlags scriptFlags;
190 const IndicOTCharClass *charClasses;
191 const IndicOTSplitMatra *splitMatraTable;
194 typedef struct _IndicOTClassTable IndicOTClassTable;
196 extern const IndicOTClassTable deva_class_table;
197 extern const IndicOTClassTable beng_class_table;
198 extern const IndicOTClassTable guru_class_table;
199 extern const IndicOTClassTable gujr_class_table;
200 extern const IndicOTClassTable orya_class_table;
201 extern const IndicOTClassTable taml_class_table;
202 extern const IndicOTClassTable telu_class_table;
203 extern const IndicOTClassTable knda_class_table;
204 extern const IndicOTClassTable mlym_class_table;
205 extern const IndicOTClassTable sinh_class_table;
207 const IndicOTSplitMatra *indic_ot_get_split_matra(const IndicOTClassTable *class_table, IndicOTCharClass char_class);
209 IndicOTCharClass indic_ot_get_char_class(const IndicOTClassTable *class_table, gunichar ch);
211 gboolean indic_ot_is_vm_above(const IndicOTClassTable *class_table, gunichar ch);
212 gboolean indic_ot_is_vm_post(const IndicOTClassTable *class_table, gunichar ch);
213 gboolean indic_ot_is_consonant(const IndicOTClassTable *class_table, gunichar ch);
214 gboolean indic_ot_is_reph(const IndicOTClassTable *class_table, gunichar ch);
215 gboolean indic_ot_is_virama(const IndicOTClassTable *class_table, gunichar ch);
216 gboolean indic_ot_is_al_lakuna(const IndicOTClassTable *class_table, gunichar ch);
217 gboolean indic_ot_is_nukta(const IndicOTClassTable *class_table, gunichar ch);
218 gboolean indic_ot_is_vattu(const IndicOTClassTable *class_table, gunichar ch);
219 gboolean indic_ot_is_matra(const IndicOTClassTable *class_table, gunichar ch);
220 gboolean indic_ot_is_split_matra(const IndicOTClassTable *class_table, gunichar ch);
221 gboolean indic_ot_is_m_pre(const IndicOTClassTable *class_table, gunichar ch);
222 gboolean indic_ot_is_m_below(const IndicOTClassTable *class_table, gunichar ch);
223 gboolean indic_ot_is_m_above(const IndicOTClassTable *class_table, gunichar ch);
224 gboolean indic_ot_is_m_post(const IndicOTClassTable *class_table, gunichar ch);
225 gboolean indic_ot_is_length_mark(const IndicOTClassTable *class_table, gunichar ch);
226 gboolean indic_ot_has_post_or_below_base_form(const IndicOTClassTable *class_table, gunichar ch);
227 gboolean indic_ot_has_post_base_form(const IndicOTClassTable *class_table, gunichar ch);
228 gboolean indic_ot_has_below_base_form(const IndicOTClassTable *class_table, gunichar ch);
230 glong indic_ot_find_syllable(const IndicOTClassTable *class_table, const gunichar *chars, glong prev, glong char_count);
232 glong indic_ot_reorder(const gunichar *chars, const glong *utf8_offsets, glong char_count, const IndicOTClassTable *class_table, gunichar *out_chars, glong *char_indices, gulong *char_tags, MPreFixups **outMPreFixups);
234 #endif /* PANGO_ENABLE_ENGINE */
238 #endif /* __INDIC_OT_H__ */