diff options
| author | Kenichi Handa | 1997-05-28 04:36:21 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-05-28 04:36:21 +0000 |
| commit | afbee0fa30ce6494899b9dc690147c11f68ac223 (patch) | |
| tree | ed156957764913e9a538ac4cb435f48bd8c17480 /src/fontset.c | |
| parent | 71c27002d8a8cf10248b8c8e449e4dbf2e2363b9 (diff) | |
| download | emacs-afbee0fa30ce6494899b9dc690147c11f68ac223.tar.gz emacs-afbee0fa30ce6494899b9dc690147c11f68ac223.zip | |
(fs_load_font): Before using a fontset, be sure to
load the ASCII font of the fontset. Size and height of a fontset
is set to the same as those of the ASCII font of the fontset. Use
macro FONT_ENCODING_NOT_DECIDED.
Diffstat (limited to 'src/fontset.c')
| -rw-r--r-- | src/fontset.c | 87 |
1 files changed, 52 insertions, 35 deletions
diff --git a/src/fontset.c b/src/fontset.c index 3a59a64a409..b0a6ed1fa8a 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -149,11 +149,23 @@ fs_load_font (f, font_table, charset, fontname, fontset) | |||
| 149 | /* No way to get fontname. */ | 149 | /* No way to get fontname. */ |
| 150 | return 0; | 150 | return 0; |
| 151 | 151 | ||
| 152 | /* If a fontset is specified and we have already loaded some fonts | 152 | /* If CHARSET is not ASCII and FONTSET is specified, we must load a |
| 153 | in the fontset, we need a font of appropriate size to be used | 153 | font of appropriate size to be used with other fonts in this |
| 154 | with the fonts. */ | 154 | fontset. */ |
| 155 | if (fontsetp && fontsetp->size) | 155 | if (charset != CHARSET_ASCII && fontsetp) |
| 156 | size = fontsetp->size * CHARSET_WIDTH (charset); | 156 | { |
| 157 | /* If we have not yet loaded ASCII font of FONTSET, we must load | ||
| 158 | it now to decided the size and height of this fontset. */ | ||
| 159 | if (fontsetp->size == 0) | ||
| 160 | { | ||
| 161 | fontp = fs_load_font (f, font_table, CHARSET_ASCII, 0, fontset); | ||
| 162 | if (!fontp) | ||
| 163 | /* Any fontset should contain avairable ASCII. */ | ||
| 164 | return 0; | ||
| 165 | } | ||
| 166 | /* Now we have surely decided the size of this fontset. */ | ||
| 167 | size = fontsetp->size * CHARSET_WIDTH (charset); | ||
| 168 | } | ||
| 157 | 169 | ||
| 158 | fontp = (*load_font_func) (f, fontname, size); | 170 | fontp = (*load_font_func) (f, fontname, size); |
| 159 | 171 | ||
| @@ -168,7 +180,7 @@ fs_load_font (f, font_table, charset, fontname, fontset) | |||
| 168 | not set by (*load_font_func). */ | 180 | not set by (*load_font_func). */ |
| 169 | fontp->charset = charset; | 181 | fontp->charset = charset; |
| 170 | 182 | ||
| 171 | if (fontp->encoding[1] != 4) | 183 | if (fontp->encoding[1] != FONT_ENCODING_NOT_DECIDED) |
| 172 | { | 184 | { |
| 173 | /* The font itself tells which code points to be used. Use this | 185 | /* The font itself tells which code points to be used. Use this |
| 174 | encoding for all other charsets. */ | 186 | encoding for all other charsets. */ |
| @@ -225,46 +237,51 @@ fs_load_font (f, font_table, charset, fontname, fontset) | |||
| 225 | } | 237 | } |
| 226 | } | 238 | } |
| 227 | 239 | ||
| 240 | /* If FONTSET is specified, setup various fields of it. */ | ||
| 228 | if (fontsetp) | 241 | if (fontsetp) |
| 229 | { | 242 | { |
| 230 | fontsetp->font_indexes[charset] = fontp->font_idx; | 243 | fontsetp->font_indexes[charset] = fontp->font_idx; |
| 231 | if (fontsetp->size == 0) | 244 | if (charset == CHARSET_ASCII) |
| 232 | fontsetp->size = fontp->size / CHARSET_WIDTH (charset); | ||
| 233 | |||
| 234 | if (charset == CHARSET_ASCII | ||
| 235 | && fontsetp->size != fontp->size) | ||
| 236 | { | 245 | { |
| 237 | /* When loading ASCII font of the different size from the | 246 | /* Decide or change the size and height of this fontset. */ |
| 238 | size of FONTSET, we have to update the size of FONTSET. | 247 | if (fontsetp->size == 0) |
| 239 | Since changing the size of FONTSET may make some fonts | ||
| 240 | already loaded inappropriate to be used in FONTSET, we | ||
| 241 | must delete the record of such fonts. In that case, we | ||
| 242 | also have to calculate the height of FONTSET from the | ||
| 243 | remaining fonts. */ | ||
| 244 | int i; | ||
| 245 | |||
| 246 | fontsetp->size = fontp->size; | ||
| 247 | fontsetp->height = fontp->height; | ||
| 248 | for (i = CHARSET_ASCII + 1; i <= MAX_CHARSET; i++) | ||
| 249 | { | 248 | { |
| 250 | font_idx = fontsetp->font_indexes[i]; | 249 | fontsetp->size = fontp->size; |
| 251 | if (font_idx >= 0) | 250 | fontsetp->height = fontp->height; |
| 251 | } | ||
| 252 | else if (fontsetp->size != fontp->size | ||
| 253 | || fontsetp->height != fontp->height) | ||
| 254 | { | ||
| 255 | /* When loading ASCII font of the different size from | ||
| 256 | the size of FONTSET, we have to update the size of | ||
| 257 | FONTSET. Since changing the size of FONTSET may make | ||
| 258 | some fonts already loaded inappropriate to be used in | ||
| 259 | FONTSET, we must delete the record of such fonts. In | ||
| 260 | that case, we also have to calculate the height of | ||
| 261 | FONTSET from the remaining fonts. */ | ||
| 262 | int i; | ||
| 263 | |||
| 264 | fontsetp->size = fontp->size; | ||
| 265 | fontsetp->height = fontp->height; | ||
| 266 | for (i = CHARSET_ASCII + 1; i <= MAX_CHARSET; i++) | ||
| 252 | { | 267 | { |
| 253 | struct font_info *fontp2 = font_table + font_idx; | 268 | font_idx = fontsetp->font_indexes[i]; |
| 254 | 269 | if (font_idx >= 0) | |
| 255 | if (fontp2->size != fontp->size * CHARSET_WIDTH (i)) | 270 | { |
| 256 | fontsetp->font_indexes[i] = FONT_NOT_OPENED; | 271 | struct font_info *fontp2 = font_table + font_idx; |
| 257 | /* The following code should be disabled until Emacs | 272 | |
| 258 | supports variable height lines. */ | 273 | if (fontp2->size != fontp->size * CHARSET_WIDTH (i)) |
| 274 | fontsetp->font_indexes[i] = FONT_NOT_OPENED; | ||
| 275 | /* The following code should be disabled until | ||
| 276 | Emacs supports variable height lines. */ | ||
| 259 | #if 0 | 277 | #if 0 |
| 260 | else if (fontsetp->height < fontp->height) | 278 | else if (fontsetp->height < fontp->height) |
| 261 | fontsetp->height = fontp->height; | 279 | fontsetp->height = fontp->height; |
| 262 | #endif | 280 | #endif |
| 281 | } | ||
| 263 | } | 282 | } |
| 264 | } | 283 | } |
| 265 | } | 284 | } |
| 266 | else if (fontsetp->height < fontp->height) | ||
| 267 | fontsetp->height = fontp->height; | ||
| 268 | } | 285 | } |
| 269 | 286 | ||
| 270 | return fontp; | 287 | return fontp; |