[HarfBuzz] harfbuzz: Branch 'master' - 7 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Thu May 2 12:41:22 PDT 2013
src/hb-buffer-private.hh | 2 +
src/hb-ot-layout-gsub-table.hh | 71 ++++++++++++++++++++++-------------------
src/hb-ot-map-private.hh | 27 +++++++++------
src/hb-ot-map.cc | 48 +++++++++++++++------------
src/hb-ot-shape-private.hh | 3 -
src/hb-set-private.hh | 16 +++++----
6 files changed, 95 insertions(+), 72 deletions(-)
New commits:
commit 5d59f999204aedfc433ab4989664d875f96b0364
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 2 14:44:45 2013 -0400
[OTLayout] Make MultipleSubst in-place for sequences of len=1
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index d25a0d3..3b6635b 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -275,11 +275,18 @@ struct Sequence
unsigned int klass = c->buffer->cur().glyph_props() &
HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE ? HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : 0;
unsigned int count = substitute.len;
- for (unsigned int i = 0; i < count; i++) {
- set_lig_props_for_component (c->buffer->cur(), i);
- c->output_glyph (substitute.array[i], klass);
+ if (count == 1) /* Special-case to make it in-place. */
+ {
+ c->replace_glyph (substitute.array[0]);
+ }
+ else
+ {
+ for (unsigned int i = 0; i < count; i++) {
+ set_lig_props_for_component (c->buffer->cur(), i);
+ c->output_glyph (substitute.array[i], klass);
+ }
+ c->buffer->skip_glyph ();
}
- c->buffer->skip_glyph ();
return TRACE_RETURN (true);
}
commit 54f84a6b8571ac7aaaa66f3eff562d23d69d7552
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 2 15:27:53 2013 -0400
[OTLayout] Whitespace
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 5247c68..d25a0d3 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -1196,38 +1196,38 @@ struct SubstLookup : Lookup
if (likely (!is_reverse ()))
{
- /* in/out forward substitution */
- c->buffer->clear_output ();
- c->buffer->idx = 0;
-
- while (c->buffer->idx < c->buffer->len)
- {
- if (digest->may_have (c->buffer->cur().codepoint) &&
- (c->buffer->cur().mask & c->lookup_mask) &&
- apply_once (c))
- ret = true;
- else
- c->buffer->next_glyph ();
- }
- if (ret)
- c->buffer->swap_buffers ();
+ /* in/out forward substitution */
+ c->buffer->clear_output ();
+ c->buffer->idx = 0;
+
+ while (c->buffer->idx < c->buffer->len)
+ {
+ if (digest->may_have (c->buffer->cur().codepoint) &&
+ (c->buffer->cur().mask & c->lookup_mask) &&
+ apply_once (c))
+ ret = true;
+ else
+ c->buffer->next_glyph ();
+ }
+ if (ret)
+ c->buffer->swap_buffers ();
}
else
{
- /* in-place backward substitution */
- c->buffer->remove_output ();
- c->buffer->idx = c->buffer->len - 1;
- do
- {
- if (digest->may_have (c->buffer->cur().codepoint) &&
- (c->buffer->cur().mask & c->lookup_mask) &&
- apply_once (c))
- ret = true;
- else
- c->buffer->idx--;
+ /* in-place backward substitution */
+ c->buffer->remove_output ();
+ c->buffer->idx = c->buffer->len - 1;
+ do
+ {
+ if (digest->may_have (c->buffer->cur().codepoint) &&
+ (c->buffer->cur().mask & c->lookup_mask) &&
+ apply_once (c))
+ ret = true;
+ else
+ c->buffer->idx--;
- }
- while ((int) c->buffer->idx >= 0);
+ }
+ while ((int) c->buffer->idx >= 0);
}
return ret;
commit 3276c354daaff3acabecff11f8e4b5c54d53fc25
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 2 15:16:59 2013 -0400
[OTLayout] Minor refactoring
diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh
index adba310..5ed54a6 100644
--- a/src/hb-ot-map-private.hh
+++ b/src/hb-ot-map-private.hh
@@ -118,6 +118,10 @@ struct hb_ot_map_t
}
HB_INTERNAL void collect_lookups (unsigned int table_index, hb_set_t *lookups) const;
+ HB_INTERNAL inline void apply (unsigned int table_index,
+ const struct hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer) const;
HB_INTERNAL void substitute (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
HB_INTERNAL void position (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc
index 64423cd..dd26afc 100644
--- a/src/hb-ot-map.cc
+++ b/src/hb-ot-map.cc
@@ -102,20 +102,30 @@ void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value,
info->stage[1] = current_stage[1];
}
-/* Keep the next two functions in sync. */
-
-void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const
+inline void hb_ot_map_t::apply (unsigned int table_index,
+ const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer) const
{
- const unsigned int table_index = 0;
unsigned int i = 0;
for (unsigned int stage_index = 0; stage_index < stages[table_index].len; stage_index++) {
const stage_map_t *stage = &stages[table_index][stage_index];
for (; i < stage->last_lookup; i++)
- hb_ot_layout_substitute_lookup (font, buffer,
- lookups[table_index][i].index,
- lookups[table_index][i].mask,
- lookups[table_index][i].auto_zwj);
+ switch (table_index)
+ {
+ case 0:
+ hb_ot_layout_substitute_lookup (font, buffer, lookups[table_index][i].index,
+ lookups[table_index][i].mask,
+ lookups[table_index][i].auto_zwj);
+ break;
+
+ case 1:
+ hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index,
+ lookups[table_index][i].mask,
+ lookups[table_index][i].auto_zwj);
+ break;
+ }
if (stage->pause_func)
{
@@ -125,23 +135,17 @@ void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, h
}
}
-void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const
+void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const
{
- const unsigned int table_index = 1;
- unsigned int i = 0;
-
- for (unsigned int stage_index = 0; stage_index < stages[table_index].len; stage_index++) {
- const stage_map_t *stage = &stages[table_index][stage_index];
- for (; i < stage->last_lookup; i++)
- hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index,
- lookups[table_index][i].mask,
- lookups[table_index][i].auto_zwj);
+ apply (0, plan, font, buffer);
+}
- if (stage->pause_func)
- stage->pause_func (plan, font, buffer);
- }
+void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const
+{
+ apply (1, plan, font, buffer);
}
+
void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const
{
for (unsigned int i = 0; i < lookups[table_index].len; i++)
commit ea86efa486a5076e9bf844239bccf86d67577f88
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 2 14:41:39 2013 -0400
Minor
diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh
index c811fa4..adba310 100644
--- a/src/hb-ot-map-private.hh
+++ b/src/hb-ot-map-private.hh
@@ -146,7 +146,7 @@ struct hb_ot_map_t
hb_prealloced_array_t<feature_map_t, 8> features;
hb_prealloced_array_t<lookup_map_t, 32> lookups[2]; /* GSUB/GPOS */
- hb_prealloced_array_t<stage_map_t, 1> stages[2]; /* GSUB/GPOS */
+ hb_prealloced_array_t<stage_map_t, 4> stages[2]; /* GSUB/GPOS */
};
enum hb_ot_map_feature_flags_t {
@@ -235,8 +235,8 @@ struct hb_ot_map_builder_t
private:
unsigned int current_stage[2]; /* GSUB/GPOS */
- hb_prealloced_array_t<feature_info_t,16> feature_infos;
- hb_prealloced_array_t<stage_info_t, 1> stages[2]; /* GSUB/GPOS */
+ hb_prealloced_array_t<feature_info_t, 32> feature_infos;
+ hb_prealloced_array_t<stage_info_t, 8> stages[2]; /* GSUB/GPOS */
};
commit 8b63efb6f80b2e9b2de5ec6ab24d6e15826565cb
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 2 14:29:32 2013 -0400
Minor
diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 387ebd9..a8cf770 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -80,6 +80,8 @@ struct hb_buffer_t {
inline hb_glyph_info_t &prev (void) { return out_info[out_len - 1]; }
inline hb_glyph_info_t prev (void) const { return info[out_len - 1]; }
+ inline bool has_separate_output (void) const { return info != out_info; }
+
unsigned int serial;
/* These reflect current allocations of the bytes in glyph_info_t's var1 and var2. */
commit 2265be0a620bc76ab65f12fedde67791beb51314
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 2 14:25:09 2013 -0400
Minor
diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh
index 62fd605..c811fa4 100644
--- a/src/hb-ot-map-private.hh
+++ b/src/hb-ot-map-private.hh
@@ -31,8 +31,8 @@
#include "hb-buffer-private.hh"
-#include "hb-ot-layout-private.hh"
+struct hb_ot_shape_plan_t;
static const hb_tag_t table_tags[2] = {HB_OT_TAG_GSUB, HB_OT_TAG_GPOS};
@@ -123,10 +123,11 @@ struct hb_ot_map_t
inline void finish (void) {
features.finish ();
- lookups[0].finish ();
- lookups[1].finish ();
- stages[0].finish ();
- stages[1].finish ();
+ for (unsigned int table_index = 0; table_index < 2; table_index++)
+ {
+ lookups[table_index].finish ();
+ stages[table_index].finish ();
+ }
}
public:
@@ -195,8 +196,10 @@ struct hb_ot_map_builder_t
inline void finish (void) {
feature_infos.finish ();
- stages[0].finish ();
- stages[1].finish ();
+ for (unsigned int table_index = 0; table_index < 2; table_index++)
+ {
+ stages[table_index].finish ();
+ }
}
private:
diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc
index 39929e0..64423cd 100644
--- a/src/hb-ot-map.cc
+++ b/src/hb-ot-map.cc
@@ -28,6 +28,8 @@
#include "hb-ot-map-private.hh"
+#include "hb-ot-layout-private.hh"
+
void
hb_ot_map_t::add_lookups (hb_face_t *face,
diff --git a/src/hb-ot-shape-private.hh b/src/hb-ot-shape-private.hh
index 9599f8e..8171471 100644
--- a/src/hb-ot-shape-private.hh
+++ b/src/hb-ot-shape-private.hh
@@ -30,8 +30,7 @@
#include "hb-private.hh"
#include "hb-ot-map-private.hh"
-
-
+#include "hb-ot-layout-private.hh"
commit e6f19af08717a6a63ad0b5bf4bf368778edc63f0
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 2 13:59:46 2013 -0400
Minor
diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index c2b3e46..d59f248 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -45,12 +45,14 @@ struct hb_set_digest_lowest_bits_t
{
ASSERT_POD ();
+ static const unsigned int mask_bytes = sizeof (mask_t);
+ static const unsigned int mask_bits = sizeof (mask_t) * 8;
static const unsigned int num_bits = 0
- + (sizeof (mask_t) >= 1 ? 3 : 0)
- + (sizeof (mask_t) >= 2 ? 1 : 0)
- + (sizeof (mask_t) >= 4 ? 1 : 0)
- + (sizeof (mask_t) >= 8 ? 1 : 0)
- + (sizeof (mask_t) >= 16? 1 : 0)
+ + (mask_bytes >= 1 ? 3 : 0)
+ + (mask_bytes >= 2 ? 1 : 0)
+ + (mask_bytes >= 4 ? 1 : 0)
+ + (mask_bytes >= 8 ? 1 : 0)
+ + (mask_bytes >= 16? 1 : 0)
+ 0;
ASSERT_STATIC (shift < sizeof (hb_codepoint_t) * 8);
@@ -65,7 +67,7 @@ struct hb_set_digest_lowest_bits_t
}
inline void add_range (hb_codepoint_t a, hb_codepoint_t b) {
- if ((b >> shift) - (a >> shift) >= sizeof (mask_t) * 8 - 1)
+ if ((b >> shift) - (a >> shift) >= mask_bits - 1)
mask = (mask_t) -1;
else {
mask_t ma = mask_for (a);
@@ -81,7 +83,7 @@ struct hb_set_digest_lowest_bits_t
private:
static inline mask_t mask_for (hb_codepoint_t g) {
- return ((mask_t) 1) << ((g >> shift) & (sizeof (mask_t) * 8 - 1));
+ return ((mask_t) 1) << ((g >> shift) & (mask_bits - 1));
}
mask_t mask;
};
More information about the HarfBuzz
mailing list