Implement hb_ot_layout_get_glyph_class()
diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh
index 92ae1cf..e7fb42f 100644
--- a/src/hb-ot-layout-gdef-table.hh
+++ b/src/hb-ot-layout-gdef-table.hh
@@ -383,13 +383,13 @@
switch (klass) {
default:
- case UnclassifiedGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED;
- case BaseGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
- case LigatureGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE;
- case ComponentGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT;
+ case UnclassifiedGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_UNCLASSIFIED;
+ case BaseGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH;
+ case LigatureGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE;
+ case ComponentGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_COMPONENT;
case MarkGlyph:
klass = get_mark_attachment_type (glyph);
- return HB_OT_LAYOUT_GLYPH_CLASS_MARK | (klass << 8);
+ return HB_OT_LAYOUT_GLYPH_PROPS_MARK | (klass << 8);
}
}
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 41cb93d..d0f228d 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -863,7 +863,7 @@
TRACE_APPLY ();
/* We don't handle mark glyphs here. */
- if (c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK) return TRACE_RETURN (false);
+ if (c->property & HB_OT_LAYOUT_GLYPH_PROPS_MARK) return TRACE_RETURN (false);
hb_apply_context_t::mark_skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1);
if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false);
@@ -1030,7 +1030,7 @@
} while (1);
/* The following assertion is too strong, so we've disabled it. */
- if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH)) {/*return TRACE_RETURN (false);*/}
+ if (!(property & HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH)) {/*return TRACE_RETURN (false);*/}
unsigned int base_index = (this+baseCoverage) (c->buffer->info[skippy_iter.idx].codepoint);
if (base_index == NOT_COVERED) return TRACE_RETURN (false);
@@ -1136,7 +1136,7 @@
if (!skippy_iter.prev (&property, LookupFlag::IgnoreMarks)) return TRACE_RETURN (false);
/* The following assertion is too strong, so we've disabled it. */
- if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)) {/*return TRACE_RETURN (false);*/}
+ if (!(property & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE)) {/*return TRACE_RETURN (false);*/}
unsigned int j = skippy_iter.idx;
unsigned int lig_index = (this+ligatureCoverage) (c->buffer->info[j].codepoint);
@@ -1258,7 +1258,7 @@
hb_apply_context_t::mark_skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1);
if (!skippy_iter.prev (&property)) return TRACE_RETURN (false);
- if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)) return TRACE_RETURN (false);
+ if (!(property & HB_OT_LAYOUT_GLYPH_PROPS_MARK)) return TRACE_RETURN (false);
unsigned int j = skippy_iter.idx;
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 05b18cc..e5058c6 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -266,7 +266,7 @@
TRACE_APPLY ();
if (unlikely (!substitute.len)) return TRACE_RETURN (false);
- unsigned int klass = c->property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE ? HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH : 0;
+ unsigned int klass = c->property & 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);
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index dd7bdd3..dd0ef63 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -264,7 +264,7 @@
if (glyph_props & lookup_props & LookupFlag::IgnoreFlags)
return false;
- if (unlikely (glyph_props & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
+ if (unlikely (glyph_props & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
return match_properties_mark (glyph, glyph_props, lookup_props);
return true;
@@ -295,7 +295,7 @@
*property_out = property;
/* If it's a mark, skip it if we don't accept it. */
- if (unlikely (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK))
+ if (unlikely (property & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
return !match_properties (info->codepoint, property, lookup_props);
/* If not a mark, don't skip. */
@@ -445,7 +445,7 @@
* ligate with a conjunct...)
*/
- bool is_mark_ligature = !!(c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
+ bool is_mark_ligature = !!(c->property & HB_OT_LAYOUT_GLYPH_PROPS_MARK);
unsigned int total_component_count = 0;
total_component_count += get_lig_num_comps (c->buffer->cur());
@@ -478,7 +478,7 @@
return TRACE_RETURN (false);
}
- is_mark_ligature = is_mark_ligature && (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
+ is_mark_ligature = is_mark_ligature && (property & HB_OT_LAYOUT_GLYPH_PROPS_MARK);
total_component_count += get_lig_num_comps (c->buffer->info[skippy_iter.idx]);
}
@@ -530,7 +530,7 @@
* https://bugzilla.gnome.org/show_bug.cgi?id=437633
*/
- unsigned int klass = is_mark_ligature ? 0 : HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE;
+ unsigned int klass = is_mark_ligature ? 0 : HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE;
unsigned int lig_id = is_mark_ligature ? 0 : allocate_lig_id (c->buffer);
unsigned int last_lig_id = get_lig_id (c->buffer->cur());
unsigned int last_num_components = get_lig_num_comps (c->buffer->cur());
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index 055933f..49093de 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -49,6 +49,14 @@
* GDEF
*/
+typedef enum {
+ HB_OT_LAYOUT_GLYPH_PROPS_UNCLASSIFIED = 0x0001,
+ HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH = 0x0002,
+ HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE = 0x0004,
+ HB_OT_LAYOUT_GLYPH_PROPS_MARK = 0x0008,
+ HB_OT_LAYOUT_GLYPH_PROPS_COMPONENT = 0x0010
+} hb_ot_layout_glyph_class_mask_t;
+
/*
@@ -115,7 +123,7 @@
static inline unsigned int
get_lig_num_comps (const hb_glyph_info_t &info)
{
- if ((info.glyph_props() & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE) && is_a_ligature (info))
+ if ((info.glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE) && is_a_ligature (info))
return info.lig_props() & 0x0F;
else
return 1;
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index e57b765..8b827a6 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -121,6 +121,12 @@
return _get_gdef (face).has_glyph_classes ();
}
+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) _get_gdef (face).get_glyph_class (glyph);
+}
unsigned int
hb_ot_layout_get_attach_points (hb_face_t *face,
diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h
index 7b53367..0128534 100644
--- a/src/hb-ot-layout.h
+++ b/src/hb-ot-layout.h
@@ -51,18 +51,16 @@
hb_ot_layout_has_glyph_classes (hb_face_t *face);
typedef enum {
- HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0x0001,
- 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 = 0,
+ HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 1,
+ HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 2,
+ HB_OT_LAYOUT_GLYPH_CLASS_MARK = 3,
+ HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 4
} hb_ot_layout_glyph_class_t;
-#ifdef HB_NOT_IMPLEMENTED
hb_ot_layout_glyph_class_t
-Xhb_ot_layout_get_glyph_class (hb_face_t *face,
+hb_ot_layout_get_glyph_class (hb_face_t *face,
hb_codepoint_t glyph);
-#endif
#ifdef HB_NOT_IMPLEMENTED
Xhb_ot_layout_get_glyphs_in_class (hb_face_t *face,
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 8601127..2259b94 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -348,8 +348,8 @@
unsigned int count = c->buffer->len;
for (unsigned int i = 0; i < count; i++)
c->buffer->info[i].glyph_props() = _hb_glyph_info_get_general_category (&c->buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK ?
- HB_OT_LAYOUT_GLYPH_CLASS_MARK :
- HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
+ HB_OT_LAYOUT_GLYPH_PROPS_MARK :
+ HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH;
}
static inline void