Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-ot-shape-complex-private.hh

Issue 9223010: Update harfbuzz-ng to 1a5a91dc0d8bf4b72a2f22dc6300b06ad7000b79. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't use -M option for 'git diff' to patch correctly Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. 2 * Copyright © 2010,2011 Google, Inc.
3 * 3 *
4 * This is part of HarfBuzz, a text shaping library. 4 * This is part of HarfBuzz, a text shaping library.
5 * 5 *
6 * Permission is hereby granted, without written agreement and without 6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this 7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the 8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in 9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software. 10 * all copies of this software.
11 * 11 *
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16 * DAMAGE. 16 * DAMAGE.
17 * 17 *
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23 * 23 *
24 * Google Author(s): Behdad Esfahbod 24 * Google Author(s): Behdad Esfahbod
25 */ 25 */
26 26
27 #ifndef HB_OT_SHAPE_COMPLEX_PRIVATE_HH 27 #ifndef HB_OT_SHAPE_COMPLEX_PRIVATE_HH
28 #define HB_OT_SHAPE_COMPLEX_PRIVATE_HH 28 #define HB_OT_SHAPE_COMPLEX_PRIVATE_HH
29 29
30 #include "hb-private.h" 30 #include "hb-private.hh"
31 31
32 #include "hb-ot-shape-private.hh" 32 #include "hb-ot-map-private.hh"
33 33
34 HB_BEGIN_DECLS
35 34
36 35
36 /* buffer var allocations, used during the entire shaping process */
37 #define general_category() var1.u8[0] /* unicode general_category (hb_unicode_ge neral_category_t) */
38 #define combining_class() var1.u8[1] /* unicode combining_class (uint8_t) */
39
40 /* buffer var allocations, used by complex shapers */
41 #define complex_var_persistent_u8_0() var2.u8[0]
42 #define complex_var_persistent_u8_1() var2.u8[1]
43 #define complex_var_persistent_u16() var2.u16[0]
44 #define complex_var_temporary_u8_0() var2.u8[2]
45 #define complex_var_temporary_u8_1() var2.u8[3]
46 #define complex_var_temporary_u16() var2.u16[1]
47
48
49 #define HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS \
50 HB_COMPLEX_SHAPER_IMPLEMENT (default) /* should be first */ \
51 HB_COMPLEX_SHAPER_IMPLEMENT (arabic) \
52 HB_COMPLEX_SHAPER_IMPLEMENT (indic) \
53 /* ^--- Add new shapers here */
54
55 enum hb_ot_complex_shaper_t {
56 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) hb_ot_complex_shaper_##name,
57 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
58 /* Just here to avoid enum trailing comma: */
59 hb_ot_complex_shaper_generic = hb_ot_complex_shaper_default
60 #undef HB_COMPLEX_SHAPER_IMPLEMENT
61 };
62
37 static inline hb_ot_complex_shaper_t 63 static inline hb_ot_complex_shaper_t
38 hb_ot_shape_complex_categorize (const hb_segment_properties_t *props) 64 hb_ot_shape_complex_categorize (const hb_segment_properties_t *props)
39 { 65 {
40 switch ((int) props->script) { 66 switch ((int) props->script)
67 {
68 default:
69 return hb_ot_complex_shaper_default;
70
41 case HB_SCRIPT_ARABIC: 71 case HB_SCRIPT_ARABIC:
72 case HB_SCRIPT_MANDAIC:
73 case HB_SCRIPT_MONGOLIAN:
42 case HB_SCRIPT_NKO: 74 case HB_SCRIPT_NKO:
43 case HB_SCRIPT_SYRIAC: 75 case HB_SCRIPT_SYRIAC:
44 case HB_SCRIPT_MANDAIC:
45 case HB_SCRIPT_MONGOLIAN:
46 return hb_ot_complex_shaper_arabic; 76 return hb_ot_complex_shaper_arabic;
47 77
48 default: 78 #if 0
49 return hb_ot_complex_shaper_none; 79 /* Note:
80 *
81 * These disabled scripts are listed in ucd/IndicSyllabicCategory.txt, but a ccording
82 * to Martin Hosken do not require complex shaping.
83 *
84 * TODO We currently keep data for these scripts in our indic table. Need t o fix the
85 * generator to not do that.
86 */
87
88 /* Simple? */
89 case HB_SCRIPT_BATAK:
90 case HB_SCRIPT_BRAHMI:
91 case HB_SCRIPT_HANUNOO:
92 case HB_SCRIPT_MEETEI_MAYEK:
93 case HB_SCRIPT_SAURASHTRA:
94
95 /* Simple */
96 case HB_SCRIPT_KAYAH_LI:
97 case HB_SCRIPT_LAO:
98 case HB_SCRIPT_LIMBU:
99 case HB_SCRIPT_PHAGS_PA:
100 case HB_SCRIPT_SYLOTI_NAGRI:
101 case HB_SCRIPT_TAGALOG:
102 case HB_SCRIPT_TAGBANWA:
103 case HB_SCRIPT_TAI_LE:
104 case HB_SCRIPT_TAI_VIET:
105 case HB_SCRIPT_THAI:
106 case HB_SCRIPT_TIBETAN:
107
108 /* May need Indic treatment in the future? */
109 case HB_SCRIPT_MYANMAR:
110 #endif
111
112 case HB_SCRIPT_BALINESE:
113 case HB_SCRIPT_BENGALI:
114 case HB_SCRIPT_BUGINESE:
115 case HB_SCRIPT_BUHID:
116 case HB_SCRIPT_CHAM:
117 case HB_SCRIPT_DEVANAGARI:
118 case HB_SCRIPT_GUJARATI:
119 case HB_SCRIPT_GURMUKHI:
120 case HB_SCRIPT_JAVANESE:
121 case HB_SCRIPT_KAITHI:
122 case HB_SCRIPT_KANNADA:
123 case HB_SCRIPT_KHAROSHTHI:
124 case HB_SCRIPT_KHMER:
125 case HB_SCRIPT_LEPCHA:
126 case HB_SCRIPT_MALAYALAM:
127 case HB_SCRIPT_NEW_TAI_LUE:
128 case HB_SCRIPT_ORIYA:
129 case HB_SCRIPT_REJANG:
130 case HB_SCRIPT_SINHALA:
131 case HB_SCRIPT_SUNDANESE:
132 case HB_SCRIPT_TAI_THAM:
133 case HB_SCRIPT_TAMIL:
134 case HB_SCRIPT_TELUGU:
135 return hb_ot_complex_shaper_indic;
136
137 /* ^--- Add new shapers here */
50 } 138 }
51 } 139 }
52 140
53 141
54 142
55 /* 143 /*
56 * collect_features() 144 * collect_features()
57 * 145 *
58 * Called during shape_plan(). 146 * Called during shape_plan().
59 * 147 *
60 * Shapers should use plan->map to add their features. 148 * Shapers should use map to add their features and callbacks.
61 */ 149 */
62 150
63 HB_INTERNAL void _hb_ot_shape_complex_collect_features_arabic» (hb_ot_shape_pla n_t *plan, const hb_segment_properties_t *props); 151 typedef void hb_ot_shape_complex_collect_features_func_t (hb_ot_map_builder_t *m ap, const hb_segment_properties_t *props);
152 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
153 HB_INTERNAL hb_ot_shape_complex_collect_features_func_t _hb_ot_shape_complex_c ollect_features_##name;
154 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
155 #undef HB_COMPLEX_SHAPER_IMPLEMENT
64 156
65 static inline void 157 static inline void
66 hb_ot_shape_complex_collect_features (hb_ot_shape_plan_t *plan, 158 hb_ot_shape_complex_collect_features (hb_ot_complex_shaper_t shaper,
159 » » » » hb_ot_map_builder_t *map,
67 const hb_segment_properties_t *props) 160 const hb_segment_properties_t *props)
68 { 161 {
69 switch (plan->shaper) { 162 switch (shaper) {
70 case hb_ot_complex_shaper_arabic:» _hb_ot_shape_complex_collect_features_ar abic (plan, props);» return; 163 default:
71 case hb_ot_complex_shaper_none:» default:» » » » » » » return; 164 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
165 case hb_ot_complex_shaper_##name:» _hb_ot_shape_complex_collect_features_## name (map, props); return;
166 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
167 #undef HB_COMPLEX_SHAPER_IMPLEMENT
72 } 168 }
73 } 169 }
74 170
171
172 /*
173 * prefer_decomposed()
174 *
175 * Called during shape_execute().
176 *
177 * Shapers should return TRUE if it prefers decomposed (NFD) input rather than p recomposed (NFC).
178 */
179
180 typedef bool hb_ot_shape_complex_prefer_decomposed_func_t (void);
181 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
182 HB_INTERNAL hb_ot_shape_complex_prefer_decomposed_func_t _hb_ot_shape_complex_ prefer_decomposed_##name;
183 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
184 #undef HB_COMPLEX_SHAPER_IMPLEMENT
185
186 static inline bool
187 hb_ot_shape_complex_prefer_decomposed (hb_ot_complex_shaper_t shaper)
188 {
189 switch (shaper) {
190 default:
191 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
192 case hb_ot_complex_shaper_##name: return _hb_ot_shape_complex_prefer_decom posed_##name ();
193 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
194 #undef HB_COMPLEX_SHAPER_IMPLEMENT
195 }
196 }
197
75 198
76 /* setup_masks() 199 /* setup_masks()
77 * 200 *
78 * Called during shape_execute(). 201 * Called during shape_execute().
79 * 202 *
80 * Shapers should use c->plan.map to get feature masks and set on buffer. 203 * Shapers should use map to get feature masks and set on buffer.
81 */ 204 */
82 205
83 HB_INTERNAL void _hb_ot_shape_complex_setup_masks_arabic» (hb_ot_shape_con text_t *c); 206 typedef void hb_ot_shape_complex_setup_masks_func_t (hb_ot_map_t *map, hb_buffer _t *buffer);
207 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
208 HB_INTERNAL hb_ot_shape_complex_setup_masks_func_t _hb_ot_shape_complex_setup_ masks_##name;
209 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
210 #undef HB_COMPLEX_SHAPER_IMPLEMENT
84 211
85 static inline void 212 static inline void
86 hb_ot_shape_complex_setup_masks (hb_ot_shape_context_t *c) 213 hb_ot_shape_complex_setup_masks (hb_ot_complex_shaper_t shaper,
214 » » » » hb_ot_map_t *map,
215 » » » » hb_buffer_t *buffer)
87 { 216 {
88 switch (c->plan->shaper) { 217 switch (shaper) {
89 case hb_ot_complex_shaper_arabic:» _hb_ot_shape_complex_setup_masks_arabic (c);» return; 218 default:
90 case hb_ot_complex_shaper_none:» default:» » » » » return; 219 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
220 case hb_ot_complex_shaper_##name:» _hb_ot_shape_complex_setup_masks_##name (map, buffer); return;
221 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
222 #undef HB_COMPLEX_SHAPER_IMPLEMENT
91 } 223 }
92 } 224 }
93 225
94 226
95 HB_END_DECLS
96 227
97 #endif /* HB_OT_SHAPE_COMPLEX_PRIVATE_HH */ 228 #endif /* HB_OT_SHAPE_COMPLEX_PRIVATE_HH */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ot-shape-complex-misc.cc ('k') | third_party/harfbuzz-ng/src/hb-ot-shape-normalize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698