[HarfBuzz] harfbuzz: Branch 'master' - 2 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Thu Oct 8 09:51:40 PDT 2015
src/hb-font.cc | 26 ++++++++++++++++++++++++++
src/hb-font.h | 4 ++++
src/hb-ft.cc | 18 ++++++++++++++++++
test/api/test-font.c | 12 ++++++++++++
4 files changed, 60 insertions(+)
New commits:
commit 3e905e396bcd745bda88e751998a76556c5cb8c6
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Oct 8 12:51:02 2015 -0400
Add hb_font_set_parent()
No reason to not have it. Makes life easier later.
We (hb-ft, hb-ot-font, etc) can use this API to inject new
parent into a font...
diff --git a/src/hb-font.cc b/src/hb-font.cc
index 058d7ec..6a69cae 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -1059,6 +1059,32 @@ hb_font_is_immutable (hb_font_t *font)
}
/**
+ * hb_font_set_parent:
+ * @font: a font.
+ * @parent: new parent.
+ *
+ * Sets parent font of @font.
+ *
+ * Since: 1.0.5
+ **/
+void
+hb_font_set_parent (hb_font_t *font,
+ hb_font_t *parent)
+{
+ if (font->immutable)
+ return;
+
+ if (!parent)
+ parent = hb_font_get_empty ();
+
+ hb_font_t *old = font->parent;
+
+ font->parent = hb_font_reference (parent);
+
+ hb_font_destroy (old);
+}
+
+/**
* hb_font_get_parent:
* @font: a font.
*
diff --git a/src/hb-font.h b/src/hb-font.h
index ffb2010..fb4a0ea 100644
--- a/src/hb-font.h
+++ b/src/hb-font.h
@@ -459,6 +459,10 @@ hb_font_make_immutable (hb_font_t *font);
hb_bool_t
hb_font_is_immutable (hb_font_t *font);
+void
+hb_font_set_parent (hb_font_t *font,
+ hb_font_t *parent);
+
hb_font_t *
hb_font_get_parent (hb_font_t *font);
diff --git a/test/api/test-font.c b/test/api/test-font.c
index 5afc885..ef5b08f 100644
--- a/test/api/test-font.c
+++ b/test/api/test-font.c
@@ -387,6 +387,18 @@ test_font_properties (void)
g_assert (hb_font_get_face (font) == face);
g_assert (hb_font_get_parent (font) == NULL);
+ subfont = hb_font_create_sub_font (font);
+ g_assert (hb_font_get_parent (subfont) == font);
+ hb_font_set_parent(subfont, NULL);
+ g_assert (hb_font_get_parent (subfont) == hb_font_get_empty());
+ hb_font_set_parent(subfont, font);
+ g_assert (hb_font_get_parent (subfont) == font);
+ hb_font_set_parent(subfont, NULL);
+ hb_font_make_immutable (subfont);
+ g_assert (hb_font_get_parent (subfont) == hb_font_get_empty());
+ hb_font_set_parent(subfont, font);
+ g_assert (hb_font_get_parent (subfont) == hb_font_get_empty());
+ hb_font_destroy (subfont);
/* Check scale */
commit edeb3dabf4a589d67c3f1da7ba43a74e4d3a9afd
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Oct 8 12:47:15 2015 -0400
[ft] Add version for new API
diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 1acfecc..b695f81 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -98,6 +98,15 @@ _hb_ft_font_destroy (hb_ft_font_t *ft_font)
free (ft_font);
}
+/**
+ * hb_ft_font_set_load_flags:
+ * @font:
+ * @load_flags:
+ *
+ *
+ *
+ * Since: 1.0.5
+ **/
void
hb_ft_font_set_load_flags (hb_font_t *font, int load_flags)
{
@@ -112,6 +121,15 @@ hb_ft_font_set_load_flags (hb_font_t *font, int load_flags)
ft_font->load_flags = load_flags;
}
+/**
+ * hb_ft_font_get_load_flags:
+ * @font:
+ *
+ *
+ *
+ * Return value:
+ * Since: 1.0.5
+ **/
int
hb_ft_font_get_load_flags (hb_font_t *font)
{
More information about the HarfBuzz
mailing list