From 15dbb7c912a55007476fff1fa1f6131665c97657 Mon Sep 17 00:00:00 2001 From: cinamod Date: Tue, 2 Sep 2003 22:09:49 +0000 Subject: [PATCH] respect boldness and italic --- modules/engines/ms-windows/ChangeLog.old | 4 +++ modules/engines/ms-windows/wimp_style.c | 44 ++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/modules/engines/ms-windows/ChangeLog.old b/modules/engines/ms-windows/ChangeLog.old index 747b7d6fc3..b2dbe1b086 100755 --- a/modules/engines/ms-windows/ChangeLog.old +++ b/modules/engines/ms-windows/ChangeLog.old @@ -1,3 +1,7 @@ +2003-09-02 Dom Lachowicz + + * src/wimp_style.c: We now honor font preferences being bold or italic + 2003-08-29 Dom Lachowicz * src/*.c: Theme GTK toolbar arrows to XP chevrons, once my GTK patch is committed. diff --git a/modules/engines/ms-windows/wimp_style.c b/modules/engines/ms-windows/wimp_style.c index c42beef680..010f5e0ff1 100755 --- a/modules/engines/ms-windows/wimp_style.c +++ b/modules/engines/ms-windows/wimp_style.c @@ -153,13 +153,53 @@ sys_font_to_pango_font (SystemFontType type, char * buf) { LOGFONT lf; int pt_size; + const char * weight; + const char * style; + +/* +TODO: I don't think that pango font descriptions let you set these + BYTE lfUnderline; underline=single|none + BYTE lfStrikeOut; strikethrough=true|false +*/ if (get_system_font(type, &lf)) { + switch (lf.lfWeight) { + case FW_THIN: + case FW_EXTRALIGHT: + weight = "ultralight"; + break; + + case FW_LIGHT: + weight = "light"; + break; + + case FW_SEMIBOLD: + case FW_BOLD: + weight = "bold"; + break; + + case FW_ULTRABOLD: + weight = "ultrabold"; + break; + + case FW_HEAVY: + weight = "heavy"; + + default: + weight = "normal"; + break; + } + + if (lf.lfItalic) + style="italic"; + else + style="normal"; + pt_size = -MulDiv(lf.lfHeight, 72, GetDeviceCaps(GetDC(GetDesktopWindow()), LOGPIXELSY)); - sprintf(buf, "%s %d", lf.lfFaceName, pt_size); + sprintf(buf, "%s %s %s %d", lf.lfFaceName, style, weight, pt_size); return buf; } @@ -170,7 +210,7 @@ sys_font_to_pango_font (SystemFontType type, char * buf) static void setup_system_font(GtkStyle *style) { - char buf[64], * font; /* It's okay, lfFaceName is smaller than 32 chars */ + char buf[256], * font; /* It's okay, lfFaceName is smaller than 32 chars */ if ((font = sys_font_to_pango_font(MESSAGE_FONT, buf)) != NULL) {