Mercurial > hg > xemacs-beta
comparison src/faces.c @ 3094:ad2f4ae9895b
[xemacs-hg @ 2005-11-26 11:45:47 by stephent]
Xft merge. <87k6ev4p8q.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Sat, 26 Nov 2005 11:46:25 +0000 |
parents | 1e7cc382eb16 |
children | 98af8a976fc3 |
comparison
equal
deleted
inserted
replaced
3093:769dc945b085 | 3094:ad2f4ae9895b |
---|---|
1058 mark_object (cachel->background_pixmap); | 1058 mark_object (cachel->background_pixmap); |
1059 } | 1059 } |
1060 } | 1060 } |
1061 | 1061 |
1062 /* ensure that the given cachel contains an updated font value for | 1062 /* ensure that the given cachel contains an updated font value for |
1063 the given charset. Return the updated font value. */ | 1063 the given charset. Return the updated font value (which can be |
1064 Qunbound, so this value must not be passed unchecked to Lisp). | |
1065 | |
1066 #### Xft: This function will need to be updated for new font model. */ | |
1064 | 1067 |
1065 Lisp_Object | 1068 Lisp_Object |
1066 ensure_face_cachel_contains_charset (struct face_cachel *cachel, | 1069 ensure_face_cachel_contains_charset (struct face_cachel *cachel, |
1067 Lisp_Object domain, Lisp_Object charset) | 1070 Lisp_Object domain, Lisp_Object charset) |
1068 { | 1071 { |
1409 | 1412 |
1410 cachel->updated = 1; | 1413 cachel->updated = 1; |
1411 } | 1414 } |
1412 | 1415 |
1413 /* Initialize a cachel. */ | 1416 /* Initialize a cachel. */ |
1417 /* #### Xft: this function will need to be changed for new font model. */ | |
1414 | 1418 |
1415 void | 1419 void |
1416 reset_face_cachel (struct face_cachel *cachel) | 1420 reset_face_cachel (struct face_cachel *cachel) |
1417 { | 1421 { |
1418 xzero (*cachel); | 1422 xzero (*cachel); |
1490 | 1494 |
1491 for (elt = 0; elt < Dynarr_length (w->face_cachels); elt++) | 1495 for (elt = 0; elt < Dynarr_length (w->face_cachels); elt++) |
1492 Dynarr_atp (w->face_cachels, elt)->dirty = 0; | 1496 Dynarr_atp (w->face_cachels, elt)->dirty = 0; |
1493 } | 1497 } |
1494 | 1498 |
1499 /* #### Xft: this function will need to be changed for new font model. */ | |
1495 void | 1500 void |
1496 mark_face_cachels_as_not_updated (struct window *w) | 1501 mark_face_cachels_as_not_updated (struct window *w) |
1497 { | 1502 { |
1498 int elt; | 1503 int elt; |
1499 | 1504 |
1682 Dynarr_free (cachel.merged_faces); | 1687 Dynarr_free (cachel.merged_faces); |
1683 cachel.merged_faces = 0; | 1688 cachel.merged_faces = 0; |
1684 } | 1689 } |
1685 return findex; | 1690 return findex; |
1686 } | 1691 } |
1692 } | |
1693 | |
1694 /* Return a cache index for window W from merging the faces in FACE_LIST. | |
1695 COUNT is the number of faces in the list. | |
1696 | |
1697 The default face should not be included in the list, as it is always | |
1698 implicitly merged into the cachel. | |
1699 | |
1700 WARNING: this interface may change. */ | |
1701 | |
1702 face_index | |
1703 merge_face_list_to_cache_index (struct window *w, | |
1704 Lisp_Object *face_list, int count) | |
1705 { | |
1706 int i; | |
1707 face_index findex = 0; | |
1708 struct face_cachel cachel; | |
1709 | |
1710 reset_face_cachel (&cachel); | |
1711 | |
1712 for (i = 0; i < count; i++) | |
1713 { | |
1714 Lisp_Object face = face_list[i]; | |
1715 | |
1716 if (!NILP (face)) | |
1717 { | |
1718 CHECK_FACE(face); /* #### presumably unnecessary */ | |
1719 findex = get_builtin_face_cache_index (w, face); | |
1720 merge_face_cachel_data (w, findex, &cachel); | |
1721 } | |
1722 } | |
1723 | |
1724 /* Now finally merge in the default face. */ | |
1725 findex = get_builtin_face_cache_index (w, Vdefault_face); | |
1726 merge_face_cachel_data (w, findex, &cachel); | |
1727 | |
1728 return get_merged_face_cache_index (w, &cachel); | |
1687 } | 1729 } |
1688 | 1730 |
1689 | 1731 |
1690 /***************************************************************************** | 1732 /***************************************************************************** |
1691 interface functions | 1733 interface functions |
2004 | 2046 |
2005 #if defined (HAVE_X_WINDOWS) || defined (HAVE_GTK) | 2047 #if defined (HAVE_X_WINDOWS) || defined (HAVE_GTK) |
2006 | 2048 |
2007 const Ascbyte *fonts[] = | 2049 const Ascbyte *fonts[] = |
2008 { | 2050 { |
2051 #ifdef USE_XFT | |
2052 /************** Xft fonts *************/ | |
2053 | |
2054 /* Note that fontconfig can search for several font families in one | |
2055 call. We should use this facility. */ | |
2056 "monospace-12", /* Western #### add encoding info? */ | |
2057 /* do we need to worry about non-Latin characters for monospace? | |
2058 No, at least in Debian's implementation of Xft. | |
2059 We should recommend that "gothic" and "mincho" aliases be created? */ | |
2060 "Sazanami Mincho-12", /* Japanese #### add encoding info? */ | |
2061 /* Arphic for Chinese? */ | |
2062 /* Korean */ | |
2063 #else | |
2064 | |
2009 /************** ISO-8859 fonts *************/ | 2065 /************** ISO-8859 fonts *************/ |
2010 | 2066 |
2011 "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*", | 2067 "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*", |
2068 /* under USE_XFT, we always succeed, so let's not waste the effort */ | |
2012 "-*-fixed-medium-r-*-*-*-120-*-*-*-*-iso8859-*", | 2069 "-*-fixed-medium-r-*-*-*-120-*-*-*-*-iso8859-*", |
2013 "-*-courier-*-r-*-*-*-120-*-*-*-*-iso8859-*", | 2070 "-*-courier-*-r-*-*-*-120-*-*-*-*-iso8859-*", |
2014 "-*-fixed-*-r-*-*-*-120-*-*-*-*-iso8859-*", | 2071 "-*-fixed-*-r-*-*-*-120-*-*-*-*-iso8859-*", |
2015 /* Next try for any "medium" charcell or monospaced iso8859 font. */ | 2072 /* Next try for any "medium" charcell or monospaced iso8859 font. */ |
2016 "-*-*-medium-r-*-*-*-120-*-*-m-*-iso8859-*", | 2073 "-*-*-medium-r-*-*-*-120-*-*-m-*-iso8859-*", |
2084 an appropriate Unicode font after all the charset-specific fonts | 2141 an appropriate Unicode font after all the charset-specific fonts |
2085 have been checked. This should look at the per-char font info and | 2142 have been checked. This should look at the per-char font info and |
2086 check whether we have support for some of the chars in the | 2143 check whether we have support for some of the chars in the |
2087 charset. (#### Bogus, but that's the way it currently works) | 2144 charset. (#### Bogus, but that's the way it currently works) |
2088 | 2145 |
2146 sjt sez: With Xft/fontconfig that information is available as a | |
2147 language support property. The character set (actually a bit | |
2148 vector) is also available. So what we need to do is to map charset | |
2149 -> language (Mule redesign Phase 1) and eventually use language | |
2150 information in the buffer, then map to charsets (Phase 2) at font | |
2151 instantiation time. | |
2152 | |
2089 (2) Record in the font instance a flag indicating when we're | 2153 (2) Record in the font instance a flag indicating when we're |
2090 dealing with a Unicode font. | 2154 dealing with a Unicode font. |
2091 | 2155 |
2092 (3) Notice this flag in separate_textual_runs() and translate the | 2156 (3) Notice this flag in separate_textual_runs() and translate the |
2093 text into Unicode if so. | 2157 text into Unicode if so. |
2131 /* Hello? Please? */ | 2195 /* Hello? Please? */ |
2132 "-*-*-*-r-*-*-*-120-*-*-*-*-*-*", | 2196 "-*-*-*-r-*-*-*-120-*-*-*-*-*-*", |
2133 "-*-*-*-*-*-*-*-120-*-*-*-*-*-*", | 2197 "-*-*-*-*-*-*-*-120-*-*-*-*-*-*", |
2134 "-*-*-*-*-*-*-*-*-*-*-*-*-*-*", | 2198 "-*-*-*-*-*-*-*-*-*-*-*-*-*-*", |
2135 "*" | 2199 "*" |
2200 #endif | |
2136 }; | 2201 }; |
2137 const Ascbyte **fontptr; | 2202 const Ascbyte **fontptr; |
2138 | 2203 |
2139 #ifdef HAVE_X_WINDOWS | 2204 #ifdef HAVE_X_WINDOWS |
2140 for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--) | 2205 for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--) |
2210 /* Provide some last-resort fallbacks for gui-element face which | 2275 /* Provide some last-resort fallbacks for gui-element face which |
2211 mustn't default to default. */ | 2276 mustn't default to default. */ |
2212 { | 2277 { |
2213 Lisp_Object fg_fb = Qnil, bg_fb = Qnil; | 2278 Lisp_Object fg_fb = Qnil, bg_fb = Qnil; |
2214 | 2279 |
2280 /* #### gui-element face doesn't have a font property? | |
2281 But it gets referred to later! */ | |
2215 #ifdef HAVE_GTK | 2282 #ifdef HAVE_GTK |
2216 /* We need to put something in there, or error checking gets | 2283 /* We need to put something in there, or error checking gets |
2217 #%!@#ed up before the styles are set, which override the | 2284 #%!@#ed up before the styles are set, which override the |
2218 fallbacks. */ | 2285 fallbacks. */ |
2219 fg_fb = acons (list1 (Qgtk), build_string ("black"), fg_fb); | 2286 fg_fb = acons (list1 (Qgtk), build_string ("black"), fg_fb); |
2281 | 2348 |
2282 /* widget is another gui element */ | 2349 /* widget is another gui element */ |
2283 Vwidget_face = Fmake_face (Qwidget, | 2350 Vwidget_face = Fmake_face (Qwidget, |
2284 build_msg_string ("widget face"), | 2351 build_msg_string ("widget face"), |
2285 Qnil); | 2352 Qnil); |
2353 /* #### weird ... the gui-element face doesn't have its own font yet */ | |
2286 set_specifier_fallback (Fget (Vwidget_face, Qfont, Qunbound), | 2354 set_specifier_fallback (Fget (Vwidget_face, Qfont, Qunbound), |
2287 Fget (Vgui_element_face, Qfont, Qunbound)); | 2355 Fget (Vgui_element_face, Qfont, Qunbound)); |
2288 set_specifier_fallback (Fget (Vwidget_face, Qforeground, Qunbound), | 2356 set_specifier_fallback (Fget (Vwidget_face, Qforeground, Qunbound), |
2289 Fget (Vgui_element_face, Qforeground, Qunbound)); | 2357 Fget (Vgui_element_face, Qforeground, Qunbound)); |
2290 set_specifier_fallback (Fget (Vwidget_face, Qbackground, Qunbound), | 2358 set_specifier_fallback (Fget (Vwidget_face, Qbackground, Qunbound), |