Index: third_party/harfbuzz-ng/src/hb-ot-layout-common-private.hh |
diff --git a/third_party/harfbuzz-ng/src/hb-ot-layout-common-private.hh b/third_party/harfbuzz-ng/src/hb-ot-layout-common-private.hh |
index d139b56ab8632960c49b8601f7fe973f4278e006..367db95574cf342d790b91b819e84526f7d86808 100644 |
--- a/third_party/harfbuzz-ng/src/hb-ot-layout-common-private.hh |
+++ b/third_party/harfbuzz-ng/src/hb-ot-layout-common-private.hh |
@@ -39,6 +39,7 @@ namespace OT { |
#define NOT_COVERED ((unsigned int) -1) |
#define MAX_NESTING_LEVEL 8 |
+#define MAX_CONTEXT_LENGTH 64 |
@@ -871,16 +872,16 @@ struct Coverage |
inline void init (const Coverage &c_) { |
format = c_.u.format; |
switch (format) { |
- case 1: return u.format1.init (c_.u.format1); |
- case 2: return u.format2.init (c_.u.format2); |
- default:return; |
+ case 1: u.format1.init (c_.u.format1); return; |
+ case 2: u.format2.init (c_.u.format2); return; |
+ default: return; |
} |
} |
inline bool more (void) { |
switch (format) { |
case 1: return u.format1.more (); |
case 2: return u.format2.more (); |
- default:return true; |
+ default:return false; |
} |
} |
inline void next (void) { |
@@ -894,14 +895,14 @@ struct Coverage |
switch (format) { |
case 1: return u.format1.get_glyph (); |
case 2: return u.format2.get_glyph (); |
- default:return true; |
+ default:return 0; |
} |
} |
inline uint16_t get_coverage (void) { |
switch (format) { |
case 1: return u.format1.get_coverage (); |
case 2: return u.format2.get_coverage (); |
- default:return true; |
+ default:return -1; |
} |
} |
@@ -955,6 +956,19 @@ struct ClassDefFormat1 |
inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const { |
unsigned int count = classValue.len; |
+ if (klass == 0) |
+ { |
+ /* Match if there's any glyph that is not listed! */ |
+ hb_codepoint_t g = -1; |
+ if (!hb_set_next (glyphs, &g)) |
+ return false; |
+ if (g < startGlyph) |
+ return true; |
+ g = startGlyph + count - 1; |
+ if (hb_set_next (glyphs, &g)) |
+ return true; |
+ /* Fall through. */ |
+ } |
for (unsigned int i = 0; i < count; i++) |
if (classValue[i] == klass && glyphs->has (startGlyph + i)) |
return true; |
@@ -998,6 +1012,22 @@ struct ClassDefFormat2 |
inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const { |
unsigned int count = rangeRecord.len; |
+ if (klass == 0) |
+ { |
+ /* Match if there's any glyph that is not listed! */ |
+ hb_codepoint_t g = (hb_codepoint_t) -1; |
+ for (unsigned int i = 0; i < count; i++) |
+ { |
+ if (!hb_set_next (glyphs, &g)) |
+ break; |
+ if (g < rangeRecord[i].start) |
+ return true; |
+ g = rangeRecord[i].end; |
+ } |
+ if (g != (hb_codepoint_t) -1 && hb_set_next (glyphs, &g)) |
+ return true; |
+ /* Fall through. */ |
+ } |
for (unsigned int i = 0; i < count; i++) |
if (rangeRecord[i].value == klass && rangeRecord[i].intersects (glyphs)) |
return true; |
@@ -1082,7 +1112,7 @@ struct Device |
if (!pixels) return 0; |
- return pixels * (int64_t) scale / ppem; |
+ return (int) (pixels * (int64_t) scale / ppem); |
} |