[pango/coverage-redo: 1/4] Add pango_font_covers
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/coverage-redo: 1/4] Add pango_font_covers
- Date: Fri, 12 Jul 2019 02:06:38 +0000 (UTC)
commit 481e1be4647f691139d953b91ad81b88e0dc6f3b
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jul 9 14:50:19 2019 -0400
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.
docs/pango-sections.txt | 1 +
pango/fonts.c | 21 +++++++++++++++++++++
pango/pango-font-private.h | 1 -
pango/pango-font.h | 3 +++
4 files changed, 25 insertions(+), 1 deletion(-)
---
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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]