diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-09-17 23:31:41 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-09-17 23:31:41 +0000 |
commit | a1adaac69b825e14953644c5901c7e0f4580890e (patch) | |
tree | 51141afec5c0a22340c8c8c8f4875f857392b278 | |
parent | e9cf8c6cc766f3314097ae8a01f19dadee1b6b74 (diff) | |
parent | 2c8e55605bbf8809d3d9674a6dc0d684c0312a62 (diff) | |
download | gtk+-a1adaac69b825e14953644c5901c7e0f4580890e.tar.gz |
Merge branch 'glyph-clipping-fixes' into 'master'
gtk-demo: Improve ink extents rendering
See merge request GNOME/gtk!3969
-rw-r--r-- | demos/gtk-demo/fontrendering.c | 11 | ||||
-rw-r--r-- | demos/gtk-demo/fontrendering.ui | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/demos/gtk-demo/fontrendering.c b/demos/gtk-demo/fontrendering.c index 97eff2f597..001b36ca60 100644 --- a/demos/gtk-demo/fontrendering.c +++ b/demos/gtk-demo/fontrendering.c @@ -37,7 +37,7 @@ update_image (void) const char *text; PangoFontDescription *desc; PangoLayout *layout; - PangoRectangle ink, pink, logical; + PangoRectangle ink, logical; int baseline; cairo_surface_t *surface; cairo_t *cr; @@ -94,7 +94,6 @@ update_image (void) pango_layout_set_font_description (layout, desc); pango_layout_set_text (layout, text, -1); pango_layout_get_extents (layout, &ink, &logical); - pink = ink; baseline = pango_layout_get_baseline (layout); pango_extents_to_pixels (&ink, NULL); @@ -165,10 +164,10 @@ update_image (void) cairo_stroke (cr); cairo_set_source_rgb (cr, 1, 0, 0); cairo_rectangle (cr, - scale * (10 + pango_units_to_double (pink.x)) + 0.5, - scale * (10 + pango_units_to_double (pink.y)) + 0.5, - scale * pango_units_to_double (pink.width) - 1, - scale * pango_units_to_double (pink.height) - 1); + scale * (10 + ink.x) - 0.5, + scale * (10 + ink.y) - 0.5, + scale * ink.width + 1, + scale * ink.height + 1); cairo_stroke (cr); } diff --git a/demos/gtk-demo/fontrendering.ui b/demos/gtk-demo/fontrendering.ui index 44b65c9a19..a28491a85a 100644 --- a/demos/gtk-demo/fontrendering.ui +++ b/demos/gtk-demo/fontrendering.ui @@ -177,6 +177,8 @@ <child> <object class="GtkButton" id="up_button"> <property name="icon-name">list-add-symbolic</property> + <property name="halign">center</property> + <property name="valign">center</property> <style> <class name="circular"/> </style> @@ -200,6 +202,8 @@ <child> <object class="GtkButton" id="down_button"> <property name="icon-name">list-remove-symbolic</property> + <property name="halign">center</property> + <property name="valign">center</property> <style> <class name="circular"/> </style> |