diff options
| author | Kenichi Handa | 2000-06-20 11:22:32 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2000-06-20 11:22:32 +0000 |
| commit | 11d9bd93ed8439d67734e77503a45481fc61a7c5 (patch) | |
| tree | a5cecb46c88b7bd5d3d2186666a628735e557459 /src | |
| parent | 68a5e97b84b4703c8cdcc1aca820cb08c5880429 (diff) | |
| download | emacs-11d9bd93ed8439d67734e77503a45481fc61a7c5.tar.gz emacs-11d9bd93ed8439d67734e77503a45481fc61a7c5.zip | |
(FONTSET_ASCII): Use the first element of char table
for an ASCII font, not defalt slot.
(fontset_ref_via_base): If FONTSET doesn't contain information for
C, try the default fontset.
(make_fontset): Don't copy the default fontset.
(fontset_font_pattern): Likewise.
(accumulate_font_info): If ELT is nil, use the corresponding
element in the default fontset.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fontset.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/fontset.c b/src/fontset.c index 4df99116f9a..3f26c7958ff 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -73,11 +73,8 @@ Boston, MA 02111-1307, USA. */ | |||
| 73 | for displaying the correspnding character. | 73 | for displaying the correspnding character. |
| 74 | 74 | ||
| 75 | All single byte charaters (ASCII and 8bit-unibyte) share the same | 75 | All single byte charaters (ASCII and 8bit-unibyte) share the same |
| 76 | element in a fontset. The element is stored in `defalt' slot of | 76 | element in a fontset. The element is stored in the first element |
| 77 | the fontset. And this slot is never used as a default value of | 77 | of the fontset. |
| 78 | multibyte characters. That means that the first 256 elements of a | ||
| 79 | fontset are always nil (as this is not efficient, we may implement | ||
| 80 | a fontset in a different way in the future). | ||
| 81 | 78 | ||
| 82 | To access or set each element, use macros FONTSET_REF and | 79 | To access or set each element, use macros FONTSET_REF and |
| 83 | FONTSET_SET respectively for efficiency. | 80 | FONTSET_SET respectively for efficiency. |
| @@ -201,7 +198,7 @@ static Lisp_Object font_family_registry P_ ((Lisp_Object)); | |||
| 201 | #define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0] | 198 | #define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0] |
| 202 | #define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] | 199 | #define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] |
| 203 | #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[2] | 200 | #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[2] |
| 204 | #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->defalt | 201 | #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->contents[0] |
| 205 | #define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->parent | 202 | #define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->parent |
| 206 | 203 | ||
| 207 | #define BASE_FONTSET_P(fontset) NILP (FONTSET_BASE(fontset)) | 204 | #define BASE_FONTSET_P(fontset) NILP (FONTSET_BASE(fontset)) |
| @@ -257,6 +254,8 @@ fontset_ref_via_base (fontset, c) | |||
| 257 | return FONTSET_ASCII (fontset); | 254 | return FONTSET_ASCII (fontset); |
| 258 | 255 | ||
| 259 | elt = FONTSET_REF (FONTSET_BASE (fontset), *c); | 256 | elt = FONTSET_REF (FONTSET_BASE (fontset), *c); |
| 257 | if (NILP (elt) && ! EQ (fontset, Vdefault_fontset)) | ||
| 258 | elt = FONTSET_REF (Vdefault_fontset, *c); | ||
| 260 | if (NILP (elt)) | 259 | if (NILP (elt)) |
| 261 | return Qnil; | 260 | return Qnil; |
| 262 | 261 | ||
| @@ -343,10 +342,7 @@ make_fontset (frame, name, base) | |||
| 343 | Vfontset_table = tem; | 342 | Vfontset_table = tem; |
| 344 | } | 343 | } |
| 345 | 344 | ||
| 346 | if (NILP (base)) | 345 | fontset = Fmake_char_table (Qfontset, Qnil); |
| 347 | fontset = Fcopy_sequence (Vdefault_fontset); | ||
| 348 | else | ||
| 349 | fontset = Fmake_char_table (Qfontset, Qnil); | ||
| 350 | 346 | ||
| 351 | FONTSET_ID (fontset) = make_number (id); | 347 | FONTSET_ID (fontset) = make_number (id); |
| 352 | FONTSET_NAME (fontset) = name; | 348 | FONTSET_NAME (fontset) = name; |
| @@ -545,7 +541,7 @@ fontset_font_pattern (f, id, c) | |||
| 545 | fontset = FONTSET_BASE (fontset); | 541 | fontset = FONTSET_BASE (fontset); |
| 546 | elt = FONTSET_REF (fontset, c); | 542 | elt = FONTSET_REF (fontset, c); |
| 547 | } | 543 | } |
| 548 | else | 544 | if (NILP (elt)) |
| 549 | elt = FONTSET_REF (Vdefault_fontset, c); | 545 | elt = FONTSET_REF (Vdefault_fontset, c); |
| 550 | 546 | ||
| 551 | if (!CONSP (elt)) | 547 | if (!CONSP (elt)) |
| @@ -1190,6 +1186,8 @@ accumulate_font_info (arg, character, elt) | |||
| 1190 | { | 1186 | { |
| 1191 | Lisp_Object last, last_char, last_elt, tmp; | 1187 | Lisp_Object last, last_char, last_elt, tmp; |
| 1192 | 1188 | ||
| 1189 | if (!CONSP (elt) && !SINGLE_BYTE_CHAR_P (XINT (character))) | ||
| 1190 | elt = FONTSET_REF (Vdefault_fontset, XINT (character)); | ||
| 1193 | if (!CONSP (elt)) | 1191 | if (!CONSP (elt)) |
| 1194 | return; | 1192 | return; |
| 1195 | last = XCAR (arg); | 1193 | last = XCAR (arg); |
| @@ -1208,13 +1206,12 @@ accumulate_font_info (arg, character, elt) | |||
| 1208 | return; | 1206 | return; |
| 1209 | } | 1207 | } |
| 1210 | } | 1208 | } |
| 1211 | else | 1209 | else if (XINT (last_char) == XINT (character)) |
| 1210 | return; | ||
| 1211 | else if (this_charset == CHAR_CHARSET (XINT (last_char))) | ||
| 1212 | { | 1212 | { |
| 1213 | if (this_charset == CHAR_CHARSET (XINT (last_char))) | 1213 | XCAR (XCAR (last)) = Fcons (last_char, character); |
| 1214 | { | 1214 | return; |
| 1215 | XCAR (XCAR (last)) = Fcons (last_char, character); | ||
| 1216 | return; | ||
| 1217 | } | ||
| 1218 | } | 1215 | } |
| 1219 | } | 1216 | } |
| 1220 | XCDR (last) = Fcons (Fcons (character, Fcons (elt, Qnil)), Qnil); | 1217 | XCDR (last) = Fcons (Fcons (character, Fcons (elt, Qnil)), Qnil); |
| @@ -1257,7 +1254,7 @@ If FRAME is omitted, it defaults to the currently selected frame.") | |||
| 1257 | CHECK_LIVE_FRAME (frame, 1); | 1254 | CHECK_LIVE_FRAME (frame, 1); |
| 1258 | f = XFRAME (frame); | 1255 | f = XFRAME (frame); |
| 1259 | 1256 | ||
| 1260 | /* Recodeq realized fontsets whose base is FONTSET in the table | 1257 | /* Recode realized fontsets whose base is FONTSET in the table |
| 1261 | `realized'. */ | 1258 | `realized'. */ |
| 1262 | realized = (Lisp_Object *) alloca (sizeof (Lisp_Object) | 1259 | realized = (Lisp_Object *) alloca (sizeof (Lisp_Object) |
| 1263 | * ASIZE (Vfontset_table)); | 1260 | * ASIZE (Vfontset_table)); |
| @@ -1281,7 +1278,7 @@ If FRAME is omitted, it defaults to the currently selected frame.") | |||
| 1281 | val = XCDR (val); | 1278 | val = XCDR (val); |
| 1282 | 1279 | ||
| 1283 | /* For each FONT-INFO, if CHAR_OR_RANGE (car part) is a generic | 1280 | /* For each FONT-INFO, if CHAR_OR_RANGE (car part) is a generic |
| 1284 | character for a charset, replace it wiht the charset symbol. If | 1281 | character for a charset, replace it with the charset symbol. If |
| 1285 | fonts are opened for FONT-SPEC, append the names of the fonts to | 1282 | fonts are opened for FONT-SPEC, append the names of the fonts to |
| 1286 | FONT-SPEC. */ | 1283 | FONT-SPEC. */ |
| 1287 | for (tail = val; CONSP (tail); tail = XCDR (tail)) | 1284 | for (tail = val; CONSP (tail); tail = XCDR (tail)) |