app, devel-docs: improve position of loading text on splash image.
The upper text will be centered on the top quarter of the bottom quarter of the splash image, whereas the bottom text will be centered on the bottom quarter of the bottom quarter of the splash (unless the splash is too small, in which case the double of the layout pixel extents will be used). Basically don't use absolute pixel values anymore for positionning. This should all be done relatively since there are nowadays all kind of display size (and positionning the text 6 pixels to the bottom, as it was done, may be ok on low density displays, yet will look ugly on high density screens). Also write this down in the splash requirements in the release howto so that splash designers are aware that the bottom quarter of their image will have to be adapted for printing text.
This commit is contained in:
@ -293,6 +293,7 @@ splash_position_layouts (GimpSplash *splash,
|
||||
{
|
||||
PangoRectangle ink;
|
||||
PangoRectangle logical;
|
||||
gint text_height = 0;
|
||||
|
||||
if (text1)
|
||||
{
|
||||
@ -305,10 +306,7 @@ splash_position_layouts (GimpSplash *splash,
|
||||
pango_layout_get_pixel_extents (splash->upper, &ink, &logical);
|
||||
|
||||
splash->upper_x = (splash->width - logical.width) / 2;
|
||||
splash->upper_y = splash->height - (2 * logical.height + 6);
|
||||
|
||||
if (area)
|
||||
splash_rectangle_union (area, &ink, splash->upper_x, splash->upper_y);
|
||||
text_height += logical.height;
|
||||
}
|
||||
|
||||
if (text2)
|
||||
@ -322,7 +320,36 @@ splash_position_layouts (GimpSplash *splash,
|
||||
pango_layout_get_pixel_extents (splash->lower, &ink, &logical);
|
||||
|
||||
splash->lower_x = (splash->width - logical.width) / 2;
|
||||
splash->lower_y = splash->height - (logical.height + 6);
|
||||
text_height += logical.height;
|
||||
}
|
||||
|
||||
/* For pretty printing, let's say we want at least double space. */
|
||||
text_height *= 2;
|
||||
|
||||
/* The ordinates are computed in 2 steps, because we are first
|
||||
* checking the minimal height needed for text (text_height).
|
||||
*
|
||||
* Ideally we are printing in the bottom quarter of the splash image,
|
||||
* with well centered positions. But if this zone appears to be too
|
||||
* small, we will end up using this previously computed text_height
|
||||
* instead. Since splash images are designed to have text in the lower
|
||||
* quarter, this may end up a bit uglier, but at least top and bottom
|
||||
* texts won't overlay each other.
|
||||
*/
|
||||
if (text1)
|
||||
{
|
||||
pango_layout_get_pixel_extents (splash->upper, &ink, &logical);
|
||||
splash->upper_y = MIN (splash->height - text_height,
|
||||
splash->height * 13 / 16 - logical.height / 2);
|
||||
|
||||
if (area)
|
||||
splash_rectangle_union (area, &ink, splash->upper_x, splash->upper_y);
|
||||
}
|
||||
if (text2)
|
||||
{
|
||||
pango_layout_get_pixel_extents (splash->lower, &ink, &logical);
|
||||
splash->lower_y = MIN (splash->height - text_height / 2,
|
||||
splash->height * 15 / 16 - logical.height / 2);
|
||||
|
||||
if (area)
|
||||
splash_rectangle_union (area, &ink, splash->lower_x, splash->lower_y);
|
||||
|
Reference in New Issue
Block a user