aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2003-04-09 08:35:07 +0000
committerKenichi Handa2003-04-09 08:35:07 +0000
commitc64d66eb3afaf6323cda2f1bde16df4ef25cf76d (patch)
treef5c8c25d3dc811306f49f2254df91519f3eb6371 /src
parent880cf180d910f61ed0a445e0e7f2a5537df9c442 (diff)
downloademacs-c64d66eb3afaf6323cda2f1bde16df4ef25cf76d.tar.gz
emacs-c64d66eb3afaf6323cda2f1bde16df4ef25cf76d.zip
(Vface_font_rescale_alist): Renamed from
Vface_resizing_fonts. (struct font_name): Rename member resizing_ratio to rescale_ratio. (font_rescale_ratio): Renamed from font_resizing_ratio. (split_font_name): Set font->rescale_ratio. (better_font_p): Pay attention to font->rescale_ratio. (build_scalable_font_name): Likewise. Change RESX, and RESY fields. (syms_of_xfaces): Declare Vface_font_rescale_alist as a Lisp variable.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog24
-rw-r--r--src/xfaces.c74
2 files changed, 61 insertions, 37 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a3b8c0d4d3a..b7c3c33061d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,27 @@
12003-04-09 Kenichi Handa <handa@etlken2>
2
3 The following changes are to make the font rescaling facility
4 compatible with Emacs 21.
5
6 * xfaces.c (Vface_font_rescale_alist): Renamed from
7 Vface_resizing_fonts.
8 (struct font_name): Rename member resizing_ratio to rescale_ratio.
9 (font_rescale_ratio): Renamed from font_resizing_ratio.
10 (split_font_name): Set font->rescale_ratio.
11 (better_font_p): Pay attention to font->rescale_ratio.
12 (build_scalable_font_name): Likewise. Change RESX, and RESY
13 fields.
14 (syms_of_xfaces): Declare Vface_font_rescale_alist as a Lisp
15 variable.
16
172003-03-28 Kenichi Handa <handa@etlken2>
18
19 * coding.c (Qutf_16_be_nosig, Qutf_16_be, Qutf_16_le_nosig)
20 (Qutf_16_le): Remove these variables.
21 (syms_of_coding): Don't DEFSYM them.
22 (decode_coding_utf_16): Fix handling of BOM.
23 (encode_coding_utf_16): Fix handling of BOM.
24
12003-03-14 Kenichi Handa <handa@m17n.org> 252003-03-14 Kenichi Handa <handa@m17n.org>
2 26
3 * fileio.c (Finsert_file_contents): On replacing, before decoding 27 * fileio.c (Finsert_file_contents): On replacing, before decoding
diff --git a/src/xfaces.c b/src/xfaces.c
index 277f1908810..cb976c33153 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -413,9 +413,9 @@ Lisp_Object Vscalable_fonts_allowed, Qscalable_fonts_allowed;
413 413
414Lisp_Object Vface_ignored_fonts; 414Lisp_Object Vface_ignored_fonts;
415 415
416/* Alist of font name patterns vs the resizing factor. */ 416/* Alist of font name patterns vs the rescaling factor. */
417 417
418Lisp_Object Vface_resizing_fonts; 418Lisp_Object Vface_font_rescale_alist;
419 419
420/* Maximum number of fonts to consider in font_list. If not an 420/* Maximum number of fonts to consider in font_list. If not an
421 integer > 0, DEFAULT_FONT_LIST_LIMIT is used instead. */ 421 integer > 0, DEFAULT_FONT_LIST_LIMIT is used instead. */
@@ -1882,10 +1882,10 @@ struct font_name
1882 split_font_name for which these are. */ 1882 split_font_name for which these are. */
1883 int numeric[XLFD_LAST]; 1883 int numeric[XLFD_LAST];
1884 1884
1885 /* If the original name matches one of Vface_resizing_fonts, the 1885 /* If the original name matches one of Vface_font_rescale_alist,
1886 value is the corresponding resizing ratio. Otherwise, the value 1886 the value is the corresponding rescale ratio. Otherwise, the
1887 is 1.0. */ 1887 value is 1.0. */
1888 double resizing_ratio; 1888 double rescale_ratio;
1889 1889
1890 /* Lower value mean higher priority. */ 1890 /* Lower value mean higher priority. */
1891 int registry_priority; 1891 int registry_priority;
@@ -2274,22 +2274,19 @@ pixel_point_size (f, pixel)
2274} 2274}
2275 2275
2276 2276
2277/* Return a resizing ratio of a font of NAME. */ 2277/* Return a rescaling ratio of a font of NAME. */
2278 2278
2279static INLINE double 2279static double
2280font_resizing_ratio (char *name) 2280font_rescale_ratio (char *name)
2281{ 2281{
2282 Lisp_Object tail, elt; 2282 Lisp_Object tail, elt;
2283 2283
2284 if (CONSP (Vface_resizing_fonts)) 2284 for (tail = Vface_font_rescale_alist; CONSP (tail); tail = XCDR (tail))
2285 { 2285 {
2286 for (tail = Vface_resizing_fonts; CONSP (tail); tail = XCDR (tail)) 2286 elt = XCAR (tail);
2287 { 2287 if (STRINGP (XCAR (elt)) && FLOATP (XCDR (elt))
2288 elt = XCAR (tail); 2288 && fast_c_string_match_ignore_case (XCAR (elt), name) >= 0)
2289 if (STRINGP (XCAR (elt)) && FLOATP (XCDR (elt)) 2289 return XFLOAT_DATA (XCDR (elt));
2290 && fast_c_string_match_ignore_case (XCAR (elt), name) >= 0)
2291 return XFLOAT_DATA (XCDR (elt));
2292 }
2293 } 2290 }
2294 return 1.0; 2291 return 1.0;
2295} 2292}
@@ -2311,10 +2308,11 @@ split_font_name (f, font, numeric_p)
2311{ 2308{
2312 int i = 0; 2309 int i = 0;
2313 int success_p; 2310 int success_p;
2314 double resizing_ratio = 1.0; 2311 double rescale_ratio;
2315 2312
2316 if (numeric_p && CONSP (Vface_resizing_fonts)) 2313 if (numeric_p)
2317 resizing_ratio = font_resizing_ratio (font->name); 2314 /* This must be done before splitting the font name. */
2315 rescale_ratio = font_rescale_ratio (font->name);
2318 2316
2319 if (*font->name == '-') 2317 if (*font->name == '-')
2320 { 2318 {
@@ -2374,7 +2372,7 @@ split_font_name (f, font, numeric_p)
2374 font->numeric[XLFD_WEIGHT] = xlfd_numeric_weight (font); 2372 font->numeric[XLFD_WEIGHT] = xlfd_numeric_weight (font);
2375 font->numeric[XLFD_SWIDTH] = xlfd_numeric_swidth (font); 2373 font->numeric[XLFD_SWIDTH] = xlfd_numeric_swidth (font);
2376 font->numeric[XLFD_AVGWIDTH] = atoi (font->fields[XLFD_AVGWIDTH]); 2374 font->numeric[XLFD_AVGWIDTH] = atoi (font->fields[XLFD_AVGWIDTH]);
2377 font->resizing_ratio = resizing_ratio; 2375 font->rescale_ratio = rescale_ratio;
2378 } 2376 }
2379 2377
2380 /* Initialize it to zero. It will be overridden by font_list while 2378 /* Initialize it to zero. It will be overridden by font_list while
@@ -5848,9 +5846,9 @@ better_font_p (values, font1, font2, compare_pt_p, avgwidth)
5848 if (xlfd_idx == XLFD_POINT_SIZE) 5846 if (xlfd_idx == XLFD_POINT_SIZE)
5849 { 5847 {
5850 delta1 = abs (values[i] - (font1->numeric[xlfd_idx] 5848 delta1 = abs (values[i] - (font1->numeric[xlfd_idx]
5851 / font1->resizing_ratio)); 5849 / font1->rescale_ratio));
5852 delta2 = abs (values[i] - (font2->numeric[xlfd_idx] 5850 delta2 = abs (values[i] - (font2->numeric[xlfd_idx]
5853 / font2->resizing_ratio)); 5851 / font2->rescale_ratio));
5854 if (abs (delta1 - delta2) < FONT_POINT_SIZE_QUANTUM) 5852 if (abs (delta1 - delta2) < FONT_POINT_SIZE_QUANTUM)
5855 continue; 5853 continue;
5856 } 5854 }
@@ -5943,20 +5941,21 @@ build_scalable_font_name (f, font, specified_pt)
5943 pixel_value = resy / (PT_PER_INCH * 10.0) * pt; 5941 pixel_value = resy / (PT_PER_INCH * 10.0) * pt;
5944 } 5942 }
5945 /* We may need a font of the different size. */ 5943 /* We may need a font of the different size. */
5946 pixel_value *= font->resizing_ratio; 5944 pixel_value *= font->rescale_ratio;
5947
5948 /* Set pixel size. */
5949 sprintf (pixel_size, "%d", pixel_value);
5950 font->fields[XLFD_PIXEL_SIZE] = pixel_size;
5951 font->numeric[XLFD_PIXEL_SIZE] = pixel_value;
5952 5945
5953 /* We don't have to change POINT_SIZE, RESX, and RESY of the font 5946 /* We should keep POINT_SIZE 0. Otherwise, X server can't open a
5954 name. */ 5947 font of the specified PIXEL_SIZE. */
5955#if 0 5948#if 0
5956 /* Set point size of the font. */ 5949 /* Set point size of the font. */
5957 sprintf (point_size, "%d", (int) pt); 5950 sprintf (point_size, "%d", (int) pt);
5958 font->fields[XLFD_POINT_SIZE] = point_size; 5951 font->fields[XLFD_POINT_SIZE] = point_size;
5959 font->numeric[XLFD_POINT_SIZE] = pt; 5952 font->numeric[XLFD_POINT_SIZE] = pt;
5953#endif
5954
5955 /* Set pixel size. */
5956 sprintf (pixel_size, "%d", pixel_value);
5957 font->fields[XLFD_PIXEL_SIZE] = pixel_size;
5958 font->numeric[XLFD_PIXEL_SIZE] = pixel_value;
5960 5959
5961 /* If font doesn't specify its resolution, use the 5960 /* If font doesn't specify its resolution, use the
5962 resolution of the display. */ 5961 resolution of the display. */
@@ -5976,7 +5975,6 @@ build_scalable_font_name (f, font, specified_pt)
5976 font->fields[XLFD_RESX] = buffer; 5975 font->fields[XLFD_RESX] = buffer;
5977 font->numeric[XLFD_RESX] = resx; 5976 font->numeric[XLFD_RESX] = resx;
5978 } 5977 }
5979#endif
5980 5978
5981 return build_font_name (font); 5979 return build_font_name (font);
5982} 5980}
@@ -7570,13 +7568,15 @@ Each element is a regular expression that matches names of fonts to
7570ignore. */); 7568ignore. */);
7571 Vface_ignored_fonts = Qnil; 7569 Vface_ignored_fonts = Qnil;
7572 7570
7573 DEFVAR_LISP ("face-resizing-fonts", &Vface_resizing_fonts, 7571
7574 doc: /* Alist of fonts vs the resizing factors. 7572 DEFVAR_LISP ("face-font-rescale-alist", &Vface_font_rescale_alist,
7575Each element is a cons (FONT-NAME-PATTERN . RESIZING-RATIO), where 7573 doc: /* Alist of fonts vs the rescaling factors.
7574Each element is a cons (FONT-NAME-PATTERN . RESCALE-RATIO), where
7576FONT-NAME-PATTERN is a regular expression matching a font name, and 7575FONT-NAME-PATTERN is a regular expression matching a font name, and
7577RESIZING-RATIO is a floating point number to specify how much larger 7576RESCALE-RATIO is a floating point number to specify how much larger
7578\(or smaller) font we should use. For instance, if a face requests 7577\(or smaller) font we should use. For instance, if a face requests
7579a font of 10 point, we actually use a font of 10 * RESIZING-FACE points. */); 7578a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point. */);
7579 Vface_font_rescale_alist = Qnil;
7580 7580
7581#ifdef HAVE_WINDOW_SYSTEM 7581#ifdef HAVE_WINDOW_SYSTEM
7582 defsubr (&Sbitmap_spec_p); 7582 defsubr (&Sbitmap_spec_p);