Author: cazfi
Date: Sat Oct 15 07:17:47 2016
New Revision: 34142

URL: http://svn.gna.org/viewcvs/freeciv?rev=34142&view=rev
Log:
Corrections to the way gtk3-clients produce font css
- Size is considered pixels, not points
- Handle font style and weight

Reported by Jacob Nevins <jtn>

See patch #7162

Modified:
    branches/S2_5/client/gui-gtk-3.0/gui_stuff.c

Modified: branches/S2_5/client/gui-gtk-3.0/gui_stuff.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-3.0/gui_stuff.c?rev=34142&r1=34141&r2=34142&view=diff
==============================================================================
--- branches/S2_5/client/gui-gtk-3.0/gui_stuff.c        (original)
+++ branches/S2_5/client/gui-gtk-3.0/gui_stuff.c        Sat Oct 15 07:17:47 2016
@@ -1014,6 +1014,8 @@
   PangoFontDescription *desc;
   int size;
   const char *fam;
+  const char *style;
+  const char *weight;
 
   desc = pango_font_description_from_string(font_value);
 
@@ -1027,14 +1029,26 @@
     return;
   }
 
+  if (pango_font_description_get_style(desc) == PANGO_STYLE_ITALIC) {
+    style = "\n font-style: italic;";
+  } else {
+    style = "";
+  }
+
+  if (pango_font_description_get_weight(desc) >= 700) {
+    weight = "\n font-style: bold;";
+  } else {
+    weight = "";
+  }
+
   size = pango_font_description_get_size(desc);
 
   if (size != 0) {
-    str = g_strdup_printf("#Freeciv #%s { font-family: %s; font-size: %dpt;}",
-                          font_name, fam, size / PANGO_SCALE);
+    str = g_strdup_printf("#Freeciv #%s { font-family: %s; font-size: 
%dpx;%s%s}",
+                          font_name, fam, size / PANGO_SCALE, style, weight);
   } else {
-    str = g_strdup_printf("#Freeciv #%s { font-family: %s; }",
-                          font_name, fam);
+    str = g_strdup_printf("#Freeciv #%s { font-family: %s;%s%s}",
+                          font_name, fam, style, weight);
   }
 
   pango_font_description_free(desc);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to