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

Side by Side Diff: third_party/harfbuzz-ng/src/hb-ot-layout-gdef-table.hh

Issue 1005693006: Roll harfbuzz-ng to 0.9.40 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright © 2007,2008,2009 Red Hat, Inc. 2 * Copyright © 2007,2008,2009 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (point_count) { 64 if (point_count) {
65 const USHORT *array = points.sub_array (start_offset, point_count); 65 const USHORT *array = points.sub_array (start_offset, point_count);
66 unsigned int count = *point_count; 66 unsigned int count = *point_count;
67 for (unsigned int i = 0; i < count; i++) 67 for (unsigned int i = 0; i < count; i++)
68 point_array[i] = array[i]; 68 point_array[i] = array[i];
69 } 69 }
70 70
71 return points.len; 71 return points.len;
72 } 72 }
73 73
74 inline bool sanitize (hb_sanitize_context_t *c) { 74 inline bool sanitize (hb_sanitize_context_t *c) const
75 {
75 TRACE_SANITIZE (this); 76 TRACE_SANITIZE (this);
76 return TRACE_RETURN (coverage.sanitize (c, this) && attachPoint.sanitize (c, this)); 77 return TRACE_RETURN (coverage.sanitize (c, this) && attachPoint.sanitize (c, this));
77 } 78 }
78 79
79 protected: 80 protected:
80 OffsetTo<Coverage> 81 OffsetTo<Coverage>
81 coverage; /* Offset to Coverage table -- from 82 coverage; /* Offset to Coverage table -- from
82 * beginning of AttachList table */ 83 * beginning of AttachList table */
83 OffsetArrayOf<AttachPoint> 84 OffsetArrayOf<AttachPoint>
84 attachPoint; /* Array of AttachPoint tables 85 attachPoint; /* Array of AttachPoint tables
85 * in Coverage Index order */ 86 * in Coverage Index order */
86 public: 87 public:
87 DEFINE_SIZE_ARRAY (4, attachPoint); 88 DEFINE_SIZE_ARRAY (4, attachPoint);
88 }; 89 };
89 90
90 /* 91 /*
91 * Ligature Caret Table 92 * Ligature Caret Table
92 */ 93 */
93 94
94 struct CaretValueFormat1 95 struct CaretValueFormat1
95 { 96 {
96 friend struct CaretValue; 97 friend struct CaretValue;
97 98
98 private: 99 private:
99 inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t directio n, hb_codepoint_t glyph_id HB_UNUSED) const 100 inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t directio n, hb_codepoint_t glyph_id HB_UNUSED) const
100 { 101 {
101 return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_x (coordinate ) : font->em_scale_y (coordinate); 102 return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_x (coordinate ) : font->em_scale_y (coordinate);
102 } 103 }
103 104
104 inline bool sanitize (hb_sanitize_context_t *c) { 105 inline bool sanitize (hb_sanitize_context_t *c) const
106 {
105 TRACE_SANITIZE (this); 107 TRACE_SANITIZE (this);
106 return TRACE_RETURN (c->check_struct (this)); 108 return TRACE_RETURN (c->check_struct (this));
107 } 109 }
108 110
109 protected: 111 protected:
110 USHORT caretValueFormat; /* Format identifier--format = 1 */ 112 USHORT caretValueFormat; /* Format identifier--format = 1 */
111 SHORT coordinate; /* X or Y value, in design units */ 113 SHORT coordinate; /* X or Y value, in design units */
112 public: 114 public:
113 DEFINE_SIZE_STATIC (4); 115 DEFINE_SIZE_STATIC (4);
114 }; 116 };
115 117
116 struct CaretValueFormat2 118 struct CaretValueFormat2
117 { 119 {
118 friend struct CaretValue; 120 friend struct CaretValue;
119 121
120 private: 122 private:
121 inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t directio n, hb_codepoint_t glyph_id) const 123 inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t directio n, hb_codepoint_t glyph_id) const
122 { 124 {
123 hb_position_t x, y; 125 hb_position_t x, y;
124 if (font->get_glyph_contour_point_for_origin (glyph_id, caretValuePoint, dir ection, &x, &y)) 126 if (font->get_glyph_contour_point_for_origin (glyph_id, caretValuePoint, dir ection, &x, &y))
125 return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y; 127 return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y;
126 else 128 else
127 return 0; 129 return 0;
128 } 130 }
129 131
130 inline bool sanitize (hb_sanitize_context_t *c) { 132 inline bool sanitize (hb_sanitize_context_t *c) const
133 {
131 TRACE_SANITIZE (this); 134 TRACE_SANITIZE (this);
132 return TRACE_RETURN (c->check_struct (this)); 135 return TRACE_RETURN (c->check_struct (this));
133 } 136 }
134 137
135 protected: 138 protected:
136 USHORT caretValueFormat; /* Format identifier--format = 2 */ 139 USHORT caretValueFormat; /* Format identifier--format = 2 */
137 USHORT caretValuePoint; /* Contour point index on glyph */ 140 USHORT caretValuePoint; /* Contour point index on glyph */
138 public: 141 public:
139 DEFINE_SIZE_STATIC (4); 142 DEFINE_SIZE_STATIC (4);
140 }; 143 };
141 144
142 struct CaretValueFormat3 145 struct CaretValueFormat3
143 { 146 {
144 friend struct CaretValue; 147 friend struct CaretValue;
145 148
146 inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t directio n, hb_codepoint_t glyph_id HB_UNUSED) const 149 inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t directio n, hb_codepoint_t glyph_id HB_UNUSED) const
147 { 150 {
148 return HB_DIRECTION_IS_HORIZONTAL (direction) ? 151 return HB_DIRECTION_IS_HORIZONTAL (direction) ?
149 font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font) : 152 font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font) :
150 font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font) ; 153 font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font) ;
151 } 154 }
152 155
153 inline bool sanitize (hb_sanitize_context_t *c) { 156 inline bool sanitize (hb_sanitize_context_t *c) const
157 {
154 TRACE_SANITIZE (this); 158 TRACE_SANITIZE (this);
155 return TRACE_RETURN (c->check_struct (this) && deviceTable.sanitize (c, this )); 159 return TRACE_RETURN (c->check_struct (this) && deviceTable.sanitize (c, this ));
156 } 160 }
157 161
158 protected: 162 protected:
159 USHORT caretValueFormat; /* Format identifier--format = 3 */ 163 USHORT caretValueFormat; /* Format identifier--format = 3 */
160 SHORT coordinate; /* X or Y value, in design units */ 164 SHORT coordinate; /* X or Y value, in design units */
161 OffsetTo<Device> 165 OffsetTo<Device>
162 deviceTable; /* Offset to Device table for X or Y 166 deviceTable; /* Offset to Device table for X or Y
163 * value--from beginning of CaretValue 167 * value--from beginning of CaretValue
164 * table */ 168 * table */
165 public: 169 public:
166 DEFINE_SIZE_STATIC (6); 170 DEFINE_SIZE_STATIC (6);
167 }; 171 };
168 172
169 struct CaretValue 173 struct CaretValue
170 { 174 {
171 inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t directio n, hb_codepoint_t glyph_id) const 175 inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t directio n, hb_codepoint_t glyph_id) const
172 { 176 {
173 switch (u.format) { 177 switch (u.format) {
174 case 1: return u.format1.get_caret_value (font, direction, glyph_id); 178 case 1: return u.format1.get_caret_value (font, direction, glyph_id);
175 case 2: return u.format2.get_caret_value (font, direction, glyph_id); 179 case 2: return u.format2.get_caret_value (font, direction, glyph_id);
176 case 3: return u.format3.get_caret_value (font, direction, glyph_id); 180 case 3: return u.format3.get_caret_value (font, direction, glyph_id);
177 default:return 0; 181 default:return 0;
178 } 182 }
179 } 183 }
180 184
181 inline bool sanitize (hb_sanitize_context_t *c) { 185 inline bool sanitize (hb_sanitize_context_t *c) const
186 {
182 TRACE_SANITIZE (this); 187 TRACE_SANITIZE (this);
183 if (!u.format.sanitize (c)) return TRACE_RETURN (false); 188 if (!u.format.sanitize (c)) return TRACE_RETURN (false);
184 switch (u.format) { 189 switch (u.format) {
185 case 1: return TRACE_RETURN (u.format1.sanitize (c)); 190 case 1: return TRACE_RETURN (u.format1.sanitize (c));
186 case 2: return TRACE_RETURN (u.format2.sanitize (c)); 191 case 2: return TRACE_RETURN (u.format2.sanitize (c));
187 case 3: return TRACE_RETURN (u.format3.sanitize (c)); 192 case 3: return TRACE_RETURN (u.format3.sanitize (c));
188 default:return TRACE_RETURN (true); 193 default:return TRACE_RETURN (true);
189 } 194 }
190 } 195 }
191 196
(...skipping 20 matching lines...) Expand all
212 if (caret_count) { 217 if (caret_count) {
213 const OffsetTo<CaretValue> *array = carets.sub_array (start_offset, caret_ count); 218 const OffsetTo<CaretValue> *array = carets.sub_array (start_offset, caret_ count);
214 unsigned int count = *caret_count; 219 unsigned int count = *caret_count;
215 for (unsigned int i = 0; i < count; i++) 220 for (unsigned int i = 0; i < count; i++)
216 caret_array[i] = (this+array[i]).get_caret_value (font, direction, glyph _id); 221 caret_array[i] = (this+array[i]).get_caret_value (font, direction, glyph _id);
217 } 222 }
218 223
219 return carets.len; 224 return carets.len;
220 } 225 }
221 226
222 inline bool sanitize (hb_sanitize_context_t *c) { 227 inline bool sanitize (hb_sanitize_context_t *c) const
228 {
223 TRACE_SANITIZE (this); 229 TRACE_SANITIZE (this);
224 return TRACE_RETURN (carets.sanitize (c, this)); 230 return TRACE_RETURN (carets.sanitize (c, this));
225 } 231 }
226 232
227 protected: 233 protected:
228 OffsetArrayOf<CaretValue> 234 OffsetArrayOf<CaretValue>
229 carets; /* Offset array of CaretValue tables 235 carets; /* Offset array of CaretValue tables
230 * --from beginning of LigGlyph table 236 * --from beginning of LigGlyph table
231 * --in increasing coordinate order */ 237 * --in increasing coordinate order */
232 public: 238 public:
(...skipping 13 matching lines...) Expand all
246 if (index == NOT_COVERED) 252 if (index == NOT_COVERED)
247 { 253 {
248 if (caret_count) 254 if (caret_count)
249 *caret_count = 0; 255 *caret_count = 0;
250 return 0; 256 return 0;
251 } 257 }
252 const LigGlyph &lig_glyph = this+ligGlyph[index]; 258 const LigGlyph &lig_glyph = this+ligGlyph[index];
253 return lig_glyph.get_lig_carets (font, direction, glyph_id, start_offset, ca ret_count, caret_array); 259 return lig_glyph.get_lig_carets (font, direction, glyph_id, start_offset, ca ret_count, caret_array);
254 } 260 }
255 261
256 inline bool sanitize (hb_sanitize_context_t *c) { 262 inline bool sanitize (hb_sanitize_context_t *c) const
263 {
257 TRACE_SANITIZE (this); 264 TRACE_SANITIZE (this);
258 return TRACE_RETURN (coverage.sanitize (c, this) && ligGlyph.sanitize (c, th is)); 265 return TRACE_RETURN (coverage.sanitize (c, this) && ligGlyph.sanitize (c, th is));
259 } 266 }
260 267
261 protected: 268 protected:
262 OffsetTo<Coverage> 269 OffsetTo<Coverage>
263 coverage; /* Offset to Coverage table--from 270 coverage; /* Offset to Coverage table--from
264 * beginning of LigCaretList table */ 271 * beginning of LigCaretList table */
265 OffsetArrayOf<LigGlyph> 272 OffsetArrayOf<LigGlyph>
266 ligGlyph; /* Array of LigGlyph tables 273 ligGlyph; /* Array of LigGlyph tables
267 * in Coverage Index order */ 274 * in Coverage Index order */
268 public: 275 public:
269 DEFINE_SIZE_ARRAY (4, ligGlyph); 276 DEFINE_SIZE_ARRAY (4, ligGlyph);
270 }; 277 };
271 278
272 279
273 struct MarkGlyphSetsFormat1 280 struct MarkGlyphSetsFormat1
274 { 281 {
275 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const 282 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
276 { return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; } 283 { return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
277 284
278 inline bool sanitize (hb_sanitize_context_t *c) { 285 inline bool sanitize (hb_sanitize_context_t *c) const
286 {
279 TRACE_SANITIZE (this); 287 TRACE_SANITIZE (this);
280 return TRACE_RETURN (coverage.sanitize (c, this)); 288 return TRACE_RETURN (coverage.sanitize (c, this));
281 } 289 }
282 290
283 protected: 291 protected:
284 USHORT format; /* Format identifier--format = 1 */ 292 USHORT format; /* Format identifier--format = 1 */
285 ArrayOf<OffsetTo<Coverage, ULONG> > 293 ArrayOf<OffsetTo<Coverage, ULONG> >
286 coverage; /* Array of long offsets to mark set 294 coverage; /* Array of long offsets to mark set
287 * coverage tables */ 295 * coverage tables */
288 public: 296 public:
289 DEFINE_SIZE_ARRAY (4, coverage); 297 DEFINE_SIZE_ARRAY (4, coverage);
290 }; 298 };
291 299
292 struct MarkGlyphSets 300 struct MarkGlyphSets
293 { 301 {
294 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const 302 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
295 { 303 {
296 switch (u.format) { 304 switch (u.format) {
297 case 1: return u.format1.covers (set_index, glyph_id); 305 case 1: return u.format1.covers (set_index, glyph_id);
298 default:return false; 306 default:return false;
299 } 307 }
300 } 308 }
301 309
302 inline bool sanitize (hb_sanitize_context_t *c) { 310 inline bool sanitize (hb_sanitize_context_t *c) const
311 {
303 TRACE_SANITIZE (this); 312 TRACE_SANITIZE (this);
304 if (!u.format.sanitize (c)) return TRACE_RETURN (false); 313 if (!u.format.sanitize (c)) return TRACE_RETURN (false);
305 switch (u.format) { 314 switch (u.format) {
306 case 1: return TRACE_RETURN (u.format1.sanitize (c)); 315 case 1: return TRACE_RETURN (u.format1.sanitize (c));
307 default:return TRACE_RETURN (true); 316 default:return TRACE_RETURN (true);
308 } 317 }
309 } 318 }
310 319
311 protected: 320 protected:
312 union { 321 union {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 hb_codepoint_t glyph_id, 366 hb_codepoint_t glyph_id,
358 unsigned int start_offset, 367 unsigned int start_offset,
359 unsigned int *caret_count /* IN/OUT */, 368 unsigned int *caret_count /* IN/OUT */,
360 hb_position_t *caret_array /* OUT */) cons t 369 hb_position_t *caret_array /* OUT */) cons t
361 { return (this+ligCaretList).get_lig_carets (font, direction, glyph_id, start_ offset, caret_count, caret_array); } 370 { return (this+ligCaretList).get_lig_carets (font, direction, glyph_id, start_ offset, caret_count, caret_array); }
362 371
363 inline bool has_mark_sets (void) const { return version.to_int () >= 0x0001000 2u && markGlyphSetsDef[0] != 0; } 372 inline bool has_mark_sets (void) const { return version.to_int () >= 0x0001000 2u && markGlyphSetsDef[0] != 0; }
364 inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const 373 inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const
365 { return version.to_int () >= 0x00010002u && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); } 374 { return version.to_int () >= 0x00010002u && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); }
366 375
367 inline bool sanitize (hb_sanitize_context_t *c) { 376 inline bool sanitize (hb_sanitize_context_t *c) const
377 {
368 TRACE_SANITIZE (this); 378 TRACE_SANITIZE (this);
369 return TRACE_RETURN (version.sanitize (c) && 379 return TRACE_RETURN (version.sanitize (c) &&
370 likely (version.major == 1) && 380 likely (version.major == 1) &&
371 glyphClassDef.sanitize (c, this) && 381 glyphClassDef.sanitize (c, this) &&
372 attachList.sanitize (c, this) && 382 attachList.sanitize (c, this) &&
373 ligCaretList.sanitize (c, this) && 383 ligCaretList.sanitize (c, this) &&
374 markAttachClassDef.sanitize (c, this) && 384 markAttachClassDef.sanitize (c, this) &&
375 (version.to_int () < 0x00010002u || markGlyphSetsDef[0] .sanitize (c, this))); 385 (version.to_int () < 0x00010002u || markGlyphSetsDef[0] .sanitize (c, this)));
376 } 386 }
377 387
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 * in version 00010002. */ 434 * in version 00010002. */
425 public: 435 public:
426 DEFINE_SIZE_ARRAY (12, markGlyphSetsDef); 436 DEFINE_SIZE_ARRAY (12, markGlyphSetsDef);
427 }; 437 };
428 438
429 439
430 } /* namespace OT */ 440 } /* namespace OT */
431 441
432 442
433 #endif /* HB_OT_LAYOUT_GDEF_TABLE_HH */ 443 #endif /* HB_OT_LAYOUT_GDEF_TABLE_HH */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ot-layout-common-private.hh ('k') | third_party/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698