aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2001-05-14 13:35:09 +0000
committerStefan Monnier2001-05-14 13:35:09 +0000
commit3cf80731c1ef01dca1e0877436eb38b37b50cd09 (patch)
tree55e8490f153855038af20054ee70e3520659d184 /src
parent557f7c34d9ae7ad22b604d0ff629378f0288f347 (diff)
downloademacs-3cf80731c1ef01dca1e0877436eb38b37b50cd09.tar.gz
emacs-3cf80731c1ef01dca1e0877436eb38b37b50cd09.zip
(try_alternative_families): First try the FAMILY.
And if nothing is found in the end, try again with scalable fonts. (try_font_list): Let try_alternative_families do a bit more of the work. Only use FAMILY if it is not nil. (syms_of_xfaces) <scalable-fonts-allowed>: Fix docstring.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog13
-rw-r--r--src/xfaces.c88
2 files changed, 56 insertions, 45 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 40d9e492fc1..280b828f738 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12001-05-14 Stefan Monnier <monnier@cs.yale.edu>
2
3 * xfaces.c (try_alternative_families): First try the FAMILY.
4 And if nothing is found in the end, try again with scalable fonts.
5 (try_font_list): Let try_alternative_families do a bit more of
6 the work. Only use FAMILY if it is not nil.
7 (syms_of_xfaces) <scalable-fonts-allowed>: Fix docstring.
8
12001-05-14 Gerd Moellmann <gerd@gnu.org> 92001-05-14 Gerd Moellmann <gerd@gnu.org>
2 10
3 * xterm.c (x_draw_glyphs): Fix compuation of rightmost x for 11 * xterm.c (x_draw_glyphs): Fix compuation of rightmost x for
@@ -5,15 +13,14 @@
5 13
6 * xfaces.c (split_font_name): Make sure to leave the loop 14 * xfaces.c (split_font_name): Make sure to leave the loop
7 with the right value of `i'. 15 with the right value of `i'.
8 16
9 * xfaces.c (split_font_name): Handle matrix transformations 17 * xfaces.c (split_font_name): Handle matrix transformations
10 in the pixel and point size fields of XLFD font names. 18 in the pixel and point size fields of XLFD font names.
11 (xlfd_point_size): Likewise. 19 (xlfd_point_size): Likewise.
12 20
132001-05-12 Eli Zaretskii <eliz@is.elta.co.il> 212001-05-12 Eli Zaretskii <eliz@is.elta.co.il>
14 22
15 * w32fns.c (w32_to_x_font): Change prototype to fit the 23 * w32fns.c (w32_to_x_font): Change prototype to fit the declaration.
16 declaration.
17 (x_to_w32_font): Add prototype. 24 (x_to_w32_font): Add prototype.
18 25
19 * regex.c (malloc, realloc, free) [emacs]: Undefine before 26 * regex.c (malloc, realloc, free) [emacs]: Undefine before
diff --git a/src/xfaces.c b/src/xfaces.c
index 93acc8b5317..68371ef2293 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5843,8 +5843,8 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio)
5843} 5843}
5844 5844
5845 5845
5846/* Get a list of matching fonts on frame F, considering alterntive 5846/* Get a list of matching fonts on frame F, considering FAMILY
5847 font families from Vface_alternative_font_registry_alist. 5847 and alternative font families from Vface_alternative_font_registry_alist.
5848 5848
5849 FAMILY is the font family whose alternatives are considered. 5849 FAMILY is the font family whose alternatives are considered.
5850 5850
@@ -5864,27 +5864,40 @@ try_alternative_families (f, family, registry, fonts)
5864 Lisp_Object alter; 5864 Lisp_Object alter;
5865 int nfonts = 0; 5865 int nfonts = 0;
5866 5866
5867 /* Try alternative font families. */ 5867 nfonts = font_list (f, Qnil, family, registry, fonts);
5868 alter = Fassoc (family, Vface_alternative_font_family_alist); 5868 if (nfonts == 0)
5869 if (CONSP (alter))
5870 { 5869 {
5871 for (alter = XCDR (alter); 5870 /* Try alternative font families. */
5872 CONSP (alter) && nfonts == 0; 5871 alter = Fassoc (family, Vface_alternative_font_family_alist);
5873 alter = XCDR (alter)) 5872 if (CONSP (alter))
5873 {
5874 for (alter = XCDR (alter);
5875 CONSP (alter) && nfonts == 0;
5876 alter = XCDR (alter))
5877 {
5878 if (STRINGP (XCAR (alter)))
5879 nfonts = font_list (f, Qnil, XCAR (alter), registry, fonts);
5880 }
5881 }
5882
5883 /* Try scalable fonts before giving up. */
5884 if (nfonts == 0 && NILP (Vscalable_fonts_allowed))
5874 { 5885 {
5875 if (STRINGP (XCAR (alter))) 5886 int count = BINDING_STACK_SIZE ();
5876 nfonts = font_list (f, Qnil, XCAR (alter), registry, fonts); 5887 specbind (Qscalable_fonts_allowed, Qt);
5888 nfonts = try_alternative_families (f, family, registry, fonts);
5889 unbind_to (count, Qnil);
5877 } 5890 }
5878 } 5891 }
5879
5880 return nfonts; 5892 return nfonts;
5881} 5893}
5882 5894
5883 5895
5884/* Get a list of matching fonts on frame F. 5896/* Get a list of matching fonts on frame F.
5885 5897
5886 FAMILY, if a string, specifies a font family. If nil, use 5898 FAMILY, if a string, specifies a font family derived from the fontset.
5887 the family specified in Lisp face attributes ATTRS instead. 5899 It is only used if the face does not specify any family in ATTRS or
5900 if we cannot find any font of the face's family.
5888 5901
5889 REGISTRY, if a string, specifies a font registry and encoding to 5902 REGISTRY, if a string, specifies a font registry and encoding to
5890 match. A value of nil means include fonts of any registry and 5903 match. A value of nil means include fonts of any registry and
@@ -5901,39 +5914,28 @@ try_font_list (f, attrs, family, registry, fonts)
5901 struct font_name **fonts; 5914 struct font_name **fonts;
5902{ 5915{
5903 int nfonts = 0; 5916 int nfonts = 0;
5917 Lisp_Object face_family = attrs[LFACE_FAMILY_INDEX];
5904 5918
5905 if (STRINGP (attrs[LFACE_FAMILY_INDEX])) 5919 if (STRINGP (face_family))
5906 { 5920 nfonts = try_alternative_families (f, face_family, registry, fonts);
5907 Lisp_Object face_family; 5921
5908 face_family = attrs[LFACE_FAMILY_INDEX]; 5922 if (nfonts == 0 && !NILP (family))
5909 nfonts = font_list (f, Qnil, face_family, registry, fonts); 5923 nfonts = try_alternative_families (f, family, registry, fonts);
5910 if (nfonts == 0)
5911 nfonts = try_alternative_families (f, face_family, registry, fonts);
5912 }
5913 5924
5925 /* Try font family of the default face or "fixed". */
5914 if (nfonts == 0) 5926 if (nfonts == 0)
5915 { 5927 {
5928 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
5929 if (default_face)
5930 family = default_face->lface[LFACE_FAMILY_INDEX];
5931 else
5932 family = build_string ("fixed");
5916 nfonts = font_list (f, Qnil, family, registry, fonts); 5933 nfonts = font_list (f, Qnil, family, registry, fonts);
5917 if (nfonts == 0 && !NILP (family))
5918 {
5919 nfonts = try_alternative_families (f, family, registry, fonts);
5920
5921 /* Try font family of the default face or "fixed". */
5922 if (nfonts == 0)
5923 {
5924 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
5925 if (default_face)
5926 family = default_face->lface[LFACE_FAMILY_INDEX];
5927 else
5928 family = build_string ("fixed");
5929 nfonts = font_list (f, Qnil, family, registry, fonts);
5930 }
5931
5932 /* Try any family with the given registry. */
5933 if (nfonts == 0)
5934 nfonts = font_list (f, Qnil, Qnil, registry, fonts);
5935 }
5936 } 5934 }
5935
5936 /* Try any family with the given registry. */
5937 if (nfonts == 0)
5938 nfonts = font_list (f, Qnil, Qnil, registry, fonts);
5937 5939
5938 return nfonts; 5940 return nfonts;
5939} 5941}
@@ -7200,8 +7202,10 @@ See `set-face-stipple' for possible values for this variable.");
7200A value of nil means don't allow any scalable fonts.\n\ 7202A value of nil means don't allow any scalable fonts.\n\
7201A value of t means allow any scalable font.\n\ 7203A value of t means allow any scalable font.\n\
7202Otherwise, value must be a list of regular expressions. A font may be\n\ 7204Otherwise, value must be a list of regular expressions. A font may be\n\
7203scaled if its name matches a regular expression in the list."); 7205scaled if its name matches a regular expression in the list.\n\
7204 Vscalable_fonts_allowed = Qt; 7206Note that if value is nil, a scalable font might still be used, if no\n\
7207other font of the appropriate family and registry is available.");
7208 Vscalable_fonts_allowed = Qnil;
7205 7209
7206 DEFVAR_LISP ("face-ignored-fonts", &Vface_ignored_fonts, 7210 DEFVAR_LISP ("face-ignored-fonts", &Vface_ignored_fonts,
7207 "List of ignored fonts.\n\ 7211 "List of ignored fonts.\n\