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

Side by Side Diff: third_party/harfbuzz-ng/src/hb-ot-layout-gdef-table.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 © 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 16 matching lines...) Expand all
27 */ 27 */
28 28
29 #ifndef HB_OT_LAYOUT_GDEF_TABLE_HH 29 #ifndef HB_OT_LAYOUT_GDEF_TABLE_HH
30 #define HB_OT_LAYOUT_GDEF_TABLE_HH 30 #define HB_OT_LAYOUT_GDEF_TABLE_HH
31 31
32 #include "hb-ot-layout-common-private.hh" 32 #include "hb-ot-layout-common-private.hh"
33 33
34 #include "hb-font-private.hh" 34 #include "hb-font-private.hh"
35 35
36 36
37 namespace OT {
38
37 39
38 /* 40 /*
39 * Attachment List Table 41 * Attachment List Table
40 */ 42 */
41 43
42 typedef ArrayOf<USHORT> AttachPoint; /* Array of contour point indices--in 44 typedef ArrayOf<USHORT> AttachPoint; /* Array of contour point indices--in
43 * increasing numerical order */ 45 * increasing numerical order */
44 46
45 struct AttachList 47 struct AttachList
46 { 48 {
(...skipping 20 matching lines...) Expand all
67 } 69 }
68 70
69 return points.len; 71 return points.len;
70 } 72 }
71 73
72 inline bool sanitize (hb_sanitize_context_t *c) { 74 inline bool sanitize (hb_sanitize_context_t *c) {
73 TRACE_SANITIZE (); 75 TRACE_SANITIZE ();
74 return TRACE_RETURN (coverage.sanitize (c, this) && attachPoint.sanitize (c, this)); 76 return TRACE_RETURN (coverage.sanitize (c, this) && attachPoint.sanitize (c, this));
75 } 77 }
76 78
77 private: 79 protected:
78 OffsetTo<Coverage> 80 OffsetTo<Coverage>
79 coverage; /* Offset to Coverage table -- from 81 coverage; /* Offset to Coverage table -- from
80 * beginning of AttachList table */ 82 * beginning of AttachList table */
81 OffsetArrayOf<AttachPoint> 83 OffsetArrayOf<AttachPoint>
82 attachPoint; /* Array of AttachPoint tables 84 attachPoint; /* Array of AttachPoint tables
83 * in Coverage Index order */ 85 * in Coverage Index order */
84 public: 86 public:
85 DEFINE_SIZE_ARRAY (4, attachPoint); 87 DEFINE_SIZE_ARRAY (4, attachPoint);
86 }; 88 };
87 89
88 /* 90 /*
89 * Ligature Caret Table 91 * Ligature Caret Table
90 */ 92 */
91 93
92 struct CaretValueFormat1 94 struct CaretValueFormat1
93 { 95 {
94 friend struct CaretValue; 96 friend struct CaretValue;
95 97
96 private: 98 private:
97 inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t directio n, hb_codepoint_t glyph_id HB_UNUSED) const 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
98 { 100 {
99 return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_x (coordinate ) : font->em_scale_y (coordinate); 101 return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_x (coordinate ) : font->em_scale_y (coordinate);
100 } 102 }
101 103
102 inline bool sanitize (hb_sanitize_context_t *c) { 104 inline bool sanitize (hb_sanitize_context_t *c) {
103 TRACE_SANITIZE (); 105 TRACE_SANITIZE ();
104 return TRACE_RETURN (c->check_struct (this)); 106 return TRACE_RETURN (c->check_struct (this));
105 } 107 }
106 108
107 private: 109 protected:
108 USHORT caretValueFormat; /* Format identifier--format = 1 */ 110 USHORT caretValueFormat; /* Format identifier--format = 1 */
109 SHORT coordinate; /* X or Y value, in design units */ 111 SHORT coordinate; /* X or Y value, in design units */
110 public: 112 public:
111 DEFINE_SIZE_STATIC (4); 113 DEFINE_SIZE_STATIC (4);
112 }; 114 };
113 115
114 struct CaretValueFormat2 116 struct CaretValueFormat2
115 { 117 {
116 friend struct CaretValue; 118 friend struct CaretValue;
117 119
118 private: 120 private:
119 inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t directio n, hb_codepoint_t glyph_id) const 121 inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t directio n, hb_codepoint_t glyph_id) const
120 { 122 {
121 hb_position_t x, y; 123 hb_position_t x, y;
122 if (hb_font_get_glyph_contour_point_for_origin (font, glyph_id, caretValuePo int, direction, &x, &y)) 124 if (font->get_glyph_contour_point_for_origin (glyph_id, caretValuePoint, dir ection, &x, &y))
123 return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y; 125 return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y;
124 else 126 else
125 return 0; 127 return 0;
126 } 128 }
127 129
128 inline bool sanitize (hb_sanitize_context_t *c) { 130 inline bool sanitize (hb_sanitize_context_t *c) {
129 TRACE_SANITIZE (); 131 TRACE_SANITIZE ();
130 return TRACE_RETURN (c->check_struct (this)); 132 return TRACE_RETURN (c->check_struct (this));
131 } 133 }
132 134
133 private: 135 protected:
134 USHORT caretValueFormat; /* Format identifier--format = 2 */ 136 USHORT caretValueFormat; /* Format identifier--format = 2 */
135 USHORT caretValuePoint; /* Contour point index on glyph */ 137 USHORT caretValuePoint; /* Contour point index on glyph */
136 public: 138 public:
137 DEFINE_SIZE_STATIC (4); 139 DEFINE_SIZE_STATIC (4);
138 }; 140 };
139 141
140 struct CaretValueFormat3 142 struct CaretValueFormat3
141 { 143 {
142 friend struct CaretValue; 144 friend struct CaretValue;
143 145
144 inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t directio n, hb_codepoint_t glyph_id HB_UNUSED) const 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
145 { 147 {
146 return HB_DIRECTION_IS_HORIZONTAL (direction) ? 148 return HB_DIRECTION_IS_HORIZONTAL (direction) ?
147 font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font) : 149 font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font) :
148 font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font) ; 150 font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font) ;
149 } 151 }
150 152
151 inline bool sanitize (hb_sanitize_context_t *c) { 153 inline bool sanitize (hb_sanitize_context_t *c) {
152 TRACE_SANITIZE (); 154 TRACE_SANITIZE ();
153 return TRACE_RETURN (c->check_struct (this) && deviceTable.sanitize (c, this )); 155 return TRACE_RETURN (c->check_struct (this) && deviceTable.sanitize (c, this ));
154 } 156 }
155 157
156 private: 158 protected:
157 USHORT caretValueFormat; /* Format identifier--format = 3 */ 159 USHORT caretValueFormat; /* Format identifier--format = 3 */
158 SHORT coordinate; /* X or Y value, in design units */ 160 SHORT coordinate; /* X or Y value, in design units */
159 OffsetTo<Device> 161 OffsetTo<Device>
160 deviceTable; /* Offset to Device table for X or Y 162 deviceTable; /* Offset to Device table for X or Y
161 * value--from beginning of CaretValue 163 * value--from beginning of CaretValue
162 * table */ 164 * table */
163 public: 165 public:
164 DEFINE_SIZE_STATIC (6); 166 DEFINE_SIZE_STATIC (6);
165 }; 167 };
166 168
(...skipping 13 matching lines...) Expand all
180 TRACE_SANITIZE (); 182 TRACE_SANITIZE ();
181 if (!u.format.sanitize (c)) return TRACE_RETURN (false); 183 if (!u.format.sanitize (c)) return TRACE_RETURN (false);
182 switch (u.format) { 184 switch (u.format) {
183 case 1: return TRACE_RETURN (u.format1.sanitize (c)); 185 case 1: return TRACE_RETURN (u.format1.sanitize (c));
184 case 2: return TRACE_RETURN (u.format2.sanitize (c)); 186 case 2: return TRACE_RETURN (u.format2.sanitize (c));
185 case 3: return TRACE_RETURN (u.format3.sanitize (c)); 187 case 3: return TRACE_RETURN (u.format3.sanitize (c));
186 default:return TRACE_RETURN (true); 188 default:return TRACE_RETURN (true);
187 } 189 }
188 } 190 }
189 191
190 private: 192 protected:
191 union { 193 union {
192 USHORT format; /* Format identifier */ 194 USHORT format; /* Format identifier */
193 CaretValueFormat1 format1; 195 CaretValueFormat1 format1;
194 CaretValueFormat2 format2; 196 CaretValueFormat2 format2;
195 CaretValueFormat3 format3; 197 CaretValueFormat3 format3;
196 } u; 198 } u;
197 public: 199 public:
198 DEFINE_SIZE_UNION (2, format); 200 DEFINE_SIZE_UNION (2, format);
199 }; 201 };
200 202
(...skipping 14 matching lines...) Expand all
215 } 217 }
216 218
217 return carets.len; 219 return carets.len;
218 } 220 }
219 221
220 inline bool sanitize (hb_sanitize_context_t *c) { 222 inline bool sanitize (hb_sanitize_context_t *c) {
221 TRACE_SANITIZE (); 223 TRACE_SANITIZE ();
222 return TRACE_RETURN (carets.sanitize (c, this)); 224 return TRACE_RETURN (carets.sanitize (c, this));
223 } 225 }
224 226
225 private: 227 protected:
226 OffsetArrayOf<CaretValue> 228 OffsetArrayOf<CaretValue>
227 carets; /* Offset array of CaretValue tables 229 carets; /* Offset array of CaretValue tables
228 * --from beginning of LigGlyph table 230 * --from beginning of LigGlyph table
229 * --in increasing coordinate order */ 231 * --in increasing coordinate order */
230 public: 232 public:
231 DEFINE_SIZE_ARRAY (2, carets); 233 DEFINE_SIZE_ARRAY (2, carets);
232 }; 234 };
233 235
234 struct LigCaretList 236 struct LigCaretList
235 { 237 {
(...skipping 13 matching lines...) Expand all
249 } 251 }
250 const LigGlyph &lig_glyph = this+ligGlyph[index]; 252 const LigGlyph &lig_glyph = this+ligGlyph[index];
251 return lig_glyph.get_lig_carets (font, direction, glyph_id, start_offset, ca ret_count, caret_array); 253 return lig_glyph.get_lig_carets (font, direction, glyph_id, start_offset, ca ret_count, caret_array);
252 } 254 }
253 255
254 inline bool sanitize (hb_sanitize_context_t *c) { 256 inline bool sanitize (hb_sanitize_context_t *c) {
255 TRACE_SANITIZE (); 257 TRACE_SANITIZE ();
256 return TRACE_RETURN (coverage.sanitize (c, this) && ligGlyph.sanitize (c, th is)); 258 return TRACE_RETURN (coverage.sanitize (c, this) && ligGlyph.sanitize (c, th is));
257 } 259 }
258 260
259 private: 261 protected:
260 OffsetTo<Coverage> 262 OffsetTo<Coverage>
261 coverage; /* Offset to Coverage table--from 263 coverage; /* Offset to Coverage table--from
262 * beginning of LigCaretList table */ 264 * beginning of LigCaretList table */
263 OffsetArrayOf<LigGlyph> 265 OffsetArrayOf<LigGlyph>
264 ligGlyph; /* Array of LigGlyph tables 266 ligGlyph; /* Array of LigGlyph tables
265 * in Coverage Index order */ 267 * in Coverage Index order */
266 public: 268 public:
267 DEFINE_SIZE_ARRAY (4, ligGlyph); 269 DEFINE_SIZE_ARRAY (4, ligGlyph);
268 }; 270 };
269 271
270 272
271 struct MarkGlyphSetsFormat1 273 struct MarkGlyphSetsFormat1
272 { 274 {
273 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const 275 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
274 { return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; } 276 { return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
275 277
276 inline bool sanitize (hb_sanitize_context_t *c) { 278 inline bool sanitize (hb_sanitize_context_t *c) {
277 TRACE_SANITIZE (); 279 TRACE_SANITIZE ();
278 return TRACE_RETURN (coverage.sanitize (c, this)); 280 return TRACE_RETURN (coverage.sanitize (c, this));
279 } 281 }
280 282
281 private: 283 protected:
282 USHORT format; /* Format identifier--format = 1 */ 284 USHORT format; /* Format identifier--format = 1 */
283 LongOffsetArrayOf<Coverage> 285 LongOffsetArrayOf<Coverage>
284 coverage; /* Array of long offsets to mark set 286 coverage; /* Array of long offsets to mark set
285 * coverage tables */ 287 * coverage tables */
286 public: 288 public:
287 DEFINE_SIZE_ARRAY (4, coverage); 289 DEFINE_SIZE_ARRAY (4, coverage);
288 }; 290 };
289 291
290 struct MarkGlyphSets 292 struct MarkGlyphSets
291 { 293 {
292 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const 294 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
293 { 295 {
294 switch (u.format) { 296 switch (u.format) {
295 case 1: return u.format1.covers (set_index, glyph_id); 297 case 1: return u.format1.covers (set_index, glyph_id);
296 default:return false; 298 default:return false;
297 } 299 }
298 } 300 }
299 301
300 inline bool sanitize (hb_sanitize_context_t *c) { 302 inline bool sanitize (hb_sanitize_context_t *c) {
301 TRACE_SANITIZE (); 303 TRACE_SANITIZE ();
302 if (!u.format.sanitize (c)) return TRACE_RETURN (false); 304 if (!u.format.sanitize (c)) return TRACE_RETURN (false);
303 switch (u.format) { 305 switch (u.format) {
304 case 1: return TRACE_RETURN (u.format1.sanitize (c)); 306 case 1: return TRACE_RETURN (u.format1.sanitize (c));
305 default:return TRACE_RETURN (true); 307 default:return TRACE_RETURN (true);
306 } 308 }
307 } 309 }
308 310
309 private: 311 protected:
310 union { 312 union {
311 USHORT format; /* Format identifier */ 313 USHORT format; /* Format identifier */
312 MarkGlyphSetsFormat1 format1; 314 MarkGlyphSetsFormat1 format1;
313 } u; 315 } u;
314 public: 316 public:
315 DEFINE_SIZE_UNION (2, format); 317 DEFINE_SIZE_UNION (2, format);
316 }; 318 };
317 319
318 320
319 /* 321 /*
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 case BaseGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH; 387 case BaseGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
386 case LigatureGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE; 388 case LigatureGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE;
387 case ComponentGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT; 389 case ComponentGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT;
388 case MarkGlyph: 390 case MarkGlyph:
389 klass = get_mark_attachment_type (glyph); 391 klass = get_mark_attachment_type (glyph);
390 return HB_OT_LAYOUT_GLYPH_CLASS_MARK | (klass << 8); 392 return HB_OT_LAYOUT_GLYPH_CLASS_MARK | (klass << 8);
391 } 393 }
392 } 394 }
393 395
394 396
395 private: 397 protected:
396 FixedVersion version; /* Version of the GDEF table--currently 398 FixedVersion version; /* Version of the GDEF table--currently
397 * 0x00010002 */ 399 * 0x00010002 */
398 OffsetTo<ClassDef> 400 OffsetTo<ClassDef>
399 glyphClassDef; /* Offset to class definition table 401 glyphClassDef; /* Offset to class definition table
400 * for glyph type--from beginning of 402 * for glyph type--from beginning of
401 * GDEF header (may be Null) */ 403 * GDEF header (may be Null) */
402 OffsetTo<AttachList> 404 OffsetTo<AttachList>
403 attachList; /* Offset to list of glyphs with 405 attachList; /* Offset to list of glyphs with
404 * attachment points--from beginning 406 * attachment points--from beginning
405 * of GDEF header (may be Null) */ 407 * of GDEF header (may be Null) */
406 OffsetTo<LigCaretList> 408 OffsetTo<LigCaretList>
407 ligCaretList; /* Offset to list of positioning points 409 ligCaretList; /* Offset to list of positioning points
408 * for ligature carets--from beginning 410 * for ligature carets--from beginning
409 * of GDEF header (may be Null) */ 411 * of GDEF header (may be Null) */
410 OffsetTo<ClassDef> 412 OffsetTo<ClassDef>
411 markAttachClassDef; /* Offset to class definition table for 413 markAttachClassDef; /* Offset to class definition table for
412 * mark attachment type--from beginning 414 * mark attachment type--from beginning
413 * of GDEF header (may be Null) */ 415 * of GDEF header (may be Null) */
414 OffsetTo<MarkGlyphSets> 416 OffsetTo<MarkGlyphSets>
415 markGlyphSetsDef[VAR]; /* Offset to the table of mark set 417 markGlyphSetsDef[VAR]; /* Offset to the table of mark set
416 * definitions--from beginning of GDEF 418 * definitions--from beginning of GDEF
417 * header (may be NULL). Introduced 419 * header (may be NULL). Introduced
418 * in version 00010002. */ 420 * in version 00010002. */
419 public: 421 public:
420 DEFINE_SIZE_ARRAY (12, markGlyphSetsDef); 422 DEFINE_SIZE_ARRAY (12, markGlyphSetsDef);
421 }; 423 };
422 424
423 425
426 } // namespace OT
427
424 428
425 #endif /* HB_OT_LAYOUT_GDEF_TABLE_HH */ 429 #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