Author: cazfi Date: Sat Oct 15 07:17:33 2016 New Revision: 34140 URL: http://svn.gna.org/viewcvs/freeciv?rev=34140&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: trunk/client/gui-gtk-3.0/gui_stuff.c trunk/client/gui-gtk-3.22/gui_stuff.c Modified: trunk/client/gui-gtk-3.0/gui_stuff.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/gui_stuff.c?rev=34140&r1=34139&r2=34140&view=diff ============================================================================== --- trunk/client/gui-gtk-3.0/gui_stuff.c (original) +++ trunk/client/gui-gtk-3.0/gui_stuff.c Sat Oct 15 07:17:33 2016 @@ -1013,6 +1013,8 @@ PangoFontDescription *desc; int size; const char *fam; + const char *style; + const char *weight; desc = pango_font_description_from_string(font_value); @@ -1026,14 +1028,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); Modified: trunk/client/gui-gtk-3.22/gui_stuff.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.22/gui_stuff.c?rev=34140&r1=34139&r2=34140&view=diff ============================================================================== --- trunk/client/gui-gtk-3.22/gui_stuff.c (original) +++ trunk/client/gui-gtk-3.22/gui_stuff.c Sat Oct 15 07:17:33 2016 @@ -1006,6 +1006,8 @@ PangoFontDescription *desc; int size; const char *fam; + const char *style; + const char *weight; desc = pango_font_description_from_string(font_value); @@ -1019,14 +1021,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