aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2002-03-01 04:15:33 +0000
committerKenichi Handa2002-03-01 04:15:33 +0000
commit8a78c965db72e3b59534d96ecc465d6be8525b06 (patch)
tree326501aea8cba3abdd18412cac92fb9373e7dc8a /src
parentf8b185be36c596318edcd61b8fa2b97a3a0bb8f4 (diff)
downloademacs-8a78c965db72e3b59534d96ecc465d6be8525b06.tar.gz
emacs-8a78c965db72e3b59534d96ecc465d6be8525b06.zip
Include "character.h".
(x_encode_char): New argument CHARSET. Caller changed. (x_get_char_face_and_encoding): Call ENCODE_CHAR instead of SPLIT_CHAR. (x_get_glyph_face_and_encoding): Likewise. (x_produce_glyphs): Don't check Vnonascii_translation_table Call CHAR_WIDTH instead of CHARSET_WIDTH. (XTread_socket): Adjusted for the new code-conversion API. (x_new_font): Adjusted for the change of FS_LOAD_FONT. (x_load_font): Adjusted for the change of struct font.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/xterm.c120
2 files changed, 67 insertions, 64 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b513c6599ed..26ffcf762e4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -264,6 +264,17 @@
264 * xfns.c: Include "character.h". 264 * xfns.c: Include "character.h".
265 (x_encode_text): Adjusted for the new code-conversion API. 265 (x_encode_text): Adjusted for the new code-conversion API.
266 266
267 * xterm.c: Include "character.h".
268 (x_encode_char): New argument CHARSET. Caller changed.
269 (x_get_char_face_and_encoding): Call ENCODE_CHAR instead of
270 SPLIT_CHAR.
271 (x_get_glyph_face_and_encoding): Likewise.
272 (x_produce_glyphs): Don't check Vnonascii_translation_table Call
273 CHAR_WIDTH instead of CHARSET_WIDTH.
274 (XTread_socket): Adjusted for the new code-conversion API.
275 (x_new_font): Adjusted for the change of FS_LOAD_FONT.
276 (x_load_font): Adjusted for the change of struct font.
277
2672002-02-26 Kim F. Storm <storm@cua.dk> 2782002-02-26 Kim F. Storm <storm@cua.dk>
268 279
269 The following changes add a new Vminibuf_selected_window variable 280 The following changes add a new Vminibuf_selected_window variable
diff --git a/src/xterm.c b/src/xterm.c
index 7cb9e0f435c..eb1f2845ced 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -68,6 +68,7 @@ Boston, MA 02111-1307, USA. */
68/* #include <sys/param.h> */ 68/* #include <sys/param.h> */
69 69
70#include "charset.h" 70#include "charset.h"
71#include "character.h"
71#include "coding.h" 72#include "coding.h"
72#include "ccl.h" 73#include "ccl.h"
73#include "frame.h" 74#include "frame.h"
@@ -1137,7 +1138,8 @@ static struct face *x_get_glyph_face_and_encoding P_ ((struct frame *,
1137static struct face *x_get_char_face_and_encoding P_ ((struct frame *, int, 1138static struct face *x_get_char_face_and_encoding P_ ((struct frame *, int,
1138 int, XChar2b *, int)); 1139 int, XChar2b *, int));
1139static XCharStruct *x_per_char_metric P_ ((XFontStruct *, XChar2b *)); 1140static XCharStruct *x_per_char_metric P_ ((XFontStruct *, XChar2b *));
1140static void x_encode_char P_ ((int, XChar2b *, struct font_info *)); 1141static void x_encode_char P_ ((int, XChar2b *, struct font_info *,
1142 struct charset *));
1141static void x_append_glyph P_ ((struct it *)); 1143static void x_append_glyph P_ ((struct it *));
1142static void x_append_composite_glyph P_ ((struct it *)); 1144static void x_append_composite_glyph P_ ((struct it *));
1143static void x_append_stretch_glyph P_ ((struct it *it, Lisp_Object, 1145static void x_append_stretch_glyph P_ ((struct it *it, Lisp_Object,
@@ -1221,12 +1223,12 @@ x_per_char_metric (font, char2b)
1221 the two-byte form of C. Encoding is returned in *CHAR2B. */ 1223 the two-byte form of C. Encoding is returned in *CHAR2B. */
1222 1224
1223static INLINE void 1225static INLINE void
1224x_encode_char (c, char2b, font_info) 1226x_encode_char (c, char2b, font_info, charset)
1225 int c; 1227 int c;
1226 XChar2b *char2b; 1228 XChar2b *char2b;
1227 struct font_info *font_info; 1229 struct font_info *font_info;
1230 struct charset *charset;
1228{ 1231{
1229 int charset = CHAR_CHARSET (c);
1230 XFontStruct *font = font_info->font; 1232 XFontStruct *font = font_info->font;
1231 1233
1232 /* FONT_INFO may define a scheme by which to encode byte1 and byte2. 1234 /* FONT_INFO may define a scheme by which to encode byte1 and byte2.
@@ -1239,17 +1241,17 @@ x_encode_char (c, char2b, font_info)
1239 1241
1240 if (CHARSET_DIMENSION (charset) == 1) 1242 if (CHARSET_DIMENSION (charset) == 1)
1241 { 1243 {
1242 ccl->reg[0] = charset; 1244 ccl->reg[0] = CHARSET_ID (charset);
1243 ccl->reg[1] = char2b->byte2; 1245 ccl->reg[1] = char2b->byte2;
1244 } 1246 }
1245 else 1247 else
1246 { 1248 {
1247 ccl->reg[0] = charset; 1249 ccl->reg[0] = CHARSET_ID (charset);
1248 ccl->reg[1] = char2b->byte1; 1250 ccl->reg[1] = char2b->byte1;
1249 ccl->reg[2] = char2b->byte2; 1251 ccl->reg[2] = char2b->byte2;
1250 } 1252 }
1251 1253
1252 ccl_driver (ccl, NULL, NULL, 0, 0, NULL); 1254 ccl_driver (ccl, NULL, NULL, 0, 0);
1253 1255
1254 /* We assume that MSBs are appropriately set/reset by CCL 1256 /* We assume that MSBs are appropriately set/reset by CCL
1255 program. */ 1257 program. */
@@ -1258,11 +1260,11 @@ x_encode_char (c, char2b, font_info)
1258 else 1260 else
1259 char2b->byte1 = ccl->reg[1], char2b->byte2 = ccl->reg[2]; 1261 char2b->byte1 = ccl->reg[1], char2b->byte2 = ccl->reg[2];
1260 } 1262 }
1261 else if (font_info->encoding[charset]) 1263 else if (font_info->encoding_type)
1262 { 1264 {
1263 /* Fixed encoding scheme. See fontset.h for the meaning of the 1265 /* Fixed encoding scheme. See fontset.h for the meaning of the
1264 encoding numbers. */ 1266 encoding numbers. */
1265 int enc = font_info->encoding[charset]; 1267 unsigned char enc = font_info->encoding_type;
1266 1268
1267 if ((enc == 1 || enc == 2) 1269 if ((enc == 1 || enc == 2)
1268 && CHARSET_DIMENSION (charset) == 2) 1270 && CHARSET_DIMENSION (charset) == 2)
@@ -1303,26 +1305,20 @@ x_get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p)
1303 char2b->byte1 = 0; 1305 char2b->byte1 = 0;
1304 char2b->byte2 = c; 1306 char2b->byte2 = c;
1305 } 1307 }
1306 else 1308 else if (face->font != NULL)
1307 { 1309 {
1308 int c1, c2, charset; 1310 struct font_info *font_info
1311 = FONT_INFO_FROM_ID (f, face->font_info_id);
1312 struct charset *charset = CHARSET_FROM_ID (font_info->charset);
1313 unsigned code = ENCODE_CHAR (charset, c);
1309 1314
1310 /* Split characters into bytes. If c2 is -1 afterwards, C is 1315 if (CHARSET_DIMENSION (charset) == 1)
1311 really a one-byte character so that byte1 is zero. */ 1316 char2b->byte1 = 0, char2b->byte2 = code;
1312 SPLIT_CHAR (c, charset, c1, c2);
1313 if (c2 > 0)
1314 char2b->byte1 = c1, char2b->byte2 = c2;
1315 else 1317 else
1316 char2b->byte1 = 0, char2b->byte2 = c1; 1318 char2b->byte1 = code >> 8, char2b->byte2 = code & 0xFF;
1317 1319
1318 /* Maybe encode the character in *CHAR2B. */ 1320 /* Maybe encode the character in *CHAR2B. */
1319 if (face->font != NULL) 1321 x_encode_char (c, char2b, font_info, charset);
1320 {
1321 struct font_info *font_info
1322 = FONT_INFO_FROM_ID (f, face->font_info_id);
1323 if (font_info)
1324 x_encode_char (c, char2b, font_info);
1325 }
1326 } 1322 }
1327 1323
1328 /* Make sure X resources of the face are allocated. */ 1324 /* Make sure X resources of the face are allocated. */
@@ -1368,24 +1364,22 @@ x_get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p)
1368 } 1364 }
1369 else 1365 else
1370 { 1366 {
1371 int c1, c2, charset; 1367 struct font_info *font_info
1368 = FONT_INFO_FROM_ID (f, face->font_info_id);
1369 if (font_info)
1370 {
1371 struct charset *charset = CHARSET_FROM_ID (font_info->charset);
1372 unsigned code = ENCODE_CHAR (charset, glyph->u.ch);
1372 1373
1373 /* Split characters into bytes. If c2 is -1 afterwards, C is 1374 if (CHARSET_DIMENSION (charset) == 1)
1374 really a one-byte character so that byte1 is zero. */ 1375 char2b->byte1 = 0, char2b->byte2 = code;
1375 SPLIT_CHAR (glyph->u.ch, charset, c1, c2); 1376 else
1376 if (c2 > 0) 1377 char2b->byte1 = code >> 8, char2b->byte2 = code & 0xFF;
1377 char2b->byte1 = c1, char2b->byte2 = c2;
1378 else
1379 char2b->byte1 = 0, char2b->byte2 = c1;
1380 1378
1381 /* Maybe encode the character in *CHAR2B. */ 1379 /* Maybe encode the character in *CHAR2B. */
1382 if (charset != CHARSET_ASCII) 1380 if (CHARSET_ID (charset) != charset_ascii)
1383 {
1384 struct font_info *font_info
1385 = FONT_INFO_FROM_ID (f, face->font_info_id);
1386 if (font_info)
1387 { 1381 {
1388 x_encode_char (glyph->u.ch, char2b, font_info); 1382 x_encode_char (glyph->u.ch, char2b, font_info, charset);
1389 if (two_byte_p) 1383 if (two_byte_p)
1390 *two_byte_p 1384 *two_byte_p
1391 = ((XFontStruct *) (font_info->font))->max_byte1 > 0; 1385 = ((XFontStruct *) (font_info->font))->max_byte1 > 0;
@@ -1817,9 +1811,7 @@ x_produce_glyphs (it)
1817 if (!ASCII_BYTE_P (it->c)) 1811 if (!ASCII_BYTE_P (it->c))
1818 { 1812 {
1819 if (unibyte_display_via_language_environment 1813 if (unibyte_display_via_language_environment
1820 && SINGLE_BYTE_CHAR_P (it->c) 1814 && SINGLE_BYTE_CHAR_P (it->c))
1821 && (it->c >= 0240
1822 || !NILP (Vnonascii_translation_table)))
1823 { 1815 {
1824 it->char_to_display = unibyte_char_to_multibyte (it->c); 1816 it->char_to_display = unibyte_char_to_multibyte (it->c);
1825 it->multibyte_p = 1; 1817 it->multibyte_p = 1;
@@ -1985,17 +1977,15 @@ x_produce_glyphs (it)
1985 1977
1986 /* If we found a font, this font should give us the right 1978 /* If we found a font, this font should give us the right
1987 metrics. If we didn't find a font, use the frame's 1979 metrics. If we didn't find a font, use the frame's
1988 default font and calculate the width of the character 1980 default font and calculate the width of the character by
1989 from the charset width; this is what old redisplay code 1981 multiplying the width of font by the width of the
1990 did. */ 1982 character. */
1991 pcm = x_per_char_metric (font, &char2b); 1983 pcm = x_per_char_metric (font, &char2b);
1992 if (font_not_found_p || !pcm) 1984 if (font_not_found_p || !pcm)
1993 { 1985 {
1994 int charset = CHAR_CHARSET (it->char_to_display);
1995
1996 it->glyph_not_available_p = 1; 1986 it->glyph_not_available_p = 1;
1997 it->pixel_width = (FONT_WIDTH (FRAME_FONT (it->f)) 1987 it->pixel_width = (FONT_WIDTH (FRAME_FONT (it->f))
1998 * CHARSET_WIDTH (charset)); 1988 * CHAR_WIDTH (it->char_to_display));
1999 it->phys_ascent = font->ascent + boff; 1989 it->phys_ascent = font->ascent + boff;
2000 it->phys_descent = font->descent - boff; 1990 it->phys_descent = font->descent - boff;
2001 } 1991 }
@@ -2058,10 +2048,7 @@ x_produce_glyphs (it)
2058 /* Maybe translate single-byte characters to multibyte. */ 2048 /* Maybe translate single-byte characters to multibyte. */
2059 it->char_to_display = it->c; 2049 it->char_to_display = it->c;
2060 if (unibyte_display_via_language_environment 2050 if (unibyte_display_via_language_environment
2061 && SINGLE_BYTE_CHAR_P (it->c) 2051 && it->c >= 0200)
2062 && (it->c >= 0240
2063 || (it->c >= 0200
2064 && !NILP (Vnonascii_translation_table))))
2065 { 2052 {
2066 it->char_to_display = unibyte_char_to_multibyte (it->c); 2053 it->char_to_display = unibyte_char_to_multibyte (it->c);
2067 } 2054 }
@@ -9992,7 +9979,7 @@ XTread_socket (sd, bufp, numchars, expected)
9992 /* The input is converted to events, thus we can't handle 9979 /* The input is converted to events, thus we can't handle
9993 composition. Anyway, there's no XIM that gives us composition 9980 composition. Anyway, there's no XIM that gives us composition
9994 information. */ 9981 information. */
9995 coding.composing = COMPOSITION_DISABLED; 9982 coding.common_flags &= ~CODING_ANNOTATION_MASK;
9996 9983
9997 /* Find the display we are supposed to read input for. 9984 /* Find the display we are supposed to read input for.
9998 It's the one communicating on descriptor SD. */ 9985 It's the one communicating on descriptor SD. */
@@ -10664,8 +10651,7 @@ XTread_socket (sd, bufp, numchars, expected)
10664 event.xkey.keycode != 0 10651 event.xkey.keycode != 0
10665 /* or the current locale doesn't request 10652 /* or the current locale doesn't request
10666 decoding of the intup data, ... */ 10653 decoding of the intup data, ... */
10667 || coding.type == coding_type_raw_text 10654 || ! CODING_REQUIRE_DECODING (&coding))
10668 || coding.type == coding_type_no_conversion)
10669 { 10655 {
10670 /* ... we can use the input data as is. */ 10656 /* ... we can use the input data as is. */
10671 nchars = nbytes; 10657 nchars = nbytes;
@@ -10673,17 +10659,23 @@ XTread_socket (sd, bufp, numchars, expected)
10673 else 10659 else
10674 { 10660 {
10675 /* We have to decode the input data. */ 10661 /* We have to decode the input data. */
10676 int require; 10662 coding.destination
10677 unsigned char *p; 10663 = (unsigned char *) malloc (nbytes);
10678 10664 if (! coding.destination)
10679 require = decoding_buffer_size (&coding, nbytes); 10665 break;
10680 p = (unsigned char *) alloca (require); 10666 coding.dst_bytes = nbytes;
10681 coding.mode |= CODING_MODE_LAST_BLOCK; 10667 coding.mode |= CODING_MODE_LAST_BLOCK;
10682 decode_coding (&coding, copy_bufptr, p, 10668 decode_coding_c_string (&coding, copy_bufptr,
10683 nbytes, require); 10669 nbytes, Qnil);
10684 nbytes = coding.produced; 10670 nbytes = coding.produced;
10685 nchars = coding.produced_char; 10671 nchars = coding.produced_char;
10686 copy_bufptr = p; 10672 if (copy_bufsiz < nbytes)
10673 {
10674 copy_bufsiz = nbytes;
10675 copy_bufptr = (char *) alloca (nbytes);
10676 }
10677 bcopy (coding.destination, copy_bufptr, nbytes);
10678 free (coding.destination);
10687 } 10679 }
10688 10680
10689 /* Convert the input data to a sequence of 10681 /* Convert the input data to a sequence of
@@ -12198,7 +12190,7 @@ x_new_font (f, fontname)
12198 register char *fontname; 12190 register char *fontname;
12199{ 12191{
12200 struct font_info *fontp 12192 struct font_info *fontp
12201 = FS_LOAD_FONT (f, 0, fontname, -1); 12193 = FS_LOAD_FONT (f, fontname);
12202 12194
12203 if (!fontp) 12195 if (!fontp)
12204 return Qnil; 12196 return Qnil;
@@ -14342,7 +14334,7 @@ x_load_font (f, fontname, size)
14342 uses this font. So, we set information in fontp->encoding[1] 14334 uses this font. So, we set information in fontp->encoding[1]
14343 which is never used by any charset. If mapping can't be 14335 which is never used by any charset. If mapping can't be
14344 decided, set FONT_ENCODING_NOT_DECIDED. */ 14336 decided, set FONT_ENCODING_NOT_DECIDED. */
14345 fontp->encoding[1] 14337 fontp->encoding_type
14346 = (font->max_byte1 == 0 14338 = (font->max_byte1 == 0
14347 /* 1-byte font */ 14339 /* 1-byte font */
14348 ? (font->min_char_or_byte2 < 0x80 14340 ? (font->min_char_or_byte2 < 0x80