413 |
|
|
414 |
Lisp_Object Vface_ignored_fonts; |
Lisp_Object Vface_ignored_fonts; |
415 |
|
|
416 |
/* Alist of font name patterns vs the resizing factor. */ |
/* Alist of font name patterns vs the rescaling factor. */ |
417 |
|
|
418 |
Lisp_Object Vface_resizing_fonts; |
Lisp_Object Vface_font_rescale_alist; |
419 |
|
|
420 |
/* Maximum number of fonts to consider in font_list. If not an |
/* Maximum number of fonts to consider in font_list. If not an |
421 |
integer > 0, DEFAULT_FONT_LIST_LIMIT is used instead. */ |
integer > 0, DEFAULT_FONT_LIST_LIMIT is used instead. */ |
1882 |
split_font_name for which these are. */ |
split_font_name for which these are. */ |
1883 |
int numeric[XLFD_LAST]; |
int numeric[XLFD_LAST]; |
1884 |
|
|
1885 |
/* If the original name matches one of Vface_resizing_fonts, the |
/* If the original name matches one of Vface_font_rescale_alist, |
1886 |
value is the corresponding resizing ratio. Otherwise, the value |
the value is the corresponding rescale ratio. Otherwise, the |
1887 |
is 1.0. */ |
value is 1.0. */ |
1888 |
double resizing_ratio; |
double rescale_ratio; |
1889 |
|
|
1890 |
/* Lower value mean higher priority. */ |
/* Lower value mean higher priority. */ |
1891 |
int registry_priority; |
int registry_priority; |
2274 |
} |
} |
2275 |
|
|
2276 |
|
|
2277 |
/* Return a resizing ratio of a font of NAME. */ |
/* Return a rescaling ratio of a font of NAME. */ |
2278 |
|
|
2279 |
static INLINE double |
static double |
2280 |
font_resizing_ratio (char *name) |
font_rescale_ratio (char *name) |
2281 |
{ |
{ |
2282 |
Lisp_Object tail, elt; |
Lisp_Object tail, elt; |
2283 |
|
|
2284 |
if (CONSP (Vface_resizing_fonts)) |
for (tail = Vface_font_rescale_alist; CONSP (tail); tail = XCDR (tail)) |
2285 |
{ |
{ |
2286 |
for (tail = Vface_resizing_fonts; CONSP (tail); tail = XCDR (tail)) |
elt = XCAR (tail); |
2287 |
{ |
if (STRINGP (XCAR (elt)) && FLOATP (XCDR (elt)) |
2288 |
elt = XCAR (tail); |
&& fast_c_string_match_ignore_case (XCAR (elt), name) >= 0) |
2289 |
if (STRINGP (XCAR (elt)) && FLOATP (XCDR (elt)) |
return XFLOAT_DATA (XCDR (elt)); |
|
&& fast_c_string_match_ignore_case (XCAR (elt), name) >= 0) |
|
|
return XFLOAT_DATA (XCDR (elt)); |
|
|
} |
|
2290 |
} |
} |
2291 |
return 1.0; |
return 1.0; |
2292 |
} |
} |
2308 |
{ |
{ |
2309 |
int i = 0; |
int i = 0; |
2310 |
int success_p; |
int success_p; |
2311 |
double resizing_ratio = 1.0; |
double rescale_ratio; |
2312 |
|
|
2313 |
if (numeric_p && CONSP (Vface_resizing_fonts)) |
if (numeric_p) |
2314 |
resizing_ratio = font_resizing_ratio (font->name); |
/* This must be done before splitting the font name. */ |
2315 |
|
rescale_ratio = font_rescale_ratio (font->name); |
2316 |
|
|
2317 |
if (*font->name == '-') |
if (*font->name == '-') |
2318 |
{ |
{ |
2372 |
font->numeric[XLFD_WEIGHT] = xlfd_numeric_weight (font); |
font->numeric[XLFD_WEIGHT] = xlfd_numeric_weight (font); |
2373 |
font->numeric[XLFD_SWIDTH] = xlfd_numeric_swidth (font); |
font->numeric[XLFD_SWIDTH] = xlfd_numeric_swidth (font); |
2374 |
font->numeric[XLFD_AVGWIDTH] = atoi (font->fields[XLFD_AVGWIDTH]); |
font->numeric[XLFD_AVGWIDTH] = atoi (font->fields[XLFD_AVGWIDTH]); |
2375 |
font->resizing_ratio = resizing_ratio; |
font->rescale_ratio = rescale_ratio; |
2376 |
} |
} |
2377 |
|
|
2378 |
/* Initialize it to zero. It will be overridden by font_list while |
/* Initialize it to zero. It will be overridden by font_list while |
5846 |
if (xlfd_idx == XLFD_POINT_SIZE) |
if (xlfd_idx == XLFD_POINT_SIZE) |
5847 |
{ |
{ |
5848 |
delta1 = abs (values[i] - (font1->numeric[xlfd_idx] |
delta1 = abs (values[i] - (font1->numeric[xlfd_idx] |
5849 |
/ font1->resizing_ratio)); |
/ font1->rescale_ratio)); |
5850 |
delta2 = abs (values[i] - (font2->numeric[xlfd_idx] |
delta2 = abs (values[i] - (font2->numeric[xlfd_idx] |
5851 |
/ font2->resizing_ratio)); |
/ font2->rescale_ratio)); |
5852 |
if (abs (delta1 - delta2) < FONT_POINT_SIZE_QUANTUM) |
if (abs (delta1 - delta2) < FONT_POINT_SIZE_QUANTUM) |
5853 |
continue; |
continue; |
5854 |
} |
} |
5941 |
pixel_value = resy / (PT_PER_INCH * 10.0) * pt; |
pixel_value = resy / (PT_PER_INCH * 10.0) * pt; |
5942 |
} |
} |
5943 |
/* We may need a font of the different size. */ |
/* We may need a font of the different size. */ |
5944 |
pixel_value *= font->resizing_ratio; |
pixel_value *= font->rescale_ratio; |
|
|
|
|
/* Set pixel size. */ |
|
|
sprintf (pixel_size, "%d", pixel_value); |
|
|
font->fields[XLFD_PIXEL_SIZE] = pixel_size; |
|
|
font->numeric[XLFD_PIXEL_SIZE] = pixel_value; |
|
5945 |
|
|
5946 |
/* We don't have to change POINT_SIZE, RESX, and RESY of the font |
/* We should keep POINT_SIZE 0. Otherwise, X server can't open a |
5947 |
name. */ |
font of the specified PIXEL_SIZE. */ |
5948 |
#if 0 |
#if 0 |
5949 |
/* Set point size of the font. */ |
/* Set point size of the font. */ |
5950 |
sprintf (point_size, "%d", (int) pt); |
sprintf (point_size, "%d", (int) pt); |
5951 |
font->fields[XLFD_POINT_SIZE] = point_size; |
font->fields[XLFD_POINT_SIZE] = point_size; |
5952 |
font->numeric[XLFD_POINT_SIZE] = pt; |
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; |
5959 |
|
|
5960 |
/* If font doesn't specify its resolution, use the |
/* If font doesn't specify its resolution, use the |
5961 |
resolution of the display. */ |
resolution of the display. */ |
5975 |
font->fields[XLFD_RESX] = buffer; |
font->fields[XLFD_RESX] = buffer; |
5976 |
font->numeric[XLFD_RESX] = resx; |
font->numeric[XLFD_RESX] = resx; |
5977 |
} |
} |
|
#endif |
|
5978 |
|
|
5979 |
return build_font_name (font); |
return build_font_name (font); |
5980 |
} |
} |
7568 |
ignore. */); |
ignore. */); |
7569 |
Vface_ignored_fonts = Qnil; |
Vface_ignored_fonts = Qnil; |
7570 |
|
|
7571 |
DEFVAR_LISP ("face-resizing-fonts", &Vface_resizing_fonts, |
|
7572 |
doc: /* Alist of fonts vs the resizing factors. |
DEFVAR_LISP ("face-font-rescale-alist", &Vface_font_rescale_alist, |
7573 |
Each element is a cons (FONT-NAME-PATTERN . RESIZING-RATIO), where |
doc: /* Alist of fonts vs the rescaling factors. |
7574 |
|
Each element is a cons (FONT-NAME-PATTERN . RESCALE-RATIO), where |
7575 |
FONT-NAME-PATTERN is a regular expression matching a font name, and |
FONT-NAME-PATTERN is a regular expression matching a font name, and |
7576 |
RESIZING-RATIO is a floating point number to specify how much larger |
RESCALE-RATIO is a floating point number to specify how much larger |
7577 |
\(or smaller) font we should use. For instance, if a face requests |
\(or smaller) font we should use. For instance, if a face requests |
7578 |
a font of 10 point, we actually use a font of 10 * RESIZING-FACE points. */); |
a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point. */); |
7579 |
|
Vface_font_rescale_alist = Qnil; |
7580 |
|
|
7581 |
#ifdef HAVE_WINDOW_SYSTEM |
#ifdef HAVE_WINDOW_SYSTEM |
7582 |
defsubr (&Sbitmap_spec_p); |
defsubr (&Sbitmap_spec_p); |