summaryrefslogtreecommitdiff
path: root/pango/pangofc-shape.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-08-01 23:00:09 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-08-01 23:03:10 -0400
commit5590b99fb6369cd16110bce2a3e8ac6371c3c487 (patch)
treeabe5c2b12776841705513c4646a1ee152af6a63b /pango/pangofc-shape.c
parent6e70241de63ba7d4412419154142bb5e84995edd (diff)
downloadpango-5590b99fb6369cd16110bce2a3e8ac6371c3c487.tar.gz
Revert "shape: Simplify font function"
This reverts commit 315e3d4f6182e4cefde3538ede222e53c000f3e8. This made pango-view segfault in win32 ci.
Diffstat (limited to 'pango/pangofc-shape.c')
-rw-r--r--pango/pangofc-shape.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index 2e9806b8..c2ef2b8f 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -203,6 +203,37 @@ pango_hb_font_get_nominal_glyph (hb_font_t *font,
return FALSE;
}
+static hb_bool_t
+pango_hb_font_get_variation_glyph (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t unicode,
+ hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph,
+ void *user_data G_GNUC_UNUSED)
+{
+ PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+
+ if (hb_font_get_glyph (context->parent,
+ unicode, variation_selector, glyph))
+ return TRUE;
+
+ return FALSE;
+}
+
+static hb_bool_t
+pango_hb_font_get_glyph_contour_point (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t glyph,
+ unsigned int point_index,
+ hb_position_t *x,
+ hb_position_t *y,
+ void *user_data G_GNUC_UNUSED)
+{
+ PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+
+ return hb_font_get_glyph_contour_point (context->parent, glyph, point_index, x, y);
+}
+
static hb_position_t
pango_hb_font_get_glyph_advance (hb_font_t *font,
void *font_data,
@@ -248,6 +279,44 @@ pango_hb_font_get_glyph_extents (hb_font_t *font,
return hb_font_get_glyph_extents (context->parent, glyph, extents);
}
+static hb_bool_t
+pango_hb_font_get_glyph_h_origin (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t glyph,
+ hb_position_t *x,
+ hb_position_t *y,
+ void *user_data G_GNUC_UNUSED)
+{
+ PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+
+ return hb_font_get_glyph_h_origin (context->parent, glyph, x, y);
+}
+
+static hb_bool_t
+pango_hb_font_get_glyph_v_origin (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t glyph,
+ hb_position_t *x,
+ hb_position_t *y,
+void *user_data G_GNUC_UNUSED)
+{
+ PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+
+ return hb_font_get_glyph_v_origin (context->parent, glyph, x, y);
+}
+
+static hb_position_t
+pango_hb_font_get_h_kerning (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t left_glyph,
+ hb_codepoint_t right_glyph,
+ void *user_data G_GNUC_UNUSED)
+{
+ PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+
+ return hb_font_get_glyph_h_kerning (context->parent, left_glyph, right_glyph);
+}
+
static hb_font_t *
pango_font_get_hb_font_for_context (PangoFont *font,
PangoHbShapeContext *context)
@@ -262,9 +331,14 @@ pango_font_get_hb_font_for_context (PangoFont *font,
funcs = hb_font_funcs_create ();
hb_font_funcs_set_nominal_glyph_func (funcs, pango_hb_font_get_nominal_glyph, NULL, NULL);
+ hb_font_funcs_set_variation_glyph_func (funcs, pango_hb_font_get_variation_glyph, NULL, NULL);
hb_font_funcs_set_glyph_h_advance_func (funcs, pango_hb_font_get_glyph_advance, NULL, NULL);
hb_font_funcs_set_glyph_v_advance_func (funcs, pango_hb_font_get_glyph_advance, NULL, NULL);
+ hb_font_funcs_set_glyph_h_origin_func (funcs, pango_hb_font_get_glyph_h_origin, NULL, NULL);
+ hb_font_funcs_set_glyph_v_origin_func (funcs, pango_hb_font_get_glyph_v_origin, NULL, NULL);
+ hb_font_funcs_set_glyph_h_kerning_func (funcs, pango_hb_font_get_h_kerning, NULL, NULL);
hb_font_funcs_set_glyph_extents_func (funcs, pango_hb_font_get_glyph_extents, NULL, NULL);
+ hb_font_funcs_set_glyph_contour_point_func (funcs, pango_hb_font_get_glyph_contour_point, NULL, NULL);
hb_font_funcs_make_immutable (funcs);
}