summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--src/hb-buffer-private.hh4
-rw-r--r--src/hb-buffer.cc3
-rw-r--r--src/hb-ot-layout-common-private.hh8
-rw-r--r--src/hb-ot-layout-gdef-private.hh6
-rw-r--r--src/hb-ot-layout-gpos-private.hh4
-rw-r--r--src/hb-ot-layout-gsub-private.hh66
-rw-r--r--src/hb-ot-layout-gsubgpos-private.hh29
-rw-r--r--src/hb-ot-layout-private.hh29
-rw-r--r--src/hb-ot-layout.cc138
-rw-r--r--src/hb-ot-layout.h26
-rw-r--r--src/hb-ot-shape.cc10
12 files changed, 98 insertions, 227 deletions
diff --git a/TODO b/TODO
index d206da19..fb6a86f0 100644
--- a/TODO
+++ b/TODO
@@ -3,8 +3,6 @@ General fixes:
- Fix tt kern on/off
-- Remove synthesized GDEF
-
- Remove fixed-size feature/lookup arrays in hb-ot-map
- Use size_t in sanitize
diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index de698ede..a1291651 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -35,10 +35,6 @@
HB_BEGIN_DECLS
-/* XXX */
-#define HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN 0xFFFF
-#define gproperty() var2.u32
-
ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index daf9d534..03e8e1aa 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -253,7 +253,6 @@ hb_buffer_add_glyph (hb_buffer_t *buffer,
glyph->codepoint = codepoint;
glyph->mask = mask;
glyph->cluster = cluster;
- glyph->gproperty() = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
buffer->len++;
}
@@ -330,7 +329,6 @@ _hb_buffer_replace_glyphs_be16 (hb_buffer_t *buffer,
hb_glyph_info_t *info = &buffer->out_info[buffer->out_len + i];
*info = orig_info;
info->codepoint = hb_be_uint16 (glyph_data_be[i]);
- info->gproperty() = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
}
buffer->i += num_in;
@@ -353,7 +351,6 @@ _hb_buffer_replace_glyph (hb_buffer_t *buffer,
info = &buffer->out_info[buffer->out_len];
info->codepoint = glyph_index;
- info->gproperty() = HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN;
buffer->i++;
buffer->out_len++;
diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh
index ccbd939a..2ba0ef45 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -431,7 +431,7 @@ struct ClassDefFormat1
friend struct ClassDef;
private:
- inline hb_ot_layout_class_t get_class (hb_codepoint_t glyph_id) const
+ inline unsigned int get_class (hb_codepoint_t glyph_id) const
{
if ((unsigned int) (glyph_id - startGlyph) < classValue.len)
return classValue[glyph_id - startGlyph];
@@ -457,7 +457,7 @@ struct ClassDefFormat2
friend struct ClassDef;
private:
- inline hb_ot_layout_class_t get_class (hb_codepoint_t glyph_id) const
+ inline unsigned int get_class (hb_codepoint_t glyph_id) const
{
int i = rangeRecord.search (glyph_id);
if (i != -1)
@@ -480,9 +480,9 @@ struct ClassDefFormat2
struct ClassDef
{
- inline hb_ot_layout_class_t operator () (hb_codepoint_t glyph_id) const { return get_class (glyph_id); }
+ inline unsigned int operator () (hb_codepoint_t glyph_id) const { return get_class (glyph_id); }
- inline hb_ot_layout_class_t get_class (hb_codepoint_t glyph_id) const
+ inline unsigned int get_class (hb_codepoint_t glyph_id) const
{
switch (u.format) {
case 1: return u.format1.get_class(glyph_id);
diff --git a/src/hb-ot-layout-gdef-private.hh b/src/hb-ot-layout-gdef-private.hh
index c7bd738b..209f00a9 100644
--- a/src/hb-ot-layout-gdef-private.hh
+++ b/src/hb-ot-layout-gdef-private.hh
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2007,2008,2009 Red Hat, Inc.
+ * Copyright (C) 2010 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
@@ -22,6 +23,7 @@
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Behdad Esfahbod
+ * Google Author(s): Behdad Esfahbod
*/
#ifndef HB_OT_LAYOUT_GDEF_PRIVATE_HH
@@ -335,11 +337,11 @@ struct GDEF
};
inline bool has_glyph_classes (void) const { return glyphClassDef != 0; }
- inline hb_ot_layout_class_t get_glyph_class (hb_codepoint_t glyph) const
+ inline unsigned int get_glyph_class (hb_codepoint_t glyph) const
{ return (this+glyphClassDef).get_class (glyph); }
inline bool has_mark_attachment_types (void) const { return markAttachClassDef != 0; }
- inline hb_ot_layout_class_t get_mark_attachment_type (hb_codepoint_t glyph) const
+ inline unsigned int get_mark_attachment_type (hb_codepoint_t glyph) const
{ return (this+markAttachClassDef).get_class (glyph); }
inline bool has_attach_points (void) const { return attachList != 0; }
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 5cf93798..cb97cfbf 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2007,2008,2009,2010 Red Hat, Inc.
+ * Copyright (C) 2010 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
@@ -22,6 +23,7 @@
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Behdad Esfahbod
+ * Google Author(s): Behdad Esfahbod
*/
#ifndef HB_OT_LAYOUT_GPOS_PRIVATE_HH
@@ -826,7 +828,7 @@ struct CursivePosFormat1
TRACE_APPLY ();
/* We don't handle mark glyphs here. */
- if (c->property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
+ if (c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)
return false;
unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index 577b34b9..a69f41f7 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2007,2008,2009,2010 Red Hat, Inc.
+ * Copyright (C) 2010 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
@@ -22,6 +23,7 @@
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Behdad Esfahbod
+ * Google Author(s): Behdad Esfahbod
*/
#ifndef HB_OT_LAYOUT_GSUB_PRIVATE_HH
@@ -47,11 +49,7 @@ struct SingleSubstFormat1
return false;
glyph_id += deltaGlyphID;
- c->buffer->replace_glyph (glyph_id);
-
- /* We inherit the old glyph class to the substituted glyph */
- if (_hb_ot_layout_has_new_glyph_classes (c->layout->face))
- _hb_ot_layout_set_glyph_property (c->layout->face, glyph_id, c->property);
+ c->replace_glyph (glyph_id);
return true;
}
@@ -91,11 +89,7 @@ struct SingleSubstFormat2
return false;
glyph_id = substitute[index];
- c->buffer->replace_glyph (glyph_id);
-
- /* We inherit the old glyph class to the substituted glyph */
- if (_hb_ot_layout_has_new_glyph_classes (c->layout->face))
- _hb_ot_layout_set_glyph_property (c->layout->face, glyph_id, c->property);
+ c->replace_glyph (glyph_id);
return true;
}
@@ -164,19 +158,9 @@ struct Sequence
if (unlikely (!substitute.len))
return false;
- c->buffer->replace_glyphs_be16 (1, substitute.len, (const uint16_t *) substitute.array);
-
- /* This is a guess only ... */
- if (_hb_ot_layout_has_new_glyph_classes (c->layout->face))
- {
- unsigned int property = c->property;
- if (property == HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)
- property = HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
-
- unsigned int count = substitute.len;
- for (unsigned int n = 0; n < count; n++)
- _hb_ot_layout_set_glyph_property (c->layout->face, substitute[n], property);
- }
+ if (c->property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)
+ c->guess_glyph_class (HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH);
+ c->replace_glyphs_be16 (1, substitute.len, (const uint16_t *) substitute.array);
return true;
}
@@ -295,11 +279,7 @@ struct AlternateSubstFormat1
glyph_id = alt_set[alt_index - 1];
- c->buffer->replace_glyph (glyph_id);
-
- /* We inherit the old glyph class to the substituted glyph */
- if (_hb_ot_layout_has_new_glyph_classes (c->layout->face))
- _hb_ot_layout_set_glyph_property (c->layout->face, glyph_id, c->property);
+ c->replace_glyph (glyph_id);
return true;
}
@@ -359,7 +339,7 @@ struct Ligature
friend struct LigatureSet;
private:
- inline bool apply (hb_apply_context_t *c, bool is_mark) const
+ inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
unsigned int i, j;
@@ -368,6 +348,9 @@ struct Ligature
if (unlikely (c->buffer->i + count > end))
return false;
+ bool first_was_mark = (c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
+ bool found_non_mark = false;
+
for (i = 1, j = c->buffer->i + 1; i < count; i++, j++)
{
unsigned int property;
@@ -378,17 +361,14 @@ struct Ligature
j++;
}
- if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
- is_mark = false;
+ found_non_mark |= !(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
if (likely (c->buffer->info[j].codepoint != component[i]))
return false;
}
- /* This is just a guess ... */
- if (_hb_ot_layout_has_new_glyph_classes (c->layout->face))
- _hb_ot_layout_set_glyph_class (c->layout->face, ligGlyph,
- is_mark ? HB_OT_LAYOUT_GLYPH_CLASS_MARK
- : HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE);
+
+ if (first_was_mark && found_non_mark)
+ c->guess_glyph_class (HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE);
/* Allocate new ligature id */
unsigned int lig_id = allocate_lig_id (c->buffer);
@@ -397,11 +377,11 @@ struct Ligature
if (j == c->buffer->i + i) /* No input glyphs skipped */
{
- c->buffer->replace_glyphs_be16 (i, 1, (const uint16_t *) &ligGlyph);
+ c->replace_glyphs_be16 (i, 1, (const uint16_t *) &ligGlyph);
}
else
{
- c->buffer->replace_glyph (ligGlyph);
+ c->replace_glyph (ligGlyph);
/* Now we must do a second loop to copy the skipped glyphs to
`out' and assign component values to it. We start with the
@@ -416,7 +396,7 @@ struct Ligature
{
c->buffer->info[c->buffer->i].component() = i;
c->buffer->info[c->buffer->i].lig_id() = lig_id;
- c->buffer->replace_glyph (c->buffer->info[c->buffer->i].codepoint);
+ c->replace_glyph (c->buffer->info[c->buffer->i].codepoint);
}
/* Skip the base glyph */
@@ -455,14 +435,14 @@ struct LigatureSet
friend struct LigatureSubstFormat1;
private:
- inline bool apply (hb_apply_context_t *c, bool is_mark) const
+ inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
unsigned int num_ligs = ligature.len;
for (unsigned int i = 0; i < num_ligs; i++)
{
const Ligature &lig = this+ligature[i];
- if (lig.apply (c, is_mark))
+ if (lig.apply (c))
return true;
}
@@ -493,14 +473,12 @@ struct LigatureSubstFormat1
TRACE_APPLY ();
hb_codepoint_t glyph_id = c->buffer->info[c->buffer->i].codepoint;
- bool first_is_mark = !!(c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
-
unsigned int index = (this+coverage) (glyph_id);
if (likely (index == NOT_COVERED))
return false;
const LigatureSet &lig_set = this+ligatureSet[index];
- return lig_set.apply (c, first_is_mark);
+ return lig_set.apply (c);
}
inline bool sanitize (hb_sanitize_context_t *c) {
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 8268d0f4..5dc6f3ae 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2007,2008,2009,2010 Red Hat, Inc.
+ * Copyright (C) 2010 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
@@ -22,6 +23,7 @@
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Red Hat Author(s): Behdad Esfahbod
+ * Google Author(s): Behdad Esfahbod
*/
#ifndef HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH
@@ -52,7 +54,32 @@ struct hb_apply_context_t
unsigned int context_length;
unsigned int nesting_level_left;
unsigned int lookup_flag;
- unsigned int property; /* propety of first glyph (TODO remove) */
+ unsigned int property; /* propety of first glyph */
+
+
+ inline void replace_glyph (hb_codepoint_t glyph_index) const
+ {
+ clear_property ();
+ buffer->replace_glyph (glyph_index);
+ }
+ inline void replace_glyphs_be16 (unsigned int num_in,
+ unsigned int num_out,
+ const uint16_t *glyph_data_be) const
+ {
+ clear_property ();
+ buffer->replace_glyphs_be16 (num_in, num_out, glyph_data_be);
+ }
+
+ inline void guess_glyph_class (unsigned int klass)
+ {
+// buffer->info[buffer->i].gproperty() = klass;
+ }
+
+ private:
+ inline void clear_property (void) const
+ {
+ buffer->info[buffer->i].gproperty() = 0;
+ }
};
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index f28e99d0..a0886871 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -41,10 +41,18 @@ HB_BEGIN_DECLS
/* XXX */
#define component() var1.u16[0]
#define lig_id() var1.u16[1]
+#define gproperty() var2.u32
#define back() var.u16[0] /* number of glyphs to go back for drawing current glyph */
#define cursive_chain() var.i16[1] /* character to which this connects, may be positive or negative */
-typedef unsigned int hb_ot_layout_class_t;
+typedef enum {
+ HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 0x0002,
+ HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 0x0004,
+ HB_OT_LAYOUT_GLYPH_CLASS_MARK = 0x0008,
+ HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 0x0010,
+ HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0x0020
+} hb_ot_layout_glyph_class_t;
+
/*
* hb_ot_layout_t
@@ -59,12 +67,6 @@ struct hb_ot_layout_t
const struct GDEF *gdef;
const struct GSUB *gsub;
const struct GPOS *gpos;
-
- struct
- {
- unsigned char *klasses;
- unsigned int len;
- } new_gdef;
};
struct hb_ot_layout_context_t
@@ -93,19 +95,6 @@ _hb_ot_layout_free (hb_ot_layout_t *layout);
*/
HB_INTERNAL hb_bool_t
-_hb_ot_layout_has_new_glyph_classes (hb_face_t *face);
-
-HB_INTERNAL void
-_hb_ot_layout_set_glyph_property (hb_face_t *face,
- hb_codepoint_t glyph,
- unsigned int property);
-
-HB_INTERNAL void
-_hb_ot_layout_set_glyph_class (hb_face_t *face,
- hb_codepoint_t glyph,
- hb_ot_layout_glyph_class_t klass);
-
-HB_INTERNAL hb_bool_t
_hb_ot_layout_check_glyph_property (hb_face_t *face,
hb_glyph_info_t *ginfo,
unsigned int lookup_flags,
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index a705b667..d128fdba 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -70,8 +70,6 @@ _hb_ot_layout_free (hb_ot_layout_t *layout)
hb_blob_destroy (layout->gsub_blob);
hb_blob_destroy (layout->gpos_blob);
- free (layout->new_gdef.klasses);
-
free (layout);
}
@@ -98,32 +96,23 @@ _get_gpos (hb_face_t *face)
* GDEF
*/
-/* TODO the public class_t is a mess */
-
hb_bool_t
hb_ot_layout_has_glyph_classes (hb_face_t *face)
{
return _get_gdef (face).has_glyph_classes ();
}
-hb_bool_t
-_hb_ot_layout_has_new_glyph_classes (hb_face_t *face)
-{
- return face->ot_layout->new_gdef.len > 0;
-}
-
static unsigned int
-_hb_ot_layout_get_glyph_property (hb_face_t *face,
- hb_codepoint_t glyph)
+_hb_ot_layout_get_glyph_property_from_gdef (hb_face_t *face,
+ hb_glyph_info_t *info)
{
- hb_ot_layout_class_t klass;
+ hb_codepoint_t glyph = info->codepoint;
+
+ unsigned int klass;
const GDEF &gdef = _get_gdef (face);
klass = gdef.get_glyph_class (glyph);
- if (!klass && glyph < face->ot_layout->new_gdef.len)
- klass = face->ot_layout->new_gdef.klasses[glyph];
-
switch (klass) {
default:
case GDEF::UnclassifiedGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED;
@@ -132,10 +121,20 @@ _hb_ot_layout_get_glyph_property (hb_face_t *face,
case GDEF::ComponentGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT;
case GDEF::MarkGlyph:
klass = gdef.get_mark_attachment_type (glyph);
- return HB_OT_LAYOUT_GLYPH_CLASS_MARK + (klass << 8);
+ return HB_OT_LAYOUT_GLYPH_CLASS_MARK | (klass << 8);
}
}
+static inline unsigned int
+_hb_ot_layout_get_glyph_property (hb_face_t *face,
+ hb_glyph_info_t *info)
+{
+ if (!info->gproperty())
+ info->gproperty() = _hb_ot_layout_get_glyph_property_from_gdef (face, info);
+
+ return info->gproperty();
+}
+
hb_bool_t
_hb_ot_layout_check_glyph_property (hb_face_t *face,
hb_glyph_info_t *ginfo,
@@ -144,9 +143,7 @@ _hb_ot_layout_check_glyph_property (hb_face_t *face,
{
unsigned int property;
- if (ginfo->gproperty() == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
- ginfo->gproperty() = _hb_ot_layout_get_glyph_property (face, ginfo->codepoint);
- property = ginfo->gproperty();
+ property = _hb_ot_layout_get_glyph_property (face, ginfo);
if (property_out)
*property_out = property;
@@ -183,9 +180,7 @@ _hb_ot_layout_skip_mark (hb_face_t *face,
{
unsigned int property;
- if (ginfo->gproperty() == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
- ginfo->gproperty() = _hb_ot_layout_get_glyph_property (face, ginfo->codepoint);
- property = ginfo->gproperty();
+ property = _hb_ot_layout_get_glyph_property (face, ginfo);
if (property_out)
*property_out = property;
@@ -208,103 +203,6 @@ _hb_ot_layout_skip_mark (hb_face_t *face,
return false;
}
-void
-_hb_ot_layout_set_glyph_class (hb_face_t *face,
- hb_codepoint_t glyph,
- hb_ot_layout_glyph_class_t klass)
-{
- if (HB_OBJECT_IS_INERT (face))
- return;
-
- /* TODO optimize this? similar to old harfbuzz code for example */
-
- hb_ot_layout_t *layout = face->ot_layout;
- hb_ot_layout_class_t gdef_klass;
- unsigned int len = layout->new_gdef.len;
-
- if (unlikely (glyph > 65535))
- return;
-
- /* XXX this is not threadsafe */
- if (glyph >= len) {
- unsigned int new_len;
- unsigned char *new_klasses;
-
- new_len = len == 0 ? 120 : 2 * len;
- while (new_len <= glyph)
- new_len *= 2;
-
- if (new_len > 65536)
- new_len = 65536;
- new_klasses = (unsigned char *) realloc (layout->new_gdef.klasses, new_len * sizeof (unsigned char));
-
- if (unlikely (!new_klasses))
- return;
-
- memset (new_klasses + len, 0, new_len - len);
-
- layout->new_gdef.klasses = new_klasses;
- layout->new_gdef.len = new_len;
- }
-
- switch (klass) {
- default:
- case HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED: gdef_klass = GDEF::UnclassifiedGlyph; break;
- case HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH: gdef_klass = GDEF::BaseGlyph; break;
- case HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE: gdef_klass = GDEF::LigatureGlyph; break;
- case HB_OT_LAYOUT_GLYPH_CLASS_MARK: gdef_klass = GDEF::MarkGlyph; break;
- case HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT: gdef_klass = GDEF::ComponentGlyph; break;
- }
-
- layout->new_gdef.klasses[glyph] = gdef_klass;
- return;
-}
-
-void
-_hb_ot_layout_set_glyph_property (hb_face_t *face,
- hb_codepoint_t glyph,
- unsigned int property)
-{ _hb_ot_layout_set_glyph_class (face, glyph, (hb_ot_layout_glyph_class_t) (property & 0xff)); }
-
-
-hb_ot_layout_glyph_class_t
-hb_ot_layout_get_glyph_class (hb_face_t *face,
- hb_codepoint_t glyph)
-{
- return (hb_ot_layout_glyph_class_t) (_hb_ot_layout_get_glyph_property (face, glyph) & 0xff);
-}
-
-void
-hb_ot_layout_set_glyph_class (hb_face_t *face,
- hb_codepoint_t glyph,
- hb_ot_layout_glyph_class_t klass)
-{
- _hb_ot_layout_set_glyph_class (face, glyph, klass);
-}
-
-void
-hb_ot_layout_build_glyph_classes (hb_face_t *face,
- hb_codepoint_t *glyphs,
- unsigned char *klasses,
- uint16_t count)
-{
- if (HB_OBJECT_IS_INERT (face))
- return;
-
- hb_ot_layout_t *layout = face->ot_layout;
-
- if (unlikely (!count || !glyphs || !klasses))
- return;
-
- if (layout->new_gdef.len == 0) {
- layout->new_gdef.klasses = (unsigned char *) calloc (count, sizeof (unsigned char));
- layout->new_gdef.len = count;
- }
-
- for (unsigned int i = 0; i < count; i++)
- _hb_ot_layout_set_glyph_class (face, glyphs[i], (hb_ot_layout_glyph_class_t) klasses[i]);
-}
-
unsigned int
hb_ot_layout_get_attach_points (hb_face_t *face,
hb_codepoint_t glyph,
diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h
index 541b1914..58c0fbe3 100644
--- a/src/hb-ot-layout.h
+++ b/src/hb-ot-layout.h
@@ -44,35 +44,9 @@ HB_BEGIN_DECLS
* GDEF
*/
-typedef enum {
- HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0x0000,
- HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 0x0002,
- HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 0x0004,
- HB_OT_LAYOUT_GLYPH_CLASS_MARK = 0x0008,
- HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 0x0010
-} hb_ot_layout_glyph_class_t;
-
-/* XXX These should eventually be removed as we move synthesized glyph
- * classes in harfbuzz. */
-
hb_bool_t
hb_ot_layout_has_glyph_classes (hb_face_t *face);
-hb_ot_layout_glyph_class_t
-hb_ot_layout_get_glyph_class (hb_face_t *face,
- hb_codepoint_t glyph);
-
-void
-hb_ot_layout_set_glyph_class (hb_face_t *face,
- hb_codepoint_t glyph,
- hb_ot_layout_glyph_class_t klass);
-
-void
-hb_ot_layout_build_glyph_classes (hb_face_t *face,
- hb_codepoint_t *glyphs,
- unsigned char *klasses,
- uint16_t count);
-
/* Not that useful. Provides list of attach points for a glyph that a
* client may want to cache */
unsigned int
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 64a1a3de..06316bc9 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -163,6 +163,14 @@ hb_ensure_native_direction (hb_ot_shape_context_t *c)
}
}
+static void
+hb_reset_glyph_infos (hb_ot_shape_context_t *c)
+{
+ unsigned int count = c->buffer->len;
+ for (unsigned int i = 0; i < count; i++)
+ c->buffer->info[i].var1.u32 = c->buffer->info[i].var2.u32 = 0;
+}
+
/* Substitute */
@@ -278,6 +286,8 @@ hb_ot_shape_execute_internal (hb_ot_shape_context_t *c)
hb_ot_shape_setup_masks (c);
+ hb_reset_glyph_infos (c);
+
/* SUBSTITUTE */
{
/* Mirroring needs to see the original direction */