diff options
author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2017-09-02 03:57:28 +0200 |
---|---|---|
committer | Marco Trevisan <mail@3v1n0.net> | 2019-03-01 17:46:49 +0000 |
commit | af3662775eddc32bbc7265b5c176704563e676e9 (patch) | |
tree | 3b28d56bb8d99834056180929a4762129dda579c /clutter/tests/conform/text.c | |
parent | 9234777e36212eeb7a676bd2787d5e87bfea6079 (diff) | |
download | mutter-af3662775eddc32bbc7265b5c176704563e676e9.tar.gz |
clutter/text: Generate resource scaled text and paint it at proper scaling
When resource scale is set we need to generate a scaled PangoLayout (by adding
a new scale attribute, or adjusting the one we already have according the
resource scale), then it has to be painted with proper scaling matrix.
So everything that has to do with PangoLayout has to be in real coordinates,
then clutter logical coords multiplied by resource scaling.
While the actual size of the layout is the one of the PangoLayout divided by
resource scale.
We map the text positions to logical coords by default, while using
the pixel coordinates when painting.
We fall back to scale 1 when calculating preferred size if no scale is
known. The pango layout will not have set a layout scale attribute,
meaning it'll be 1, thus we should just assume the layout scale is 1 here.
Not doing so might result in the preferred size being 0x0 meaning the
actor won't be laid out properly.
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/135
https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
Diffstat (limited to 'clutter/tests/conform/text.c')
-rw-r--r-- | clutter/tests/conform/text.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clutter/tests/conform/text.c b/clutter/tests/conform/text.c index 30101ce34..cef99023e 100644 --- a/clutter/tests/conform/text.c +++ b/clutter/tests/conform/text.c @@ -468,6 +468,19 @@ validate_markup_attributes (ClutterText *text, a = attributes->data; + if (a->klass->type == PANGO_ATTR_SCALE) + { + PangoAttrFloat *scale = (PangoAttrFloat*) a; + float resource_scale; + + if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (text), &resource_scale)) + resource_scale = 1.0; + + g_assert_cmpfloat (scale->value, ==, resource_scale); + g_slist_free_full (attributes, (GDestroyNotify) pango_attribute_destroy); + continue; + } + g_assert (a->klass->type == attr_type); g_assert_cmpint (a->start_index, ==, start_index); g_assert_cmpint (a->end_index, ==, end_index); |