summaryrefslogtreecommitdiff
path: root/pango/pangofc-shape.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-08-12 17:51:25 +0000
committerMatthias Clasen <mclasen@redhat.com>2019-08-12 17:51:25 +0000
commit8b82959e0ea68e4b8421cd2ee99cb8c725f31fc0 (patch)
tree6d9cbb21f251ebe2a83a71c464926ab5d3962e02 /pango/pangofc-shape.c
parent24f7a9929ffc8170d9aa5bd429e6983c303eee2e (diff)
parent3e8a4e141810bc024c4e65bf03be7312da7601a0 (diff)
downloadpango-8b82959e0ea68e4b8421cd2ee99cb8c725f31fc0.tar.gz
Merge branch 'mark-offset' into 'master'
Fix vertical offsets Closes #408 See merge request GNOME/pango!130
Diffstat (limited to 'pango/pangofc-shape.c')
-rw-r--r--pango/pangofc-shape.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index 112aac03..5799e373 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -204,10 +204,10 @@ pango_hb_font_get_nominal_glyph (hb_font_t *font,
}
static hb_position_t
-pango_hb_font_get_glyph_advance (hb_font_t *font,
- void *font_data,
- hb_codepoint_t glyph,
- void *user_data G_GNUC_UNUSED)
+pango_hb_font_get_glyph_h_advance (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t glyph,
+ void *user_data G_GNUC_UNUSED)
{
PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
@@ -222,6 +222,25 @@ pango_hb_font_get_glyph_advance (hb_font_t *font,
return hb_font_get_glyph_h_advance (context->parent, glyph);
}
+static hb_position_t
+pango_hb_font_get_glyph_v_advance (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t glyph,
+ void *user_data G_GNUC_UNUSED)
+{
+ PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+
+ if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ {
+ PangoRectangle logical;
+
+ pango_font_get_glyph_extents (context->font, glyph, NULL, &logical);
+ return logical.height;
+ }
+
+ return hb_font_get_glyph_v_advance (context->parent, glyph);
+}
+
static hb_bool_t
pango_hb_font_get_glyph_extents (hb_font_t *font,
void *font_data,
@@ -262,8 +281,8 @@ 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_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_advance_func (funcs, pango_hb_font_get_glyph_h_advance, NULL, NULL);
+ hb_font_funcs_set_glyph_v_advance_func (funcs, pango_hb_font_get_glyph_v_advance, NULL, NULL);
hb_font_funcs_set_glyph_extents_func (funcs, pango_hb_font_get_glyph_extents, NULL, NULL);
hb_font_funcs_make_immutable (funcs);
@@ -390,17 +409,17 @@ pango_hb_shape (PangoFont *font,
for (i = 0; i < num_glyphs; i++)
{
/* 90 degrees rotation counter-clockwise. */
- infos[i].geometry.width = hb_position->y_advance;
- infos[i].geometry.x_offset = hb_position->y_offset;
- infos[i].geometry.y_offset = -hb_position->x_offset;
+ infos[i].geometry.width = hb_position->y_advance;
+ infos[i].geometry.x_offset = hb_position->y_offset;
+ infos[i].geometry.y_offset = - hb_position->x_offset;
hb_position++;
}
else /* horizontal */
for (i = 0; i < num_glyphs; i++)
{
- infos[i].geometry.width = hb_position->x_advance;
- infos[i].geometry.x_offset = hb_position->x_offset;
- infos[i].geometry.y_offset = hb_position->y_offset;
+ infos[i].geometry.width = hb_position->x_advance;
+ infos[i].geometry.x_offset = hb_position->x_offset;
+ infos[i].geometry.y_offset = - hb_position->y_offset;
hb_position++;
}