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

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

Issue 12438036: Update harfbuzz-ng to 0.9.14 from 0.9.10 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 © 2009,2010 Red Hat, Inc. 2 * Copyright © 2009,2010 Red Hat, Inc.
3 * Copyright © 2010,2011,2012 Google, Inc. 3 * Copyright © 2010,2011,2012 Google, Inc.
4 * 4 *
5 * This is part of HarfBuzz, a text shaping library. 5 * This is part of HarfBuzz, a text shaping library.
6 * 6 *
7 * Permission is hereby granted, without written agreement and without 7 * Permission is hereby granted, without written agreement and without
8 * license or royalty fees, to use, copy, modify, and distribute this 8 * license or royalty fees, to use, copy, modify, and distribute this
9 * software and its documentation for any purpose, provided that the 9 * software and its documentation for any purpose, provided that the
10 * above copyright notice and the following two paragraphs appear in 10 * above copyright notice and the following two paragraphs appear in
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 public: 43 public:
44 44
45 struct feature_map_t { 45 struct feature_map_t {
46 hb_tag_t tag; /* should be first for our bsearch to work */ 46 hb_tag_t tag; /* should be first for our bsearch to work */
47 unsigned int index[2]; /* GSUB/GPOS */ 47 unsigned int index[2]; /* GSUB/GPOS */
48 unsigned int stage[2]; /* GSUB/GPOS */ 48 unsigned int stage[2]; /* GSUB/GPOS */
49 unsigned int shift; 49 unsigned int shift;
50 hb_mask_t mask; 50 hb_mask_t mask;
51 hb_mask_t _1_mask; /* mask for value=1, for quick access */ 51 hb_mask_t _1_mask; /* mask for value=1, for quick access */
52 hb_bool_t needs_fallback; 52 unsigned int needs_fallback : 1;
53 unsigned int auto_zwj : 1;
53 54
54 static int cmp (const feature_map_t *a, const feature_map_t *b) 55 static int cmp (const feature_map_t *a, const feature_map_t *b)
55 { return a->tag < b->tag ? -1 : a->tag > b->tag ? 1 : 0; } 56 { return a->tag < b->tag ? -1 : a->tag > b->tag ? 1 : 0; }
56 }; 57 };
57 58
58 struct lookup_map_t { 59 struct lookup_map_t {
59 unsigned int index; 60 unsigned short index;
61 unsigned short auto_zwj : 1;
60 hb_mask_t mask; 62 hb_mask_t mask;
61 63
62 static int cmp (const lookup_map_t *a, const lookup_map_t *b) 64 static int cmp (const lookup_map_t *a, const lookup_map_t *b)
63 { return a->index < b->index ? -1 : a->index > b->index ? 1 : 0; } 65 { return a->index < b->index ? -1 : a->index > b->index ? 1 : 0; }
64 }; 66 };
65 67
66 typedef void (*pause_func_t) (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer); 68 typedef void (*pause_func_t) (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer);
67 69
68 struct pause_map_t { 70 struct pause_map_t {
69 unsigned int num_lookups; /* Cumulative */ 71 unsigned int num_lookups; /* Cumulative */
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 131
130 public: 132 public:
131 hb_tag_t chosen_script[2]; 133 hb_tag_t chosen_script[2];
132 bool found_script[2]; 134 bool found_script[2];
133 135
134 private: 136 private:
135 137
136 HB_INTERNAL void add_lookups (hb_face_t *face, 138 HB_INTERNAL void add_lookups (hb_face_t *face,
137 unsigned int table_index, 139 unsigned int table_index,
138 unsigned int feature_index, 140 unsigned int feature_index,
139 » » » » hb_mask_t mask); 141 » » » » hb_mask_t mask,
142 » » » » bool auto_zwj);
140 143
141 hb_mask_t global_mask; 144 hb_mask_t global_mask;
142 145
143 hb_prealloced_array_t<feature_map_t, 8> features; 146 hb_prealloced_array_t<feature_map_t, 8> features;
144 hb_prealloced_array_t<lookup_map_t, 32> lookups[2]; /* GSUB/GPOS */ 147 hb_prealloced_array_t<lookup_map_t, 32> lookups[2]; /* GSUB/GPOS */
145 hb_prealloced_array_t<pause_map_t, 1> pauses[2]; /* GSUB/GPOS */ 148 hb_prealloced_array_t<pause_map_t, 1> pauses[2]; /* GSUB/GPOS */
146 }; 149 };
147 150
151 enum hb_ot_map_feature_flags_t {
152 F_NONE = 0x0000,
153 F_GLOBAL = 0x0001,
154 F_HAS_FALLBACK = 0x0002,
155 F_MANUAL_ZWJ = 0x0004
156 };
157 /* Macro version for where const is desired. */
158 #define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigne d int) (r)))
159 inline hb_ot_map_feature_flags_t
160 operator | (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
161 { return hb_ot_map_feature_flags_t ((unsigned int) l | (unsigned int) r); }
162 inline hb_ot_map_feature_flags_t
163 operator & (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
164 { return hb_ot_map_feature_flags_t ((unsigned int) l & (unsigned int) r); }
165 inline hb_ot_map_feature_flags_t
166 operator ~ (hb_ot_map_feature_flags_t r)
167 { return hb_ot_map_feature_flags_t (~(unsigned int) r); }
168 inline hb_ot_map_feature_flags_t&
169 operator |= (hb_ot_map_feature_flags_t &l, hb_ot_map_feature_flags_t r)
170 { l = l | r; return l; }
171 inline hb_ot_map_feature_flags_t&
172 operator &= (hb_ot_map_feature_flags_t& l, hb_ot_map_feature_flags_t r)
173 { l = l & r; return l; }
174
148 175
149 struct hb_ot_map_builder_t 176 struct hb_ot_map_builder_t
150 { 177 {
151 public: 178 public:
152 179
153 HB_INTERNAL hb_ot_map_builder_t (hb_face_t *face_, 180 HB_INTERNAL hb_ot_map_builder_t (hb_face_t *face_,
154 const hb_segment_properties_t *props_); 181 const hb_segment_properties_t *props_);
155 182
156 HB_INTERNAL void add_feature (hb_tag_t tag, unsigned int value, bool global, b ool has_fallback = false); 183 HB_INTERNAL void add_feature (hb_tag_t tag, unsigned int value,
184 » » » » hb_ot_map_feature_flags_t flags);
157 185
158 inline void add_bool_feature (hb_tag_t tag, bool global = true, bool has_fallb ack = false) 186 inline void add_global_bool_feature (hb_tag_t tag)
159 { add_feature (tag, 1, global, has_fallback); } 187 { add_feature (tag, 1, F_GLOBAL); }
160 188
161 inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func) 189 inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func)
162 { add_pause (0, pause_func); } 190 { add_pause (0, pause_func); }
163 inline void add_gpos_pause (hb_ot_map_t::pause_func_t pause_func) 191 inline void add_gpos_pause (hb_ot_map_t::pause_func_t pause_func)
164 { add_pause (1, pause_func); } 192 { add_pause (1, pause_func); }
165 193
166 HB_INTERNAL void compile (struct hb_ot_map_t &m); 194 HB_INTERNAL void compile (struct hb_ot_map_t &m);
167 195
168 inline void finish (void) { 196 inline void finish (void) {
169 feature_infos.finish (); 197 feature_infos.finish ();
170 pauses[0].finish (); 198 pauses[0].finish ();
171 pauses[1].finish (); 199 pauses[1].finish ();
172 } 200 }
173 201
174 private: 202 private:
175 203
176 struct feature_info_t { 204 struct feature_info_t {
177 hb_tag_t tag; 205 hb_tag_t tag;
178 unsigned int seq; /* sequence#, used for stable sorting only */ 206 unsigned int seq; /* sequence#, used for stable sorting only */
179 unsigned int max_value; 207 unsigned int max_value;
180 bool global; /* whether the feature applies value to every glyph in the buff er */ 208 hb_ot_map_feature_flags_t flags;
181 bool has_fallback; /* whether to allocate bits even if feature not found */
182 unsigned int default_value; /* for non-global features, what should the unse t glyphs take */ 209 unsigned int default_value; /* for non-global features, what should the unse t glyphs take */
183 unsigned int stage[2]; /* GSUB/GPOS */ 210 unsigned int stage[2]; /* GSUB/GPOS */
184 211
185 static int cmp (const feature_info_t *a, const feature_info_t *b) 212 static int cmp (const feature_info_t *a, const feature_info_t *b)
186 { return (a->tag != b->tag) ? (a->tag < b->tag ? -1 : 1) : (a->seq < b->seq ? -1 : 1); } 213 { return (a->tag != b->tag) ? (a->tag < b->tag ? -1 : 1) : (a->seq < b->seq ? -1 : 1); }
187 }; 214 };
188 215
189 struct pause_info_t { 216 struct pause_info_t {
190 unsigned int stage; 217 unsigned int stage;
191 hb_ot_map_t::pause_func_t callback; 218 hb_ot_map_t::pause_func_t callback;
(...skipping 13 matching lines...) Expand all
205 private: 232 private:
206 233
207 unsigned int current_stage[2]; /* GSUB/GPOS */ 234 unsigned int current_stage[2]; /* GSUB/GPOS */
208 hb_prealloced_array_t<feature_info_t,16> feature_infos; 235 hb_prealloced_array_t<feature_info_t,16> feature_infos;
209 hb_prealloced_array_t<pause_info_t, 1> pauses[2]; /* GSUB/GPOS */ 236 hb_prealloced_array_t<pause_info_t, 1> pauses[2]; /* GSUB/GPOS */
210 }; 237 };
211 238
212 239
213 240
214 #endif /* HB_OT_MAP_PRIVATE_HH */ 241 #endif /* HB_OT_MAP_PRIVATE_HH */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698