[pango/userfont: 9/15] examples: Adapt
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/userfont: 9/15] examples: Adapt
- Date: Fri, 28 Jan 2022 14:04:51 +0000 (UTC)
commit 256084aff7588e9ba3870d50f5c0b8d5089911a9
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jan 28 00:14:13 2022 -0500
examples: Adapt
examples/cairoshape.c | 18 +++++++++---------
examples/userfont.c | 30 ++++++++++++++----------------
2 files changed, 23 insertions(+), 25 deletions(-)
---
diff --git a/examples/cairoshape.c b/examples/cairoshape.c
index 92a73d11..07d62f44 100644
--- a/examples/cairoshape.c
+++ b/examples/cairoshape.c
@@ -173,8 +173,8 @@ draw_text (cairo_t *cr, int *width, int *height)
}
static gboolean
-glyph_cb (PangoHbFace *face,
- hb_codepoint_t unicode,
+glyph_cb (PangoUserFace *face,
+ hb_codepoint_t unicode,
hb_codepoint_t *glyph,
gpointer data)
{
@@ -188,7 +188,7 @@ glyph_cb (PangoHbFace *face,
}
static hb_position_t
-advance_cb (PangoHbFace *face,
+advance_cb (PangoUserFace *face,
int size,
hb_codepoint_t glyph,
gpointer user_data)
@@ -200,7 +200,7 @@ advance_cb (PangoHbFace *face,
}
static gboolean
-extents_cb (PangoHbFace *face,
+extents_cb (PangoUserFace *face,
int size,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents,
@@ -219,7 +219,7 @@ extents_cb (PangoHbFace *face,
}
static void
-font_extents_cb (PangoHbFace *face,
+font_extents_cb (PangoUserFace *face,
int size,
hb_font_extents_t *extents,
gpointer user_data)
@@ -230,7 +230,7 @@ font_extents_cb (PangoHbFace *face,
}
static void
-render_cb (PangoHbFace *face,
+render_cb (PangoUserFace *face,
int size,
hb_codepoint_t glyph,
gpointer user_data,
@@ -253,7 +253,7 @@ static void
setup_fontmap (PangoHbFontMap *fontmap)
{
PangoFontDescription *desc;
- PangoHbFace *face;
+ PangoUserFace *face;
desc = pango_font_description_from_string ("Bullets");
pango_font_description_unset_fields (desc,
PANGO_FONT_MASK_VARIANT|PANGO_FONT_MASK_SIZE|PANGO_FONT_MASK_GRAVITY);
@@ -261,8 +261,8 @@ setup_fontmap (PangoHbFontMap *fontmap)
face = pango_hb_face_new_from_file ("/usr/share/fonts/adobe-source-code-pro/SourceCodePro-Black.otf",
0, -1, "Black", desc);
#endif
- face = pango_hb_face_new_user (font_extents_cb, glyph_cb, advance_cb, extents_cb, render_cb, NULL, NULL,
"Black", desc);
- pango_hb_font_map_add_face (fontmap, face);
+ face = pango_user_face_new (font_extents_cb, glyph_cb, advance_cb, extents_cb, render_cb, NULL, NULL,
"Black", desc);
+ pango_hb_font_map_add_face (fontmap, PANGO_FONT_FACE (face));
pango_font_description_free (desc);
}
diff --git a/examples/userfont.c b/examples/userfont.c
index 9d185b55..2d5773df 100644
--- a/examples/userfont.c
+++ b/examples/userfont.c
@@ -95,7 +95,7 @@ get_layout (cairo_t *cr)
}
static gboolean
-glyph_cb (PangoHbFace *face,
+glyph_cb (PangoUserFace *face,
hb_codepoint_t unicode,
hb_codepoint_t *glyph,
gpointer user_data)
@@ -115,7 +115,7 @@ glyph_cb (PangoHbFace *face,
}
static hb_position_t
-advance_cb (PangoHbFace *face,
+advance_cb (PangoUserFace *face,
int size,
hb_codepoint_t glyph,
gpointer user_data)
@@ -125,8 +125,8 @@ advance_cb (PangoHbFace *face,
return glyphs[glyph].width / 4.0 * size;
}
-static gboolean
-font_extents_cb (PangoHbFace *face,
+static void
+font_extents_cb (PangoUserFace *face,
int size,
hb_font_extents_t *extents,
gpointer user_data)
@@ -134,12 +134,10 @@ font_extents_cb (PangoHbFace *face,
extents->ascender = 0.75 * size;
extents->descender = 0.25 * size;
extents->line_gap = 0;
-
- return TRUE;
}
static gboolean
-glyph_extents_cb (PangoHbFace *face,
+glyph_extents_cb (PangoUserFace *face,
int size,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents,
@@ -154,7 +152,7 @@ glyph_extents_cb (PangoHbFace *face,
}
static void
-render_cb (PangoHbFace *face,
+render_cb (PangoUserFace *face,
int size,
hb_codepoint_t glyph,
gpointer user_data,
@@ -198,17 +196,17 @@ static void
setup_fontmap (PangoHbFontMap *fontmap)
{
PangoFontDescription *desc;
- PangoHbFace *face;
+ PangoUserFace *face;
desc = pango_font_description_new ();
pango_font_description_set_family (desc, "Userfont");
- face = pango_hb_face_new_user (font_extents_cb,
- glyph_cb,
- advance_cb,
- glyph_extents_cb,
- render_cb,
- (gpointer) glyphs, NULL,
- "Black", desc);
+ face = pango_user_face_new (font_extents_cb,
+ glyph_cb,
+ advance_cb,
+ glyph_extents_cb,
+ render_cb,
+ (gpointer) glyphs, NULL,
+ "Black", desc);
pango_hb_font_map_add_face (fontmap, face);
pango_font_description_free (desc);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]