diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-08-27 22:02:14 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-08-28 21:01:21 -0400 |
commit | 6924489203c20e5462ed19ee714c53b02393f1b0 (patch) | |
tree | ec85c0850601bc5ca56226d8d70d2d0a5ebe40d0 | |
parent | 1d6ef80242e16c5974dddd0a92727c0e6d97407a (diff) | |
download | pango-6924489203c20e5462ed19ee714c53b02393f1b0.tar.gz |
font: Add a vfunc for pango_font_has_char
-rw-r--r-- | pango/fonts.c | 18 | ||||
-rw-r--r-- | pango/pango-font-private.h | 2 |
2 files changed, 16 insertions, 4 deletions
diff --git a/pango/fonts.c b/pango/fonts.c index 45d05b38..f144097d 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -1727,6 +1727,16 @@ pango_font_default_get_scale_factors (PangoFont *font, *x_scale = *y_scale = 1.0; } +static gboolean +pango_font_default_has_char (PangoFont *font, + gunichar wc) +{ + PangoCoverage *coverage = pango_font_get_coverage (font, pango_language_get_default ()); + PangoCoverageLevel result = pango_coverage_get (coverage, wc); + pango_coverage_unref (coverage); + return result != PANGO_COVERAGE_NONE; +} + static void pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED) { @@ -1740,6 +1750,7 @@ pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED) pclass->get_languages = pango_font_default_get_languages; pclass->is_hinted = pango_font_default_is_hinted; pclass->get_scale_factors = pango_font_default_get_scale_factors; + pclass->has_char = pango_font_default_has_char; } static void @@ -2626,10 +2637,9 @@ gboolean pango_font_has_char (PangoFont *font, gunichar wc) { - PangoCoverage *coverage = pango_font_get_coverage (font, pango_language_get_default ()); - PangoCoverageLevel result = pango_coverage_get (coverage, wc); - pango_coverage_unref (coverage); - return result != PANGO_COVERAGE_NONE; + PangoFontClassPrivate *pclass = PANGO_FONT_GET_CLASS_PRIVATE (font); + + return pclass->has_char (font, wc); } /** diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h index d9845fab..1f31f559 100644 --- a/pango/pango-font-private.h +++ b/pango/pango-font-private.h @@ -42,6 +42,8 @@ typedef struct { double *x_scale, double *y_scale); + gboolean (* has_char) (PangoFont *font, + gunichar wc); } PangoFontClassPrivate; gboolean pango_font_is_hinted (PangoFont *font); |