[gtk+] Deal with non-multiple-of-100 font weights



commit f8a7810397435135c91d606a49f34090294c8249
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 1 16:15:16 2012 -0400

    Deal with non-multiple-of-100 font weights
    
    We should not run into an assertion so easily.

 gtk/gtkcssenumvalue.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index 84e986b..56fb1e8 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -229,10 +229,13 @@ GtkCssValue *
 _gtk_css_font_weight_value_new (PangoWeight font_weight)
 {
   guint i;
+  gint w;
+
+  w = ((font_weight + 50) / 100) * 100;
 
   for (i = 0; i < G_N_ELEMENTS (font_weight_values); i++)
     {
-      if (font_weight_values[i].value == font_weight)
+      if (font_weight_values[i].value == w)
         return _gtk_css_value_ref (&font_weight_values[i]);
     }
 



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