[HarfBuzz] harfbuzz: Branch 'master' - 2 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Thu Feb 21 12:38:14 PST 2013
src/hb-ot-layout-gsubgpos-private.hh | 12 +++++++---
src/hb-ot-shape-fallback-private.hh | 5 ++++
src/hb-ot-shape-fallback.cc | 40 +++++++++++++++++++++++++++++++++++
src/hb-ot-shape.cc | 38 ---------------------------------
4 files changed, 54 insertions(+), 41 deletions(-)
New commits:
commit 722e8b857eafc52e07dee5d9b253b88ed5c5c8ed
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Feb 21 15:37:51 2013 -0500
Fixup previous commit
Was not decreasing num_items. Ouch!
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 5f5000b..23fbdf4 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -420,7 +420,9 @@ struct hb_apply_context_t
continue;
matcher_t::may_match_t match = matcher.may_match (info, match_glyph_data);
- if (unlikely (match == matcher_t::MATCH_YES))
+ if (match == matcher_t::MATCH_YES ||
+ (match == matcher_t::MATCH_MAYBE &&
+ skip == matcher_t::SKIP_NO))
{
num_items--;
match_glyph_data++;
@@ -428,7 +430,7 @@ struct hb_apply_context_t
}
if (skip == matcher_t::SKIP_NO)
- return match == matcher_t::MATCH_MAYBE ? true : false;
+ return false;
}
return false;
}
@@ -493,7 +495,9 @@ struct hb_apply_context_t
continue;
matcher_t::may_match_t match = matcher.may_match (info, match_glyph_data);
- if (unlikely (match == matcher_t::MATCH_YES))
+ if (match == matcher_t::MATCH_YES ||
+ (match == matcher_t::MATCH_MAYBE &&
+ skip == matcher_t::SKIP_NO))
{
num_items--;
match_glyph_data++;
@@ -501,7 +505,7 @@ struct hb_apply_context_t
}
if (skip == matcher_t::SKIP_NO)
- return match == matcher_t::MATCH_MAYBE ? true : false;
+ return false;
}
return false;
}
commit ba87b8fc89bf745068ccd19264a2631ea0904846
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Feb 21 15:23:39 2013 -0500
Move code around
diff --git a/src/hb-ot-shape-fallback-private.hh b/src/hb-ot-shape-fallback-private.hh
index 5e9cb06..ec65351 100644
--- a/src/hb-ot-shape-fallback-private.hh
+++ b/src/hb-ot-shape-fallback-private.hh
@@ -41,4 +41,9 @@ HB_INTERNAL void _hb_ot_shape_fallback_position_recategorize_marks (const hb_ot_
hb_buffer_t *buffer);
+HB_INTERNAL void _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer);
+
+
#endif /* HB_OT_SHAPE_FALLBACK_PRIVATE_HH */
diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc
index 6f3426e..cd9d9a4 100644
--- a/src/hb-ot-shape-fallback.cc
+++ b/src/hb-ot-shape-fallback.cc
@@ -407,3 +407,43 @@ _hb_ot_shape_fallback_position (const hb_ot_shape_plan_t *plan,
}
position_cluster (plan, font, buffer, start, count);
}
+
+
+/* Performs old-style TrueType kerning. */
+void
+_hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer)
+{
+ unsigned int count = buffer->len;
+ hb_mask_t kern_mask = plan->map.get_1_mask (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction) ?
+ HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n'));
+
+ if (unlikely (!count)) return;
+
+ bool enabled = buffer->info[0].mask & kern_mask;
+ for (unsigned int i = 1; i < count; i++)
+ {
+ bool next = buffer->info[i].mask & kern_mask;
+ if (enabled && next)
+ {
+ hb_position_t x_kern, y_kern, kern1, kern2;
+ font->get_glyph_kerning_for_direction (buffer->info[i - 1].codepoint, buffer->info[i].codepoint,
+ buffer->props.direction,
+ &x_kern, &y_kern);
+
+ kern1 = x_kern >> 1;
+ kern2 = x_kern - kern1;
+ buffer->pos[i - 1].x_advance += kern1;
+ buffer->pos[i].x_advance += kern2;
+ buffer->pos[i].x_offset += kern2;
+
+ kern1 = y_kern >> 1;
+ kern2 = y_kern - kern1;
+ buffer->pos[i - 1].y_advance += kern1;
+ buffer->pos[i].y_advance += kern2;
+ buffer->pos[i].y_offset += kern2;
+ }
+ enabled = next;
+ }
+}
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 32d7afc..f65861f 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -493,42 +493,6 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
}
static inline void
-hb_ot_truetype_kern (hb_ot_shape_context_t *c)
-{
- unsigned int count = c->buffer->len;
- hb_mask_t kern_mask = c->plan->map.get_1_mask (HB_DIRECTION_IS_HORIZONTAL (c->buffer->props.direction) ?
- HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n'));
-
- if (unlikely (!count)) return;
-
- bool enabled = c->buffer->info[0].mask & kern_mask;
- for (unsigned int i = 1; i < count; i++)
- {
- bool next = c->buffer->info[i].mask & kern_mask;
- if (enabled && next)
- {
- hb_position_t x_kern, y_kern, kern1, kern2;
- c->font->get_glyph_kerning_for_direction (c->buffer->info[i - 1].codepoint, c->buffer->info[i].codepoint,
- c->buffer->props.direction,
- &x_kern, &y_kern);
-
- kern1 = x_kern >> 1;
- kern2 = x_kern - kern1;
- c->buffer->pos[i - 1].x_advance += kern1;
- c->buffer->pos[i].x_advance += kern2;
- c->buffer->pos[i].x_offset += kern2;
-
- kern1 = y_kern >> 1;
- kern2 = y_kern - kern1;
- c->buffer->pos[i - 1].y_advance += kern1;
- c->buffer->pos[i].y_advance += kern2;
- c->buffer->pos[i].y_offset += kern2;
- }
- enabled = next;
- }
-}
-
-static inline void
hb_ot_position (hb_ot_shape_context_t *c)
{
hb_ot_position_default (c);
@@ -544,7 +508,7 @@ hb_ot_position (hb_ot_shape_context_t *c)
/* Visual fallback goes here. */
if (fallback)
- hb_ot_truetype_kern (c);
+ _hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer);
}
More information about the HarfBuzz
mailing list