Mercurial > emacs
comparison src/ftfont.c @ 106085:cd4cbab8bb21
Handle system default font and changing font parameters.
* xterm.h (struct x_display_info): Add atoms and Window for xsettings.
* xterm.c (handle_one_xevent): Call xft_settings_event for
ClientMessage, PropertyNotify and DestroyNotify.
(x_term_init): If we have XFT, get DPI from Xft.dpi.
Call xsettings_initialize.
* xftfont.c (xftfont_fix_match): New function.
(xftfont_open): Call XftDefaultSubstitute before XftFontMatch.
Call xftfont_fix_match after XftFontMatch.
* xfont.c (xfont_driver): Initialize all members.
* xfns.c (x_default_font_parameter): Try font from Ffont_get_system_font.
Do not get font from x_default_parameter if we got one from
Ffont_get_system_font.
(Fx_select_font): Get the defaut font name from :name of FRAME_FONT (f).
* w32font.c (w32font_driver): Initialize all members.
* termhooks.h (enum event_kind): CONFIG_CHANGED_EVENT is new.
* lisp.h: Declare syms_of_xsettings.
* keyboard.c (kbd_buffer_get_event, make_lispy_event): Handle
CONFIG_CHANGED_EVENT.
* ftfont.c (ftfont_filter_properties): New function.
* frame.c (x_set_font): Remove unused variable lval.
* font.h (struct font_driver): filter_properties is new.
* font.c (font_put_extra): Don't return if val is nil, it means
boolean option is off.
(font_parse_fcname): Collect all extra properties in extra_props
and call filter_properties for all drivers with extra_props and
font as parameter.
(font_open_entity): Do not use cache, it does not pick up new fontconfig
settings like hinting.
(font_load_for_lface): If spec had a name in it, store it in entity.
* emacs.c (main): Call syms_of_xsettings
* config.in: HAVE_GCONF is new.
* Makefile.in (GCONF_CFLAGS, GCONF_LIBS): New variables for HAVE_GCONF.
xsettings.o is new.
* menu-bar.el: Put "Use system font" in Option-menu.
* loadup.el: If feature system-font-setting or font-render-setting is
there, load font-setting.
* Makefile.in (ELCFILES): font-settings.el is new.
* font-setting.el: New file.
* NEWS: Mention dynamic font changes (font-use-system-font).
* configure.in: New option: --with(out)-gconf.
Set HAVE_GCONF if we find gconf.
| author | Jan Dj?rv <jan.h.d@swipnet.se> |
|---|---|
| date | Tue, 17 Nov 2009 08:21:23 +0000 |
| parents | 68dd71358159 |
| children | e5416066efd1 |
comparison
equal
deleted
inserted
replaced
| 106084:f03048d6d95a | 106085:cd4cbab8bb21 |
|---|---|
| 84 static Lisp_Object ftfont_resolve_generic_family P_ ((Lisp_Object, | 84 static Lisp_Object ftfont_resolve_generic_family P_ ((Lisp_Object, |
| 85 FcPattern *)); | 85 FcPattern *)); |
| 86 static Lisp_Object ftfont_lookup_cache P_ ((Lisp_Object, | 86 static Lisp_Object ftfont_lookup_cache P_ ((Lisp_Object, |
| 87 enum ftfont_cache_for)); | 87 enum ftfont_cache_for)); |
| 88 | 88 |
| 89 static void ftfont_filter_properties P_ ((Lisp_Object font, Lisp_Object alist)); | |
| 90 | |
| 89 Lisp_Object ftfont_font_format P_ ((FcPattern *, Lisp_Object)); | 91 Lisp_Object ftfont_font_format P_ ((FcPattern *, Lisp_Object)); |
| 90 | 92 |
| 91 #define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM)) | 93 #define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM)) |
| 92 | 94 |
| 93 static struct | 95 static struct |
| 543 NULL, | 545 NULL, |
| 544 #endif /* not (HAVE_M17N_FLT && HAVE_LIBOTF) */ | 546 #endif /* not (HAVE_M17N_FLT && HAVE_LIBOTF) */ |
| 545 NULL, /* check */ | 547 NULL, /* check */ |
| 546 | 548 |
| 547 #ifdef HAVE_OTF_GET_VARIATION_GLYPHS | 549 #ifdef HAVE_OTF_GET_VARIATION_GLYPHS |
| 548 ftfont_variation_glyphs | 550 ftfont_variation_glyphs, |
| 549 #else | 551 #else |
| 550 NULL | 552 NULL, |
| 551 #endif | 553 #endif |
| 554 | |
| 555 ftfont_filter_properties, /* filter_properties */ | |
| 552 }; | 556 }; |
| 553 | 557 |
| 554 extern Lisp_Object QCname; | 558 extern Lisp_Object QCname; |
| 555 | 559 |
| 556 static Lisp_Object | 560 static Lisp_Object |
| 2224 } | 2228 } |
| 2225 } | 2229 } |
| 2226 return intern ("unknown"); | 2230 return intern ("unknown"); |
| 2227 } | 2231 } |
| 2228 | 2232 |
| 2229 | 2233 static const char *ftfont_booleans [] = { |
| 2234 ":antialias", | |
| 2235 ":hinting", | |
| 2236 ":verticallayout", | |
| 2237 ":autohint", | |
| 2238 ":globaladvance", | |
| 2239 ":outline", | |
| 2240 ":scalable", | |
| 2241 ":minspace", | |
| 2242 ":embolden", | |
| 2243 NULL, | |
| 2244 }; | |
| 2245 | |
| 2246 static const char *ftfont_non_booleans [] = { | |
| 2247 ":family", | |
| 2248 ":familylang", | |
| 2249 ":style", | |
| 2250 ":stylelang", | |
| 2251 ":fullname", | |
| 2252 ":fullnamelang", | |
| 2253 ":slant", | |
| 2254 ":weight", | |
| 2255 ":size", | |
| 2256 ":width", | |
| 2257 ":aspect", | |
| 2258 ":pixelsize", | |
| 2259 ":spacing", | |
| 2260 ":foundry", | |
| 2261 ":hintstyle", | |
| 2262 ":file", | |
| 2263 ":index", | |
| 2264 ":ftface", | |
| 2265 ":rasterizer", | |
| 2266 ":scale", | |
| 2267 ":dpi", | |
| 2268 ":rgba", | |
| 2269 ":lcdfilter", | |
| 2270 ":charset", | |
| 2271 ":lang", | |
| 2272 ":fontversion", | |
| 2273 ":capability", | |
| 2274 NULL, | |
| 2275 }; | |
| 2276 | |
| 2277 static void | |
| 2278 ftfont_filter_properties (font, alist) | |
| 2279 Lisp_Object font; | |
| 2280 Lisp_Object alist; | |
| 2281 { | |
| 2282 Lisp_Object it; | |
| 2283 int i; | |
| 2284 | |
| 2285 /* Set boolean values to Qt or Qnil */ | |
| 2286 for (i = 0; ftfont_booleans[i] != NULL; ++i) | |
| 2287 for (it = alist; ! NILP (it); it = XCDR (it)) | |
| 2288 { | |
| 2289 Lisp_Object key = XCAR (XCAR (it)); | |
| 2290 Lisp_Object val = XCDR (XCAR (it)); | |
| 2291 char *keystr = SDATA (SYMBOL_NAME (key)); | |
| 2292 | |
| 2293 if (strcmp (ftfont_booleans[i], keystr) == 0) | |
| 2294 { | |
| 2295 char *str = SYMBOLP (val) ? SDATA (SYMBOL_NAME (val)) : NULL; | |
| 2296 if (INTEGERP (val)) str = XINT (val) != 0 ? "true" : "false"; | |
| 2297 if (str == NULL) str = "true"; | |
| 2298 | |
| 2299 val = Qt; | |
| 2300 if (strcmp ("false", str) == 0 || strcmp ("False", str) == 0 | |
| 2301 || strcmp ("FALSE", str) == 0 || strcmp ("FcFalse", str) == 0 | |
| 2302 || strcmp ("off", str) == 0 || strcmp ("OFF", str) == 0 | |
| 2303 || strcmp ("Off", str) == 0) | |
| 2304 val = Qnil; | |
| 2305 Ffont_put (font, key, val); | |
| 2306 } | |
| 2307 } | |
| 2308 | |
| 2309 for (i = 0; ftfont_non_booleans[i] != NULL; ++i) | |
| 2310 for (it = alist; ! NILP (it); it = XCDR (it)) | |
| 2311 { | |
| 2312 Lisp_Object key = XCAR (XCAR (it)); | |
| 2313 Lisp_Object val = XCDR (XCAR (it)); | |
| 2314 char *keystr = SDATA (SYMBOL_NAME (key)); | |
| 2315 if (strcmp (ftfont_non_booleans[i], keystr) == 0) | |
| 2316 Ffont_put (font, key, val); | |
| 2317 } | |
| 2318 } | |
| 2319 | |
| 2320 | |
| 2230 void | 2321 void |
| 2231 syms_of_ftfont () | 2322 syms_of_ftfont () |
| 2232 { | 2323 { |
| 2233 DEFSYM (Qfreetype, "freetype"); | 2324 DEFSYM (Qfreetype, "freetype"); |
| 2234 DEFSYM (Qmonospace, "monospace"); | 2325 DEFSYM (Qmonospace, "monospace"); |
