diff options
| author | Eli Zaretskii | 2025-01-16 17:51:47 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2025-01-16 17:51:47 +0200 |
| commit | 8d471adecef540d49807dad114f7a11fb3fe2a95 (patch) | |
| tree | 1709a7054bc00539a61c461b9269c74be58b30a2 /src | |
| parent | b86b8f52a6fe91af239ddda73dc4d8ee32c26fc0 (diff) | |
| download | emacs-8d471adecef540d49807dad114f7a11fb3fe2a95.tar.gz emacs-8d471adecef540d49807dad114f7a11fb3fe2a95.zip | |
Fix subtle problem with updating 'font_style_table'
* src/font.c (font_style_to_value): Update the Vfont_* variables
to keep them in sync with their slots in 'font_style_table'.
(Bug#75521)
(syms_of_font): Comment on usage of DEFVAR_LISP_NOPRO.
Diffstat (limited to 'src')
| -rw-r--r-- | src/font.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/font.c b/src/font.c index 86382267a4a..d88757ee7a9 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -418,8 +418,24 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, | |||
| 418 | eassert (len < 255); | 418 | eassert (len < 255); |
| 419 | elt = make_vector (2, make_fixnum (100)); | 419 | elt = make_vector (2, make_fixnum (100)); |
| 420 | ASET (elt, 1, val); | 420 | ASET (elt, 1, val); |
| 421 | ASET (font_style_table, prop - FONT_WEIGHT_INDEX, | 421 | Lisp_Object new_table = CALLN (Fvconcat, table, make_vector (1, elt)); |
| 422 | CALLN (Fvconcat, table, make_vector (1, elt))); | 422 | /* Update the corresponding variable with the new value of the |
| 423 | modified slot of font_style_table. */ | ||
| 424 | switch (prop) | ||
| 425 | { | ||
| 426 | case FONT_WEIGHT_INDEX: | ||
| 427 | Vfont_weight_table = new_table; | ||
| 428 | break; | ||
| 429 | case FONT_SLANT_INDEX: | ||
| 430 | Vfont_slant_table = new_table; | ||
| 431 | break; | ||
| 432 | case FONT_WIDTH_INDEX: | ||
| 433 | Vfont_width_table = new_table; | ||
| 434 | break; | ||
| 435 | default: | ||
| 436 | break; | ||
| 437 | } | ||
| 438 | ASET (font_style_table, prop - FONT_WEIGHT_INDEX, new_table); | ||
| 423 | return (100 << 8) | (i << 4); | 439 | return (100 << 8) | (i << 4); |
| 424 | } | 440 | } |
| 425 | else | 441 | else |
| @@ -5977,6 +5993,9 @@ This variable cannot be set; trying to do so will signal an error. */); | |||
| 5977 | Vfont_width_table = BUILD_STYLE_TABLE (width_table); | 5993 | Vfont_width_table = BUILD_STYLE_TABLE (width_table); |
| 5978 | make_symbol_constant (intern_c_string ("font-width-table")); | 5994 | make_symbol_constant (intern_c_string ("font-width-table")); |
| 5979 | 5995 | ||
| 5996 | /* Because the above 3 variables are slots in the vector we create | ||
| 5997 | below, and because that vector is staticpro'd, we don't explicitly | ||
| 5998 | staticpro the variables, to avoid wasting slots in ststicvec[]. */ | ||
| 5980 | staticpro (&font_style_table); | 5999 | staticpro (&font_style_table); |
| 5981 | font_style_table = CALLN (Fvector, Vfont_weight_table, Vfont_slant_table, | 6000 | font_style_table = CALLN (Fvector, Vfont_weight_table, Vfont_slant_table, |
| 5982 | Vfont_width_table); | 6001 | Vfont_width_table); |