Created
May 1, 2015 17:21
-
-
Save behdad/149ae8947c11afddc560 to your computer and use it in GitHub Desktop.
UNSAFE_TO_BREAK patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit aa2e899700e3c301b7a4ce93689a7803e4e8bef9 | |
Merge: cf3afd8 7c40225 | |
Author: Behdad Esfahbod <behdad@behdad.org> | |
Date: Fri Oct 26 12:24:14 2012 -0700 | |
WIP on master: cf3afd8 Rename and revamp is_zero_width() to be is_default_ignorable() | |
diff --cc src/hb-buffer.cc | |
index 2f8f511,2f8f511..884acee | |
--- a/src/hb-buffer.cc | |
+++ b/src/hb-buffer.cc | |
@@@ -396,25 -396,25 +396,44 @@@ hb_buffer_t::merge_clusters (unsigned i | |
return; | |
unsigned int cluster = info[start].cluster; | |
++ hb_mask_t mask = 0; | |
-- for (unsigned int i = start + 1; i < end; i++) | |
++ for (unsigned int i = start + 1; i < end; i++) { | |
cluster = MIN (cluster, info[i].cluster); | |
++ mask |= info[i].mask; | |
++ } | |
/* Extend end */ | |
-- while (end < len && info[end - 1].cluster == info[end].cluster) | |
++ while (end < len && info[end - 1].cluster == info[end].cluster) { | |
++ mask |= info[end].mask; | |
end++; | |
++ } | |
/* Extend start */ | |
-- while (idx < start && info[start - 1].cluster == info[start].cluster) | |
++ while (idx < start && info[start - 1].cluster == info[start].cluster) { | |
++ mask |= info[start].mask; | |
start--; | |
++ } | |
/* If we hit the start of buffer, continue in out-buffer. */ | |
-- if (idx == start) | |
-- for (unsigned i = out_len; i && out_info[i - 1].cluster == info[start].cluster; i--) | |
++ if (idx == start) { | |
++ for (unsigned i = out_len; i && out_info[i - 1].cluster == info[start].cluster; i--) { | |
out_info[i - 1].cluster = cluster; | |
++ mask |= info[i - 1].mask; | |
++ } | |
++ } | |
-- for (unsigned int i = start; i < end; i++) | |
++ /* Set now */ | |
++ | |
++ mask &= HB_GLYPH_FLAG_UNSAFE_TO_BREAK_BEFORE; | |
++ | |
++ for (unsigned i = out_len; i && out_info[i - 1].cluster == cluster; i--) | |
++ info[i - 1].mask |= mask; | |
++ | |
++ for (unsigned int i = start; i < end; i++) { | |
info[i].cluster = cluster; | |
++ info[i].mask |= mask; | |
++ } | |
} | |
void | |
hb_buffer_t::merge_out_clusters (unsigned int start, | |
diff --cc src/hb-buffer.h | |
index dc63d1b,dc63d1b..0c361ad | |
--- a/src/hb-buffer.h | |
+++ b/src/hb-buffer.h | |
@@@ -40,11 -40,11 +40,16 @@@ | |
HB_BEGIN_DECLS | |
++typedef enum { | |
++ HB_GLYPH_FLAG_UNSAFE_TO_BREAK_BEFORE = 0x02, | |
++ HB_GLYPH_FLAG_DEFINED = 0x02 /* OR of all defined flags */ | |
++} hb_glyph_flags_t; | |
++ | |
typedef struct hb_buffer_t hb_buffer_t; | |
typedef struct hb_glyph_info_t { | |
hb_codepoint_t codepoint; | |
-- hb_mask_t mask; | |
++ hb_mask_t mask; /* Holds hb_glyph_flags_t after hb_shape() */ | |
uint32_t cluster; | |
/*< private >*/ | |
diff --cc src/hb-ot-map.cc | |
index f290c98,f290c98..15e041f | |
--- a/src/hb-ot-map.cc | |
+++ b/src/hb-ot-map.cc | |
@@@ -187,6 -187,6 +187,8 @@@ hb_ot_map_builder_t::compile (hb_face_ | |
/* Allocate bits now */ | |
unsigned int next_bit = 1; | |
++ next_bit++; /* Allocate for HB_GLYPH_FLAG_UNSAFE_TO_BREAK_BEFORE */ | |
++ | |
for (unsigned int i = 0; i < feature_infos.len; i++) { | |
const feature_info_t *info = &feature_infos[i]; | |
diff --cc util/options.cc | |
index dc7aeed,dc7aeed..9c38533 | |
--- a/util/options.cc | |
+++ b/util/options.cc | |
@@@ -635,6 -635,6 +635,9 @@@ format_options_t::serialize_glyphs (hb_ | |
if (utf8_clusters) | |
g_string_append (gs, "u8"); | |
} | |
++ if (true) { | |
++ g_string_append_printf (gs, "&%x", info->mask & HB_GLYPH_FLAG_DEFINED); | |
++ } | |
if (show_positions && (pos->x_offset || pos->y_offset)) { | |
g_string_append_c (gs, '@'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment