diff --git a/src/hb-ot-color.cc b/src/hb-ot-color.cc index 84035069c221b5fd24c78c797406450de167be67..a2b753833f160dffcaefdee5ed616f667104d7c6 100644 --- a/src/hb-ot-color.cc +++ b/src/hb-ot-color.cc @@ -310,15 +310,21 @@ hb_ot_color_glyph_reference_blob_png (hb_font_t *font, unsigned int *strike_x_ppem /* OUT */, unsigned int *strike_y_ppem /* OUT */) { - if (_get_cbdt (font->face).has_data ()) - return _get_cbdt (font->face).reference_blob_for_glyph (glyph, font->x_ppem, font->y_ppem, + hb_blob_t *blob = hb_blob_get_empty (); + /* don't run cbdt first if aat is set */ + if (!hb_options ().aat && _get_cbdt (font->face).has_data ()) + blob = _get_cbdt (font->face).reference_blob_for_glyph (glyph, font->x_ppem, font->y_ppem, strike_x_ppem, strike_y_ppem); - if (_get_sbix (font->face).has_data ()) - return _get_sbix (font->face).reference_blob_for_glyph (glyph, font->ptem, + if (_get_sbix (font->face).has_data () && !hb_blob_get_length (blob)) + blob = _get_sbix (font->face).reference_blob_for_glyph (glyph, font->ptem, MAX (font->x_ppem, font->y_ppem), HB_TAG('p','n','g',' '), strike_x_ppem, strike_y_ppem); - return hb_blob_get_empty (); + if (hb_options ().aat && _get_cbdt (font->face).has_data () && !hb_blob_get_length (blob)) + blob = _get_cbdt (font->face).reference_blob_for_glyph (glyph, font->x_ppem, font->y_ppem, + strike_x_ppem, strike_y_ppem); + + return blob; }