From af59aa6e3c661fcd547df8bc4175750f9edb20ec Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 11 Feb 2011 21:13:34 -0800 Subject: [PATCH] Port to Solaris 10, which doesn't support FC_HINT_STYLE. --- src/ChangeLog | 8 ++++++++ src/xftfont.c | 8 +++++--- src/xsettings.c | 23 ++++++++++++++--------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ba3bbb71b7e..4ef9778ca48 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2011-02-12 Paul Eggert + + Port to Solaris 10, which doesn't support FC_HINT_STYLE. + * xftfont.c (FC_HINT_STYLE): #define to "hintstyle" if not + defined. + * xsettings.c (parse_settings, apply_xft_settings): Don't assume + FC_HINT_STYLE is supported. + 2011-02-11 Jan Djärv * xterm.c (x_set_frame_alpha): Access data before it is free:d. diff --git a/src/xftfont.c b/src/xftfont.c index 084ca735171..695527c4236 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -187,17 +187,20 @@ xftfont_fix_match (FcPattern *pat, FcPattern *match) double dpi; FcPatternGetBool (pat, FC_ANTIALIAS, 0, &b); - if (! b) + if (! b) { FcPatternDel (match, FC_ANTIALIAS); FcPatternAddBool (match, FC_ANTIALIAS, FcFalse); } FcPatternGetBool (pat, FC_HINTING, 0, &b); - if (! b) + if (! b) { FcPatternDel (match, FC_HINTING); FcPatternAddBool (match, FC_HINTING, FcFalse); } +#ifndef FC_HINT_STYLE +# define FC_HINT_STYLE "hintstyle" +#endif if (FcResultMatch == FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &i)) { FcPatternDel (match, FC_HINT_STYLE); @@ -781,4 +784,3 @@ syms_of_xftfont (void) register_font_driver (&xftfont_driver, NULL); } - diff --git a/src/xsettings.c b/src/xsettings.c index e3d2c6e9efb..097b2477e03 100644 --- a/src/xsettings.c +++ b/src/xsettings.c @@ -75,7 +75,7 @@ enum { SEEN_FONT = 0x40, SEEN_TB_STYLE = 0x80, }; -struct xsettings +struct xsettings { #ifdef HAVE_XFT FcBool aa, hinting; @@ -104,7 +104,7 @@ something_changedCB (GConfClient *client, gpointer user_data) { GConfValue *v = gconf_entry_get_value (entry); - + if (!v) return; if (v->type == GCONF_VALUE_STRING) { @@ -196,7 +196,7 @@ get_prop_window (struct x_display_info *dpyinfo) 4 CARD32 last-change-serial and then the value, For string: - + bytes type what ------------------------------------ 4 CARD32 n = value-length @@ -280,7 +280,7 @@ parse_settings (unsigned char *prop, (strcmp (XSETTINGS_FONT_NAME, name) == 0) || (strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0); - switch (type) + switch (type) { case 0: /* Integer */ if (bytes_parsed+4 > bytes) return BadLength; @@ -310,14 +310,14 @@ parse_settings (unsigned char *prop, case 2: /* RGB value */ /* No need to parse this */ if (bytes_parsed+8 > bytes) return BadLength; - bytes_parsed += 8; /* 4 values (r, b, g, alpha), 2 bytes each. */ + bytes_parsed += 8; /* 4 values (r, b, g, alpha), 2 bytes each. */ break; default: /* Parse Error */ return BadValue; } - if (want_this) + if (want_this) { ++settings_seen; if (strcmp (name, XSETTINGS_FONT_NAME) == 0) @@ -341,6 +341,7 @@ parse_settings (unsigned char *prop, settings->seen |= SEEN_HINTING; settings->hinting = ival != 0; } +# ifdef FC_HINT_STYLE else if (strcmp (name, "Xft/HintStyle") == 0) { settings->seen |= SEEN_HINTSTYLE; @@ -355,6 +356,7 @@ parse_settings (unsigned char *prop, else settings->seen &= ~SEEN_HINTSTYLE; } +# endif else if (strcmp (name, "Xft/RGBA") == 0) { settings->seen |= SEEN_RGBA; @@ -442,7 +444,9 @@ apply_xft_settings (struct x_display_info *dpyinfo, pat); FcPatternGetBool (pat, FC_ANTIALIAS, 0, &oldsettings.aa); FcPatternGetBool (pat, FC_HINTING, 0, &oldsettings.hinting); +# ifdef FC_HINT_STYLE FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &oldsettings.hintstyle); +# endif FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &oldsettings.lcdfilter); FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba); FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi); @@ -488,6 +492,7 @@ apply_xft_settings (struct x_display_info *dpyinfo, if (strlen (buf) > 0) strcat (buf, ", "); sprintf (buf+strlen (buf), "LCDFilter: %d", oldsettings.lcdfilter); +# ifdef FC_HINT_STYLE if ((settings->seen & SEEN_HINTSTYLE) != 0 && oldsettings.hintstyle != settings->hintstyle) { @@ -496,6 +501,7 @@ apply_xft_settings (struct x_display_info *dpyinfo, ++changed; oldsettings.hintstyle = settings->hintstyle; } +# endif if (strlen (buf) > 0) strcat (buf, ", "); sprintf (buf+strlen (buf), "Hintstyle: %d", oldsettings.hintstyle); @@ -508,7 +514,7 @@ apply_xft_settings (struct x_display_info *dpyinfo, FcPatternAddDouble (pat, FC_DPI, settings->dpi); ++changed; oldsettings.dpi = settings->dpi; - + /* Change the DPI on this display and all frames on the display. */ dpyinfo->resy = dpyinfo->resx = settings->dpi; FOR_EACH_FRAME (tail, frame) @@ -565,7 +571,7 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p) if (settings.seen & SEEN_FONT) { - if (!current_font || strcmp (current_font, settings.font) != 0) + if (!current_font || strcmp (current_font, settings.font) != 0) { free (current_font); current_font = settings.font; @@ -774,4 +780,3 @@ If this variable is nil, Emacs ignores system font changes. */); Fprovide (intern_c_string ("dynamic-setting"), Qnil); } - -- 2.39.5