summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-07-09 14:50:19 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-07-11 22:02:07 -0400
commit481e1be4647f691139d953b91ad81b88e0dc6f3b (patch)
treed80018ddd80bb53dd588892178cc323087b9ca27
parentcdeb8308ff13f7c6c4bc583b803bb13e5224277c (diff)
downloadpango-481e1be4647f691139d953b91ad81b88e0dc6f3b.tar.gz
Add pango_font_covers
Add a pango_font_covers function, which is like pango_shape_engine_covers, without the engine. This api is simpler than PangoCoverage in that it does not take a language as input, and only returns a boolean. This matches the harfbuzz api.
-rw-r--r--docs/pango-sections.txt1
-rw-r--r--pango/fonts.c21
-rw-r--r--pango/pango-font-private.h1
-rw-r--r--pango/pango-font.h3
4 files changed, 25 insertions, 1 deletions
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index 61823711..0fc648af 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -232,6 +232,7 @@ pango_font_find_shaper
pango_font_describe
pango_font_describe_with_absolute_size
pango_font_get_coverage
+pango_font_covers
pango_font_get_glyph_extents
pango_font_get_metrics
pango_font_get_font_map
diff --git a/pango/fonts.c b/pango/fonts.c
index f273cd26..2dd39f2e 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -2306,3 +2306,24 @@ pango_font_face_list_sizes (PangoFontFace *face,
*n_sizes = 0;
}
}
+
+/**
+ * pango_font_covers:
+ * @font: a #PangoFont
+ * @wc: a Unicode character
+ *
+ * Returns whether the font provides a glyph for this character.
+ *
+ * Returns %TRUE if @font can render @wc
+ *
+ * Since: 1.44
+ */
+gboolean
+pango_font_covers (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;
+}
diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h
index 44d19dee..5d7bb4de 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -30,7 +30,6 @@
G_BEGIN_DECLS
-
PANGO_AVAILABLE_IN_ALL
PangoFontMetrics *pango_font_metrics_new (void);
diff --git a/pango/pango-font.h b/pango/pango-font.h
index ceaf9643..84d4e122 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -484,6 +484,9 @@ void pango_font_get_glyph_extents (PangoFont *font,
PANGO_AVAILABLE_IN_1_10
PangoFontMap *pango_font_get_font_map (PangoFont *font);
+PANGO_AVAILABLE_IN_1_44
+gboolean pango_font_covers (PangoFont *font,
+ gunichar unichar);
/**
* PANGO_GLYPH_EMPTY: