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

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

Issue 10915172: harfbuzz-ng roll (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 © 2010,2011,2012 Google, Inc. 2 * Copyright © 2010,2011,2012 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.
(...skipping 11 matching lines...) Expand all
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.hh" 30 #include "hb-private.hh"
31 31
32 #include "hb-ot-map-private.hh" 32 #include "hb-ot-shape-private.hh"
33 #include "hb-ot-shape-normalize-private.hh" 33 #include "hb-ot-shape-normalize-private.hh"
34 34
35 35
36 36
37 /* buffer var allocations, used during the entire shaping process */
38 #define unicode_props0() var1.u8[0]
39 #define unicode_props1() var1.u8[1]
40
41 /* buffer var allocations, used during the GSUB/GPOS processing */
42 #define props_cache() var1.u16[1] /* GSUB/GPOS glyph_props cache */
43 #define syllable() var2.u8[0] /* GSUB/GPOS shaping boundaries */
44 #define lig_props() var2.u8[1] /* GSUB/GPOS ligature tracking */
45
46 /* buffer var allocations, used by complex shapers */ 37 /* buffer var allocations, used by complex shapers */
47 #define complex_var_persistent_u8_0()» var2.u8[2] 38 #define complex_var_u8_0()» var2.u8[2]
48 #define complex_var_persistent_u8_1()» var2.u8[3] 39 #define complex_var_u8_1()» var2.u8[3]
49 #define complex_var_temporary_u8()» var2.u8[0]
50 40
51 41
42
43 /* Master OT shaper list */
52 #define HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS \ 44 #define HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS \
53 HB_COMPLEX_SHAPER_IMPLEMENT (default) /* should be first */ \ 45 HB_COMPLEX_SHAPER_IMPLEMENT (default) /* should be first */ \
54 HB_COMPLEX_SHAPER_IMPLEMENT (arabic) \ 46 HB_COMPLEX_SHAPER_IMPLEMENT (arabic) \
55 HB_COMPLEX_SHAPER_IMPLEMENT (hangul) \
56 HB_COMPLEX_SHAPER_IMPLEMENT (indic) \ 47 HB_COMPLEX_SHAPER_IMPLEMENT (indic) \
57 HB_COMPLEX_SHAPER_IMPLEMENT (thai) \ 48 HB_COMPLEX_SHAPER_IMPLEMENT (thai) \
58 /* ^--- Add new shapers here */ 49 /* ^--- Add new shapers here */
59 50
60 enum hb_ot_complex_shaper_t { 51
61 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) hb_ot_complex_shaper_##name, 52 struct hb_ot_complex_shaper_t
62 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS 53 {
63 /* Just here to avoid enum trailing comma: */ 54 char name[8];
64 hb_ot_complex_shaper_generic = hb_ot_complex_shaper_default 55
65 #undef HB_COMPLEX_SHAPER_IMPLEMENT 56 /* collect_features()
57 * Called during shape_plan().
58 * Shapers should use plan->map to add their features and callbacks.
59 */
60 void (*collect_features) (hb_ot_shape_planner_t *plan);
61
62 /* override_features()
63 * Called during shape_plan().
64 * Shapers should use plan->map to override features and add callbacks after
65 * common features are added.
66 */
67 void (*override_features) (hb_ot_shape_planner_t *plan);
68
69
70 /* data_create()
71 * Called at the end of shape_plan().
72 * Whatever shapers return will be accessible through plan->data later.
73 * If NULL is returned, means a plan failure.
74 */
75 void *(*data_create) (const hb_ot_shape_plan_t *plan);
76
77 /* data_destroy()
78 * Called when the shape_plan is being destroyed.
79 * plan->data is passed here for destruction.
80 * If NULL is returned, means a plan failure.
81 * May be NULL. */
82 void (*data_destroy) (void *data);
83
84
85 /* preprocess_text()
86 * Called during shape().
87 * Shapers can use to modify text before shaping starts.
88 */
89 void (*preprocess_text) (const hb_ot_shape_plan_t *plan,
90 » » » hb_buffer_t *buffer,
91 » » » hb_font_t *font);
92
93
94 /* normalization_preference()
95 * Called during shape().
96 */
97 hb_ot_shape_normalization_mode_t
98 (*normalization_preference) (const hb_ot_shape_plan_t *plan);
99
100 /* setup_masks()
101 * Called during shape().
102 * Shapers should use map to get feature masks and set on buffer.
103 * Shapers may NOT modify characters.
104 */
105 void (*setup_masks) (const hb_ot_shape_plan_t *plan,
106 » » hb_buffer_t *buffer,
107 » » hb_font_t *font);
108
109 bool zero_width_attached_marks;
66 }; 110 };
67 111
68 static inline hb_ot_complex_shaper_t 112 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) extern HB_INTERNAL const hb_ot_complex _shaper_t _hb_ot_complex_shaper_##name;
113 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
114 #undef HB_COMPLEX_SHAPER_IMPLEMENT
115
116
117 static inline const hb_ot_complex_shaper_t *
69 hb_ot_shape_complex_categorize (const hb_segment_properties_t *props) 118 hb_ot_shape_complex_categorize (const hb_segment_properties_t *props)
70 { 119 {
71 switch ((hb_tag_t) props->script) 120 switch ((hb_tag_t) props->script)
72 { 121 {
73 default: 122 default:
74 return hb_ot_complex_shaper_default; 123 return &_hb_ot_complex_shaper_default;
75 124
76 125
77 /* Unicode-1.1 additions */ 126 /* Unicode-1.1 additions */
78 case HB_SCRIPT_ARABIC: 127 case HB_SCRIPT_ARABIC:
79 case HB_SCRIPT_MONGOLIAN: 128 case HB_SCRIPT_MONGOLIAN:
80 case HB_SCRIPT_SYRIAC: 129 case HB_SCRIPT_SYRIAC:
81 130
82 /* Unicode-5.0 additions */ 131 /* Unicode-5.0 additions */
83 case HB_SCRIPT_NKO: 132 case HB_SCRIPT_NKO:
84 133
85 /* Unicode-6.0 additions */ 134 /* Unicode-6.0 additions */
86 case HB_SCRIPT_MANDAIC: 135 case HB_SCRIPT_MANDAIC:
87 136
88 return hb_ot_complex_shaper_arabic; 137 return &_hb_ot_complex_shaper_arabic;
89
90
91 /* Unicode-1.1 additions */
92 case HB_SCRIPT_HANGUL:
93
94 return hb_ot_complex_shaper_hangul;
95 138
96 139
97 /* Unicode-1.1 additions */ 140 /* Unicode-1.1 additions */
98 case HB_SCRIPT_THAI: 141 case HB_SCRIPT_THAI:
99 case HB_SCRIPT_LAO: 142 case HB_SCRIPT_LAO:
100 143
101 return hb_ot_complex_shaper_thai; 144 return &_hb_ot_complex_shaper_thai;
102 145
103 146
104 147
105 /* ^--- Add new shapers here */ 148 /* ^--- Add new shapers here */
106 149
107 150
108 #if 0 151 #if 0
109 /* Note: 152 /* Note:
110 * 153 *
111 * These disabled scripts are listed in ucd/IndicSyllabicCategory.txt, but a ccording 154 * These disabled scripts are listed in ucd/IndicSyllabicCategory.txt, but a ccording
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 /* Unicode-5.2 additions */ 249 /* Unicode-5.2 additions */
207 case HB_SCRIPT_JAVANESE: 250 case HB_SCRIPT_JAVANESE:
208 case HB_SCRIPT_KAITHI: 251 case HB_SCRIPT_KAITHI:
209 case HB_SCRIPT_TAI_THAM: 252 case HB_SCRIPT_TAI_THAM:
210 253
211 /* Unicode-6.1 additions */ 254 /* Unicode-6.1 additions */
212 case HB_SCRIPT_CHAKMA: 255 case HB_SCRIPT_CHAKMA:
213 case HB_SCRIPT_SHARADA: 256 case HB_SCRIPT_SHARADA:
214 case HB_SCRIPT_TAKRI: 257 case HB_SCRIPT_TAKRI:
215 258
216 return hb_ot_complex_shaper_indic; 259 return &_hb_ot_complex_shaper_indic;
217 } 260 }
218 } 261 }
219 262
220 263
221
222 /*
223 * collect_features()
224 *
225 * Called during shape_plan().
226 *
227 * Shapers should use map to add their features and callbacks.
228 */
229
230 typedef void hb_ot_shape_complex_collect_features_func_t (hb_ot_map_builder_t *m ap, const hb_segment_properties_t *props);
231 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
232 HB_INTERNAL hb_ot_shape_complex_collect_features_func_t _hb_ot_shape_complex_c ollect_features_##name;
233 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
234 #undef HB_COMPLEX_SHAPER_IMPLEMENT
235
236 static inline void
237 hb_ot_shape_complex_collect_features (hb_ot_complex_shaper_t shaper,
238 hb_ot_map_builder_t *map,
239 const hb_segment_properties_t *props)
240 {
241 switch (shaper) {
242 default:
243 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
244 case hb_ot_complex_shaper_##name: _hb_ot_shape_complex_collect_features_## name (map, props); return;
245 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
246 #undef HB_COMPLEX_SHAPER_IMPLEMENT
247 }
248 }
249
250
251 /*
252 * normalization_preference()
253 *
254 * Called during shape_execute().
255 *
256 * Shapers should return true if it prefers decomposed (NFD) input rather than p recomposed (NFC).
257 */
258
259 typedef hb_ot_shape_normalization_mode_t hb_ot_shape_complex_normalization_prefe rence_func_t (void);
260 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
261 HB_INTERNAL hb_ot_shape_complex_normalization_preference_func_t _hb_ot_shape_c omplex_normalization_preference_##name;
262 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
263 #undef HB_COMPLEX_SHAPER_IMPLEMENT
264
265 static inline hb_ot_shape_normalization_mode_t
266 hb_ot_shape_complex_normalization_preference (hb_ot_complex_shaper_t shaper)
267 {
268 switch (shaper) {
269 default:
270 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
271 case hb_ot_complex_shaper_##name: return _hb_ot_shape_complex_normalizatio n_preference_##name ();
272 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
273 #undef HB_COMPLEX_SHAPER_IMPLEMENT
274 }
275 }
276
277
278 /* setup_masks()
279 *
280 * Called during shape_execute().
281 *
282 * Shapers should use map to get feature masks and set on buffer.
283 */
284
285 typedef void hb_ot_shape_complex_setup_masks_func_t (hb_ot_map_t *map, hb_buffer _t *buffer, hb_font_t *font);
286 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
287 HB_INTERNAL hb_ot_shape_complex_setup_masks_func_t _hb_ot_shape_complex_setup_ masks_##name;
288 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
289 #undef HB_COMPLEX_SHAPER_IMPLEMENT
290
291 static inline void
292 hb_ot_shape_complex_setup_masks (hb_ot_complex_shaper_t shaper,
293 hb_ot_map_t *map,
294 hb_buffer_t *buffer,
295 hb_font_t *font)
296 {
297 switch (shaper) {
298 default:
299 #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \
300 case hb_ot_complex_shaper_##name: _hb_ot_shape_complex_setup_masks_##name (map, buffer, font); return;
301 HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS
302 #undef HB_COMPLEX_SHAPER_IMPLEMENT
303 }
304 }
305
306
307
308 #endif /* HB_OT_SHAPE_COMPLEX_PRIVATE_HH */ 264 #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-fallback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698