[HarfBuzz] harfbuzz: Branch 'master' - 2 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Wed Aug 16 00:25:36 UTC 2017
src/hb-ot-layout-common-private.hh | 4 +--
util/options.hh | 38 +++++++++++++++++++++++++------------
2 files changed, 28 insertions(+), 14 deletions(-)
New commits:
commit 7ea10c35a34c894e87ee6576d6d4ba3e78535a27
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Aug 15 17:12:28 2017 -0700
[util] Respect eot/bot in safe-to-break test; hook up hb_buffer_diff()
diff --git a/util/options.hh b/util/options.hh
index e9fca381..17a852c4 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -376,9 +376,20 @@ struct shape_options_t : option_group_t
}
assert (text_start < text_end);
- //printf("start %d end %d text start %d end %d\n", start, end, text_start, text_end);
+ if (0)
+ printf("start %d end %d text start %d end %d\n", start, end, text_start, text_end);
+
hb_buffer_clear_contents (fragment);
copy_buffer_properties (fragment, buffer);
+
+ /* TODO: Add pre/post context text. */
+ hb_buffer_flags_t flags = hb_buffer_get_flags (fragment);
+ if (0 < text_start)
+ flags = (hb_buffer_flags_t) (flags & ~HB_BUFFER_FLAG_BOT);
+ if (text_end < num_chars)
+ flags = (hb_buffer_flags_t) (flags & ~HB_BUFFER_FLAG_EOT);
+ hb_buffer_set_flags (fragment, flags);
+
hb_buffer_append (fragment, text_buffer, text_start, text_end);
if (!hb_shape_full (font, fragment, features, num_features, shapers))
{
@@ -397,22 +408,25 @@ struct shape_options_t : option_group_t
text_end = text_start;
}
- hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, NULL);
-
- unsigned int r_num_glyphs;
- hb_glyph_info_t *r_info = hb_buffer_get_glyph_infos (reconstruction, &r_num_glyphs);
- hb_glyph_position_t *r_pos = hb_buffer_get_glyph_positions (reconstruction, NULL);
-
- /* TODO Compare buffers. Remove assert. */
- assert (num_glyphs == r_num_glyphs);
+ bool ret = true;
+ hb_buffer_diff_flags_t diff = hb_buffer_diff (buffer, reconstruction, 0, 0);
+ if (diff)
+ {
+ if (error)
+ *error = "Safe-to-break test failed.";
+ ret = false;
- //hb_buffer_set_length (buffer, 0);
- //hb_buffer_append (buffer, reconstruction, 0, -1);
+ if (0)
+ {
+ hb_buffer_set_length (buffer, 0);
+ hb_buffer_append (buffer, reconstruction, 0, -1);
+ }
+ }
hb_buffer_destroy (reconstruction);
hb_buffer_destroy (fragment);
- return true;
+ return ret;
}
void shape_closure (const char *text, int text_len,
commit 8820ba29dfd2e1302377da62a0527939a0d7d9fb
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Aug 15 17:12:21 2017 -0700
Fix warning about "may be used uninitialized"
diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh
index 180e5f08..578d850c 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -941,7 +941,7 @@ struct Coverage
}
struct Iter {
- Iter (void) : format (0) {};
+ Iter (void) : format (0), u () {};
inline void init (const Coverage &c_) {
format = c_.u.format;
switch (format) {
@@ -982,8 +982,8 @@ struct Coverage
private:
unsigned int format;
union {
+ CoverageFormat2::Iter format2; /* Put this one first since it's larger; helps shut up compiler. */
CoverageFormat1::Iter format1;
- CoverageFormat2::Iter format2;
} u;
};
More information about the HarfBuzz
mailing list