diff options
| author | Gerd Moellmann | 2001-02-13 15:23:17 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-02-13 15:23:17 +0000 |
| commit | 2e6621ca8cf108d51a84f1700aa44c90e7ebb82f (patch) | |
| tree | f52282c7f9983952522272291637c9e2c4f9ebea | |
| parent | 7cc9f69fd9764ed41fbcf8d11da8ec49dbf8c7c8 (diff) | |
| download | emacs-2e6621ca8cf108d51a84f1700aa44c90e7ebb82f.tar.gz emacs-2e6621ca8cf108d51a84f1700aa44c90e7ebb82f.zip | |
(best_matching_font): New parameter width_ratio.
Multiply avgwidth by width_ratio.
(choose_face_font): Call best_matching_font with width_ratio
calculated from the column width of C.
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/xfaces.c | 25 |
2 files changed, 23 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b87ddc0da78..91a3aec56f3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -3,6 +3,13 @@ | |||
| 3 | * dired.c (directory_files_internal): Initialize errno. | 3 | * dired.c (directory_files_internal): Initialize errno. |
| 4 | (toplevel): Include errno.h. | 4 | (toplevel): Include errno.h. |
| 5 | 5 | ||
| 6 | 2001-02-13 Kenichi Handa <handa@etl.go.jp> | ||
| 7 | |||
| 8 | * xfaces.c (best_matching_font): New parameter width_ratio. | ||
| 9 | Multiply avgwidth by width_ratio. | ||
| 10 | (choose_face_font): Call best_matching_font with width_ratio | ||
| 11 | calculated from the column width of C. | ||
| 12 | |||
| 6 | 2001-02-12 Andrew Innes <andrewi@gnu.org> | 13 | 2001-02-12 Andrew Innes <andrewi@gnu.org> |
| 7 | 14 | ||
| 8 | The following changes are to draw box lines inside characters area | 15 | The following changes are to draw box lines inside characters area |
diff --git a/src/xfaces.c b/src/xfaces.c index c649ec4f784..946d9024c9e 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -569,7 +569,7 @@ static Lisp_Object lface_from_face_name P_ ((struct frame *, Lisp_Object, int)); | |||
| 569 | static struct face *make_realized_face P_ ((Lisp_Object *)); | 569 | static struct face *make_realized_face P_ ((Lisp_Object *)); |
| 570 | static void free_realized_faces P_ ((struct face_cache *)); | 570 | static void free_realized_faces P_ ((struct face_cache *)); |
| 571 | static char *best_matching_font P_ ((struct frame *, Lisp_Object *, | 571 | static char *best_matching_font P_ ((struct frame *, Lisp_Object *, |
| 572 | struct font_name *, int)); | 572 | struct font_name *, int, int)); |
| 573 | static void cache_face P_ ((struct face_cache *, struct face *, unsigned)); | 573 | static void cache_face P_ ((struct face_cache *, struct face *, unsigned)); |
| 574 | static void uncache_face P_ ((struct face_cache *, struct face *)); | 574 | static void uncache_face P_ ((struct face_cache *, struct face *)); |
| 575 | static int xlfd_numeric_slant P_ ((struct font_name *)); | 575 | static int xlfd_numeric_slant P_ ((struct font_name *)); |
| @@ -5827,17 +5827,21 @@ may_use_scalable_font_p (font, name) | |||
| 5827 | 5827 | ||
| 5828 | 5828 | ||
| 5829 | 5829 | ||
| 5830 | /* Return the name of the best matching font for face attributes | 5830 | /* Return the name of the best matching font for face attributes ATTRS |
| 5831 | ATTRS in the array of font_name structures FONTS which contains | 5831 | in the array of font_name structures FONTS which contains NFONTS |
| 5832 | NFONTS elements. Value is a font name which is allocated from | 5832 | elements. WIDTH_RATIO is a factor with which to multiply average |
| 5833 | the heap. FONTS is freed by this function. */ | 5833 | widths if ATTRS specifies such a width. |
| 5834 | |||
| 5835 | Value is a font name which is allocated from the heap. FONTS is | ||
| 5836 | freed by this function. */ | ||
| 5834 | 5837 | ||
| 5835 | static char * | 5838 | static char * |
| 5836 | best_matching_font (f, attrs, fonts, nfonts) | 5839 | best_matching_font (f, attrs, fonts, nfonts, width_ratio) |
| 5837 | struct frame *f; | 5840 | struct frame *f; |
| 5838 | Lisp_Object *attrs; | 5841 | Lisp_Object *attrs; |
| 5839 | struct font_name *fonts; | 5842 | struct font_name *fonts; |
| 5840 | int nfonts; | 5843 | int nfonts; |
| 5844 | int width_ratio; | ||
| 5841 | { | 5845 | { |
| 5842 | char *font_name; | 5846 | char *font_name; |
| 5843 | struct font_name *best; | 5847 | struct font_name *best; |
| @@ -5868,7 +5872,7 @@ best_matching_font (f, attrs, fonts, nfonts) | |||
| 5868 | 5872 | ||
| 5869 | avgwidth = (UNSPECIFIEDP (attrs[LFACE_AVGWIDTH_INDEX]) | 5873 | avgwidth = (UNSPECIFIEDP (attrs[LFACE_AVGWIDTH_INDEX]) |
| 5870 | ? 0 | 5874 | ? 0 |
| 5871 | : XFASTINT (attrs[LFACE_AVGWIDTH_INDEX])); | 5875 | : XFASTINT (attrs[LFACE_AVGWIDTH_INDEX]) * width_ratio); |
| 5872 | 5876 | ||
| 5873 | exact_p = 0; | 5877 | exact_p = 0; |
| 5874 | 5878 | ||
| @@ -6027,7 +6031,7 @@ choose_face_font (f, attrs, fontset, c) | |||
| 6027 | Lisp_Object pattern; | 6031 | Lisp_Object pattern; |
| 6028 | char *font_name = NULL; | 6032 | char *font_name = NULL; |
| 6029 | struct font_name *fonts; | 6033 | struct font_name *fonts; |
| 6030 | int nfonts; | 6034 | int nfonts, width_ratio; |
| 6031 | 6035 | ||
| 6032 | /* Get (foundry and) family name and registry (and encoding) name of | 6036 | /* Get (foundry and) family name and registry (and encoding) name of |
| 6033 | a font for C. */ | 6037 | a font for C. */ |
| @@ -6052,7 +6056,10 @@ choose_face_font (f, attrs, fontset, c) | |||
| 6052 | best match for the specified face attributes from it. */ | 6056 | best match for the specified face attributes from it. */ |
| 6053 | nfonts = try_font_list (f, attrs, Qnil, XCAR (pattern), XCDR (pattern), | 6057 | nfonts = try_font_list (f, attrs, Qnil, XCAR (pattern), XCDR (pattern), |
| 6054 | &fonts); | 6058 | &fonts); |
| 6055 | font_name = best_matching_font (f, attrs, fonts, nfonts); | 6059 | width_ratio = (SINGLE_BYTE_CHAR_P (c) |
| 6060 | ? 1 | ||
| 6061 | : CHARSET_WIDTH (CHAR_CHARSET (c))); | ||
| 6062 | font_name = best_matching_font (f, attrs, fonts, nfonts, width_ratio); | ||
| 6056 | return font_name; | 6063 | return font_name; |
| 6057 | } | 6064 | } |
| 6058 | 6065 | ||