[gimp] app, devel-docs: improve position of loading text on splash image.



commit 309d118f6528bd2ae480c241a190e2d26a0ee8fa
Author: Jehan <jehan girinstud io>
Date:   Sun Apr 15 02:15:14 2018 +0200

    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.

 app/gui/splash.c             |   37 ++++++++++++++++++++++++++++++++-----
 devel-docs/release-howto.txt |    2 ++
 2 files changed, 34 insertions(+), 5 deletions(-)
---
diff --git a/app/gui/splash.c b/app/gui/splash.c
index 92eeabd..c923c67 100644
--- a/app/gui/splash.c
+++ b/app/gui/splash.c
@@ -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);
diff --git a/devel-docs/release-howto.txt b/devel-docs/release-howto.txt
index 39d54bf..e5e0f2e 100644
--- a/devel-docs/release-howto.txt
+++ b/devel-docs/release-howto.txt
@@ -66,6 +66,8 @@
          of the main display when too bug; but they won't be scaled up.
          Therefore anything smaller than fullHD will look tiny and
          unsuited on a 4K or higher res display).
+     [ ] Loading text will appear in bottom quarter, so the image must
+         be adapted.
 
  ( ) If ever the actual release date evolved and is different from the
      planned date, update the "date" in the <release> tag of the appdata


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]