summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2012-07-31 23:08:25 -0400
committerBehdad Esfahbod <behdad@behdad.org>2012-07-31 23:17:22 -0400
commit2bc3b9a616cedbc56ff4a915f9e3439ff3a6bf13 (patch)
tree33c90cb57fdd5967fac2723215f1e796995425df /src
parent5fecd8b0355894ceda14b3d3c654f20c3d5e77f4 (diff)
[OT] Zero mark advances if the shaper desires so
Enabled for all shapers except for Indic.
Diffstat (limited to 'src')
-rw-r--r--src/hb-ot-shape-complex-arabic.cc1
-rw-r--r--src/hb-ot-shape-complex-indic.cc1
-rw-r--r--src/hb-ot-shape-complex-misc.cc2
-rw-r--r--src/hb-ot-shape-complex-private.hh2
-rw-r--r--src/hb-ot-shape.cc15
5 files changed, 21 insertions, 0 deletions
diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc
index 0f73d6dd..2cff581e 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -299,4 +299,5 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
NULL, /* override_features */
NULL, /* normalization_preference */
setup_masks_arabic,
+ true, /* zero_width_marks */
};
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 55eedaba..ba518210 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -1245,4 +1245,5 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic =
override_features_indic,
NULL, /* normalization_preference */
setup_masks_indic,
+ false, /* zero_width_marks */
};
diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc
index 1815366c..015ee083 100644
--- a/src/hb-ot-shape-complex-misc.cc
+++ b/src/hb-ot-shape-complex-misc.cc
@@ -93,6 +93,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
NULL, /* override_features */
normalization_preference_default,
NULL, /* setup_masks */
+ true, /* zero_width_marks */
};
@@ -201,4 +202,5 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai =
NULL, /* override_features */
NULL, /* normalization_preference */
setup_masks_thai,
+ true, /* zero_width_marks */
};
diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh
index c0864feb..8ef41e89 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -93,6 +93,8 @@ struct hb_ot_complex_shaper_t
const hb_ot_map_t *map,
hb_buffer_t *buffer,
hb_font_t *font);
+
+ bool zero_width_marks;
};
#define HB_COMPLEX_SHAPER_IMPLEMENT(name) extern HB_INTERNAL const hb_ot_complex_shaper_t _hb_ot_complex_shaper_##name;
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 843a543c..ac15b2ae 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -402,6 +402,18 @@ hb_position_default (hb_ot_shape_context_t *c)
}
static void
+hb_zero_mark_advances (hb_ot_shape_context_t *c)
+{
+ unsigned int count = c->buffer->len;
+ for (unsigned int i = 0; i < count; i++)
+ if (c->buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_CLASS_MARK)
+ {
+ c->buffer->pos[i].x_advance = 0;
+ c->buffer->pos[i].y_advance = 0;
+ }
+}
+
+static void
hb_ot_position_complex (hb_ot_shape_context_t *c)
{
@@ -429,6 +441,9 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
c->applied_position_complex = true;
}
+ if (c->plan->shaper->zero_width_marks)
+ hb_zero_mark_advances (c);
+
hb_ot_layout_position_finish (c->font, c->buffer);
return;