[pango/simple-fontmap: 3/15] coverage: Add a constructor from hb_face_t
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/simple-fontmap: 3/15] coverage: Add a constructor from hb_face_t
- Date: Sun, 31 Oct 2021 23:51:10 +0000 (UTC)
commit e6e0f2be3565d6e02e79795cfe15bdb6aa835493
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 29 19:01:50 2021 -0400
coverage: Add a constructor from hb_face_t
Add private API to create a PangoCoverage object
from a hb_face_t. This will be used in future commits.
pango/pango-coverage-private.h | 2 ++
pango/pango-coverage.c | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+)
---
diff --git a/pango/pango-coverage-private.h b/pango/pango-coverage-private.h
index af86ab00..4f7e79ea 100644
--- a/pango/pango-coverage-private.h
+++ b/pango/pango-coverage-private.h
@@ -56,6 +56,8 @@ struct _PangoCoverageClass
PangoCoverage * (* copy) (PangoCoverage *coverage);
};
+PangoCoverage *pango_coverage_new_for_hb_face (hb_face_t *hb_face);
+
G_END_DECLS
#endif /* __PANGO_COVERAGE_PRIVATE_H__ */
diff --git a/pango/pango-coverage.c b/pango/pango-coverage.c
index 331cd1dc..19d175de 100644
--- a/pango/pango-coverage.c
+++ b/pango/pango-coverage.c
@@ -119,6 +119,27 @@ pango_coverage_new (void)
return g_object_new (PANGO_TYPE_COVERAGE, NULL);
}
+/*< private>
+ * pango_coverage_new_for_hb_face:
+ * @hb_face: a `hb_face_t`
+ *
+ * Creates a new `PangoCoverage` for the given @hb_face.
+ *
+ * Returns: the newly allocated `PangoCoverage`
+ */
+PangoCoverage *
+pango_coverage_new_for_hb_face (hb_face_t *hb_face)
+{
+ PangoCoverage *coverage;
+
+ coverage = g_object_new (PANGO_TYPE_COVERAGE, NULL);
+
+ coverage->chars = hb_set_create ();
+ hb_face_collect_unicodes (hb_face, coverage->chars);
+
+ return coverage;
+}
+
/**
* pango_coverage_copy:
* @coverage: a `PangoCoverage`
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]