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

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

Issue 2622553002: Roll HarfBuzz to 1.4.1 (Closed)
Patch Set: Linux rebaselines Created 3 years, 11 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,2010 Red Hat, Inc. 2 * Copyright © 2007,2008,2009,2010 Red Hat, Inc.
3 * Copyright © 2010,2012 Google, Inc. 3 * Copyright © 2010,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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 hb_face_t *face; 462 hb_face_t *face;
463 hb_buffer_t *buffer; 463 hb_buffer_t *buffer;
464 hb_direction_t direction; 464 hb_direction_t direction;
465 hb_mask_t lookup_mask; 465 hb_mask_t lookup_mask;
466 bool auto_zwj; 466 bool auto_zwj;
467 recurse_func_t recurse_func; 467 recurse_func_t recurse_func;
468 unsigned int nesting_level_left; 468 unsigned int nesting_level_left;
469 unsigned int lookup_props; 469 unsigned int lookup_props;
470 const GDEF &gdef; 470 const GDEF &gdef;
471 bool has_glyph_classes; 471 bool has_glyph_classes;
472 const VariationStore &var_store;
472 skipping_iterator_t iter_input, iter_context; 473 skipping_iterator_t iter_input, iter_context;
473 unsigned int lookup_index; 474 unsigned int lookup_index;
474 unsigned int debug_depth; 475 unsigned int debug_depth;
475 476
476 477
477 hb_apply_context_t (unsigned int table_index_, 478 hb_apply_context_t (unsigned int table_index_,
478 hb_font_t *font_, 479 hb_font_t *font_,
479 hb_buffer_t *buffer_) : 480 hb_buffer_t *buffer_) :
480 table_index (table_index_), 481 table_index (table_index_),
481 font (font_), face (font->face), buffer (buffer_), 482 font (font_), face (font->face), buffer (buffer_),
482 direction (buffer_->props.direction), 483 direction (buffer_->props.direction),
483 lookup_mask (1), 484 lookup_mask (1),
484 auto_zwj (true), 485 auto_zwj (true),
485 recurse_func (NULL), 486 recurse_func (NULL),
486 nesting_level_left (HB_MAX_NESTING_LEVEL), 487 nesting_level_left (HB_MAX_NESTING_LEVEL),
487 lookup_props (0), 488 lookup_props (0),
488 gdef (*hb_ot_layout_from_face (face)->gdef), 489 gdef (*hb_ot_layout_from_face (face)->gdef),
489 has_glyph_classes (gdef.has_glyph_classes ()), 490 has_glyph_classes (gdef.has_glyph_classes ()),
491 var_store (gdef.get_var_store ()),
490 iter_input (), 492 iter_input (),
491 iter_context (), 493 iter_context (),
492 lookup_index ((unsigned int) -1), 494 lookup_index ((unsigned int) -1),
493 debug_depth (0) {} 495 debug_depth (0) {}
494 496
495 inline void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; } 497 inline void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; }
496 inline void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; } 498 inline void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; }
497 inline void set_recurse_func (recurse_func_t func) { recurse_func = func; } 499 inline void set_recurse_func (recurse_func_t func) { recurse_func = func; }
498 inline void set_lookup_index (unsigned int lookup_index_) { lookup_index = loo kup_index_; } 500 inline void set_lookup_index (unsigned int lookup_index_) { lookup_index = loo kup_index_; }
499 inline void set_lookup_props (unsigned int lookup_props_) 501 inline void set_lookup_props (unsigned int lookup_props_)
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 int delta = new_len - orig_len; 994 int delta = new_len - orig_len;
993 995
994 if (!delta) 996 if (!delta)
995 continue; 997 continue;
996 998
997 /* Recursed lookup changed buffer len. Adjust. */ 999 /* Recursed lookup changed buffer len. Adjust. */
998 1000
999 end = int (end) + delta; 1001 end = int (end) + delta;
1000 if (end <= match_positions[idx]) 1002 if (end <= match_positions[idx])
1001 { 1003 {
1004 /* End might end up being smaller than match_positions[idx] if the recurse d
1005 * lookup ended up removing many items, more than we have had matched.
1006 * Just never rewind end back and get out of here.
1007 * https://bugs.chromium.org/p/chromium/issues/detail?id=659496 */
1008 end = match_positions[idx];
1002 /* There can't be any further changes. */ 1009 /* There can't be any further changes. */
1003 assert (end == match_positions[idx]);
1004 break; 1010 break;
1005 } 1011 }
1006 1012
1007 unsigned int next = idx + 1; /* next now is the position after the recursed lookup. */ 1013 unsigned int next = idx + 1; /* next now is the position after the recursed lookup. */
1008 1014
1009 if (delta > 0) 1015 if (delta > 0)
1010 { 1016 {
1011 if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH)) 1017 if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH))
1012 break; 1018 break;
1013 } 1019 }
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 inline const Feature& get_feature (unsigned int i) const 2268 inline const Feature& get_feature (unsigned int i) const
2263 { return (this+featureList)[i]; } 2269 { return (this+featureList)[i]; }
2264 inline bool find_feature_index (hb_tag_t tag, unsigned int *index) const 2270 inline bool find_feature_index (hb_tag_t tag, unsigned int *index) const
2265 { return (this+featureList).find_index (tag, index); } 2271 { return (this+featureList).find_index (tag, index); }
2266 2272
2267 inline unsigned int get_lookup_count (void) const 2273 inline unsigned int get_lookup_count (void) const
2268 { return (this+lookupList).len; } 2274 { return (this+lookupList).len; }
2269 inline const Lookup& get_lookup (unsigned int i) const 2275 inline const Lookup& get_lookup (unsigned int i) const
2270 { return (this+lookupList)[i]; } 2276 { return (this+lookupList)[i]; }
2271 2277
2278 inline bool find_variations_index (const int *coords, unsigned int num_coords,
2279 unsigned int *index) const
2280 { return (version.to_int () >= 0x00010001u ? this+featureVars : Null(FeatureVa riations))
2281 .find_index (coords, num_coords, index); }
2282 inline const Feature& get_feature_variation (unsigned int feature_index,
2283 unsigned int variations_index) co nst
2284 {
2285 if (FeatureVariations::NOT_FOUND_INDEX != variations_index &&
2286 version.to_int () >= 0x00010001u)
2287 {
2288 const Feature *feature = (this+featureVars).find_substitute (variations_in dex,
2289 feature_index );
2290 if (feature)
2291 return *feature;
2292 }
2293 return get_feature (feature_index);
2294 }
2295
2272 inline bool sanitize (hb_sanitize_context_t *c) const 2296 inline bool sanitize (hb_sanitize_context_t *c) const
2273 { 2297 {
2274 TRACE_SANITIZE (this); 2298 TRACE_SANITIZE (this);
2275 return_trace (version.sanitize (c) && 2299 return_trace (version.sanitize (c) &&
2276 likely (version.major == 1) && 2300 likely (version.major == 1) &&
2277 scriptList.sanitize (c, this) && 2301 scriptList.sanitize (c, this) &&
2278 featureList.sanitize (c, this) && 2302 featureList.sanitize (c, this) &&
2279 » » lookupList.sanitize (c, this)); 2303 » » lookupList.sanitize (c, this) &&
2304 » » (version.to_int () < 0x00010001u || featureVars.sanitize (c, t his)));
2280 } 2305 }
2281 2306
2282 protected: 2307 protected:
2283 FixedVersion<>version; /* Version of the GSUB/GPOS table--initially set 2308 FixedVersion<>version; /* Version of the GSUB/GPOS table--initially set
2284 * to 0x00010000u */ 2309 * to 0x00010000u */
2285 OffsetTo<ScriptList> 2310 OffsetTo<ScriptList>
2286 scriptList; /* ScriptList table */ 2311 scriptList; /* ScriptList table */
2287 OffsetTo<FeatureList> 2312 OffsetTo<FeatureList>
2288 featureList; /* FeatureList table */ 2313 featureList; /* FeatureList table */
2289 OffsetTo<LookupList> 2314 OffsetTo<LookupList>
2290 lookupList; /* LookupList table */ 2315 lookupList; /* LookupList table */
2316 OffsetTo<FeatureVariations, ULONG>
2317 featureVars; /* Offset to Feature Variations
2318 table--from beginning of table
2319 * (may be NULL). Introduced
2320 * in version 0x00010001. */
2291 public: 2321 public:
2292 DEFINE_SIZE_STATIC (10); 2322 DEFINE_SIZE_MIN (10);
2293 }; 2323 };
2294 2324
2295 2325
2296 } /* namespace OT */ 2326 } /* namespace OT */
2297 2327
2298 2328
2299 #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */ 2329 #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh ('k') | third_party/harfbuzz-ng/src/hb-ot-map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698