diff options
| author | Kenichi Handa | 2002-09-26 08:04:18 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-09-26 08:04:18 +0000 |
| commit | 54580ab2035a3d6960d181be08ffebba2eb65581 (patch) | |
| tree | 6c13cb23facd83357be26efe4e37cd371635ba05 /src | |
| parent | fc88015c7eda762e7e0e8a4fa4517f9aff877e1b (diff) | |
| download | emacs-54580ab2035a3d6960d181be08ffebba2eb65581.tar.gz emacs-54580ab2035a3d6960d181be08ffebba2eb65581.zip | |
(try_font_list): New arg PREFER_FACE_FAMILY. If it is
nonzero, try face's family at first. Otherwise try FAMILY at
first.
(choose_face_font): If C is a single byte char or latin-1, call
try_font_list with PREFER_FACE_FAMILY 1.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/xfaces.c | 29 |
2 files changed, 29 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index eda5d664c12..2396c9562ad 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2002-09-26 Kenichi Handa <handa@etl.go.jp> | ||
| 2 | |||
| 3 | * xfaces.c (try_font_list): New arg PREFER_FACE_FAMILY. If it is | ||
| 4 | nonzero, try face's family at first. Otherwise try FAMILY at | ||
| 5 | first. | ||
| 6 | (choose_face_font): If C is a single byte char or latin-1, call | ||
| 7 | try_font_list with PREFER_FACE_FAMILY 1. | ||
| 8 | |||
| 1 | 2002-09-21 Richard M. Stallman <rms@gnu.org> | 9 | 2002-09-21 Richard M. Stallman <rms@gnu.org> |
| 2 | 10 | ||
| 3 | * window.c (select_window_1): Don't select frame. | 11 | * window.c (select_window_1): Don't select frame. |
diff --git a/src/xfaces.c b/src/xfaces.c index e8a878d8123..57749ea5634 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -510,7 +510,8 @@ static int font_list_1 P_ ((struct frame *, Lisp_Object, Lisp_Object, | |||
| 510 | static int font_list P_ ((struct frame *, Lisp_Object, Lisp_Object, | 510 | static int font_list P_ ((struct frame *, Lisp_Object, Lisp_Object, |
| 511 | Lisp_Object, struct font_name **)); | 511 | Lisp_Object, struct font_name **)); |
| 512 | static int try_font_list P_ ((struct frame *, Lisp_Object *, | 512 | static int try_font_list P_ ((struct frame *, Lisp_Object *, |
| 513 | Lisp_Object, Lisp_Object, struct font_name **)); | 513 | Lisp_Object, Lisp_Object, struct font_name **, |
| 514 | int)); | ||
| 514 | static int try_alternative_families P_ ((struct frame *f, Lisp_Object, | 515 | static int try_alternative_families P_ ((struct frame *f, Lisp_Object, |
| 515 | Lisp_Object, struct font_name **)); | 516 | Lisp_Object, struct font_name **)); |
| 516 | static int cmp_font_names P_ ((const void *, const void *)); | 517 | static int cmp_font_names P_ ((const void *, const void *)); |
| @@ -6324,21 +6325,28 @@ try_alternative_families (f, family, registry, fonts) | |||
| 6324 | match. A value of nil means include fonts of any registry and | 6325 | match. A value of nil means include fonts of any registry and |
| 6325 | encoding. | 6326 | encoding. |
| 6326 | 6327 | ||
| 6328 | If PREFER_FACE_FAMILY is nonzero, perfer face's family to FAMILY. | ||
| 6329 | Otherwise, prefer FAMILY. | ||
| 6330 | |||
| 6327 | Return in *FONTS a pointer to a vector of font_name structures for | 6331 | Return in *FONTS a pointer to a vector of font_name structures for |
| 6328 | the fonts matched. Value is the number of fonts found. */ | 6332 | the fonts matched. Value is the number of fonts found. */ |
| 6329 | 6333 | ||
| 6330 | static int | 6334 | static int |
| 6331 | try_font_list (f, attrs, family, registry, fonts) | 6335 | try_font_list (f, attrs, family, registry, fonts, prefer_face_family) |
| 6332 | struct frame *f; | 6336 | struct frame *f; |
| 6333 | Lisp_Object *attrs; | 6337 | Lisp_Object *attrs; |
| 6334 | Lisp_Object family, registry; | 6338 | Lisp_Object family, registry; |
| 6335 | struct font_name **fonts; | 6339 | struct font_name **fonts; |
| 6340 | int prefer_face_family; | ||
| 6336 | { | 6341 | { |
| 6337 | int nfonts = 0; | 6342 | int nfonts = 0; |
| 6338 | Lisp_Object face_family = attrs[LFACE_FAMILY_INDEX]; | 6343 | Lisp_Object face_family = attrs[LFACE_FAMILY_INDEX]; |
| 6344 | Lisp_Object try_family; | ||
| 6345 | |||
| 6346 | try_family = prefer_face_family ? face_family : family; | ||
| 6339 | 6347 | ||
| 6340 | if (STRINGP (face_family)) | 6348 | if (STRINGP (try_family)) |
| 6341 | nfonts = try_alternative_families (f, face_family, registry, fonts); | 6349 | nfonts = try_alternative_families (f, try_family, registry, fonts); |
| 6342 | 6350 | ||
| 6343 | #ifdef MAC_OS | 6351 | #ifdef MAC_OS |
| 6344 | /* When realizing the default face and a font spec does not matched | 6352 | /* When realizing the default face and a font spec does not matched |
| @@ -6346,12 +6354,15 @@ try_font_list (f, attrs, family, registry, fonts) | |||
| 6346 | default font. On the Mac, this is mac-roman, which does not work | 6354 | default font. On the Mac, this is mac-roman, which does not work |
| 6347 | if the family is -etl-fixed, e.g. The following widens the | 6355 | if the family is -etl-fixed, e.g. The following widens the |
| 6348 | choices and fixes that problem. */ | 6356 | choices and fixes that problem. */ |
| 6349 | if (nfonts == 0 && STRINGP (face_family) && STRINGP (registry) | 6357 | if (nfonts == 0 && STRINGP (try_family) && STRINGP (registry) |
| 6350 | && xstricmp (SDATA (registry), "mac-roman") == 0) | 6358 | && xstricmp (SDATA (registry), "mac-roman") == 0) |
| 6351 | nfonts = try_alternative_families (f, face_family, Qnil, fonts); | 6359 | nfonts = try_alternative_families (f, try_family, Qnil, fonts); |
| 6352 | #endif | 6360 | #endif |
| 6353 | 6361 | ||
| 6354 | if (nfonts == 0 && !NILP (family)) | 6362 | if (! prefer_face_family) |
| 6363 | family = face_family; | ||
| 6364 | |||
| 6365 | if (nfonts == 0 && STRINGP (family)) | ||
| 6355 | nfonts = try_alternative_families (f, family, registry, fonts); | 6366 | nfonts = try_alternative_families (f, family, registry, fonts); |
| 6356 | 6367 | ||
| 6357 | /* Try font family of the default face or "fixed". */ | 6368 | /* Try font family of the default face or "fixed". */ |
| @@ -6425,7 +6436,9 @@ choose_face_font (f, attrs, fontset, c) | |||
| 6425 | 6436 | ||
| 6426 | /* Get a list of fonts matching that pattern and choose the | 6437 | /* Get a list of fonts matching that pattern and choose the |
| 6427 | best match for the specified face attributes from it. */ | 6438 | best match for the specified face attributes from it. */ |
| 6428 | nfonts = try_font_list (f, attrs, XCAR (pattern), XCDR (pattern), &fonts); | 6439 | nfonts = try_font_list (f, attrs, XCAR (pattern), XCDR (pattern), &fonts, |
| 6440 | (SINGLE_BYTE_CHAR_P (c) | ||
| 6441 | || CHAR_CHARSET (c) == charset_latin_iso8859_1)); | ||
| 6429 | width_ratio = (SINGLE_BYTE_CHAR_P (c) | 6442 | width_ratio = (SINGLE_BYTE_CHAR_P (c) |
| 6430 | ? 1 | 6443 | ? 1 |
| 6431 | : CHARSET_WIDTH (CHAR_CHARSET (c))); | 6444 | : CHARSET_WIDTH (CHAR_CHARSET (c))); |