Add font->has_glyph()
diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh
index 431d047..33bbf71 100644
--- a/src/hb-font-private.hh
+++ b/src/hb-font-private.hh
@@ -144,6 +144,12 @@
/* Public getters */
+ inline hb_bool_t has_glyph (hb_codepoint_t unicode)
+ {
+ hb_codepoint_t glyph;
+ return get_glyph (unicode, 0, &glyph);
+ }
+
inline hb_bool_t get_glyph (hb_codepoint_t unicode, hb_codepoint_t variation_selector,
hb_codepoint_t *glyph)
{
diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc
index 1d79c43..7353848 100644
--- a/src/hb-ot-shape-complex-hangul.cc
+++ b/src/hb-ot-shape-complex-hangul.cc
@@ -145,8 +145,7 @@
if (len)
{
hb_codepoint_t s = SBase + (l - LBase) * NCount + (v - VBase) * TCount + tindex;
- hb_codepoint_t glyph;
- if (font->get_glyph (s, 0, &glyph))
+ if (font->has_glyph (s))
{
buffer->replace_glyphs (len, 1, &s);
if (unlikely (buffer->in_error))
@@ -161,8 +160,7 @@
{
/* Have <LV>, <LVT>, or <LV,T> */
hb_codepoint_t s = u;
- hb_codepoint_t glyph;
- bool has_glyph = font->get_glyph (s, 0, &glyph);
+ bool has_glyph = font->has_glyph (s);
unsigned int lindex = (s - SBase) / NCount;
unsigned int nindex = (s - SBase) % NCount;
unsigned int vindex = nindex / TCount;
@@ -175,7 +173,7 @@
/* <LV,T>, try to combine. */
unsigned int new_tindex = buffer->cur(+1).codepoint - TBase;
hb_codepoint_t new_s = s + new_tindex;
- if (font->get_glyph (new_s, 0, &glyph))
+ if (font->has_glyph (new_s))
{
buffer->replace_glyphs (2, 1, &new_s);
if (unlikely (buffer->in_error))
@@ -195,9 +193,9 @@
hb_codepoint_t decomposed[3] = {LBase + lindex,
VBase + vindex,
TBase + tindex};
- if (font->get_glyph (decomposed[0], 0, &glyph) &&
- font->get_glyph (decomposed[1], 0, &glyph) &&
- (!tindex || font->get_glyph (decomposed[2], 0, &glyph)))
+ if (font->has_glyph (decomposed[0]) &&
+ font->has_glyph (decomposed[1]) &&
+ (!tindex || font->has_glyph (decomposed[2])))
{
buffer->replace_glyphs (1, tindex ? 3 : 2, decomposed);
if (unlikely (buffer->in_error))
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index fcc61ae..3080a1d 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -238,8 +238,7 @@
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
return;
- hb_codepoint_t dottedcircle_glyph;
- if (!font->get_glyph (0x25CC, 0, &dottedcircle_glyph))
+ if (!font->has_glyph (0x25CC))
return;
hb_glyph_info_t dottedcircle;