[gnome-font-viewer] font-widget: sync from Sushi



commit 044842e87ffe9eb118794e8b0df6360fed6d637a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue May 1 12:17:13 2012 -0400

    font-widget: sync from Sushi

 src/sushi-font-widget.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/sushi-font-widget.c b/src/sushi-font-widget.c
index 7b7ce39..1c6440a 100644
--- a/src/sushi-font-widget.c
+++ b/src/sushi-font-widget.c
@@ -247,8 +247,11 @@ build_sizes_table (FT_Face face,
     sizes[11] = 168;
     sizes[12] = 192;
     sizes[13] = 216;
+
     *alpha_size = 24;
   } else {
+    gint diff = G_MAXINT;
+
     /* use fixed sizes */
     *n_sizes = face->num_fixed_sizes;
     sizes = g_new (gint, *n_sizes);
@@ -257,9 +260,10 @@ build_sizes_table (FT_Face face,
     for (i = 0; i < face->num_fixed_sizes; i++) {
       sizes[i] = face->available_sizes[i].height;
 
-      /* work out which font size to render */
-      if (face->available_sizes[i].height <= 24)
-        *alpha_size = face->available_sizes[i].height;
+      if ((gint) (abs (sizes[i] - 24)) < diff) {
+        diff = (gint) abs (sizes[i] - 24);
+        *alpha_size = sizes[i];
+      }
     }
   }
 



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