提交 8de20b1e 编写于 作者: B Behdad Esfahbod

Add font->has_glyph()

上级 f6298e55
......@@ -144,6 +144,12 @@ struct hb_font_t {
/* 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)
{
......
......@@ -145,8 +145,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
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 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
{
/* 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 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
/* <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 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
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))
......
......@@ -238,8 +238,7 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font)
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册