Mercurial > emacs
comparison src/xterm.c @ 27000:d7f15cd9c4ad
All codes adjusted for the change of struct glyph.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 27 Dec 1999 05:09:13 +0000 |
parents | 3039d2412c9e |
children | 900a02429efa |
comparison
equal
deleted
inserted
replaced
26999:5d0057e6170e | 27000:d7f15cd9c4ad |
---|---|
1345 return face; | 1345 return face; |
1346 } | 1346 } |
1347 | 1347 |
1348 | 1348 |
1349 /* Get face and two-byte form of character glyph GLYPH on frame F. | 1349 /* Get face and two-byte form of character glyph GLYPH on frame F. |
1350 The encoding of GLYPH->u.ch.code is returned in *CHAR2B. Value is | 1350 The encoding of GLYPH->u.ch is returned in *CHAR2B. Value is |
1351 a pointer to a realized face that is ready for display. */ | 1351 a pointer to a realized face that is ready for display. */ |
1352 | 1352 |
1353 static INLINE struct face * | 1353 static INLINE struct face * |
1354 x_get_glyph_face_and_encoding (f, glyph, char2b) | 1354 x_get_glyph_face_and_encoding (f, glyph, char2b) |
1355 struct frame *f; | 1355 struct frame *f; |
1357 XChar2b *char2b; | 1357 XChar2b *char2b; |
1358 { | 1358 { |
1359 struct face *face; | 1359 struct face *face; |
1360 | 1360 |
1361 xassert (glyph->type == CHAR_GLYPH); | 1361 xassert (glyph->type == CHAR_GLYPH); |
1362 face = FACE_FROM_ID (f, glyph->u.ch.face_id); | 1362 face = FACE_FROM_ID (f, glyph->face_id); |
1363 | 1363 |
1364 if (!glyph->multibyte_p) | 1364 if (!glyph->multibyte_p) |
1365 { | 1365 { |
1366 /* Unibyte case. We don't have to encode, but we have to make | 1366 /* Unibyte case. We don't have to encode, but we have to make |
1367 sure to use a face suitable for unibyte. */ | 1367 sure to use a face suitable for unibyte. */ |
1368 char2b->byte1 = 0; | 1368 char2b->byte1 = 0; |
1369 char2b->byte2 = glyph->u.ch.code; | 1369 char2b->byte2 = glyph->u.ch; |
1370 } | 1370 } |
1371 else if (glyph->u.ch.code < 128 | 1371 else if (glyph->u.ch < 128 |
1372 && glyph->u.ch.face_id < BASIC_FACE_ID_SENTINEL) | 1372 && glyph->face_id < BASIC_FACE_ID_SENTINEL) |
1373 { | 1373 { |
1374 /* Case of ASCII in a face known to fit ASCII. */ | 1374 /* Case of ASCII in a face known to fit ASCII. */ |
1375 char2b->byte1 = 0; | 1375 char2b->byte1 = 0; |
1376 char2b->byte2 = glyph->u.ch.code; | 1376 char2b->byte2 = glyph->u.ch; |
1377 } | 1377 } |
1378 else | 1378 else |
1379 { | 1379 { |
1380 int c1, c2, charset; | 1380 int c1, c2, charset; |
1381 | 1381 |
1382 /* Split characters into bytes. If c2 is -1 afterwards, C is | 1382 /* Split characters into bytes. If c2 is -1 afterwards, C is |
1383 really a one-byte character so that byte1 is zero. */ | 1383 really a one-byte character so that byte1 is zero. */ |
1384 SPLIT_CHAR (glyph->u.ch.code, charset, c1, c2); | 1384 SPLIT_CHAR (glyph->u.ch, charset, c1, c2); |
1385 if (c2 > 0) | 1385 if (c2 > 0) |
1386 char2b->byte1 = c1, char2b->byte2 = c2; | 1386 char2b->byte1 = c1, char2b->byte2 = c2; |
1387 else | 1387 else |
1388 char2b->byte1 = 0, char2b->byte2 = c1; | 1388 char2b->byte1 = 0, char2b->byte2 = c1; |
1389 | 1389 |
1392 { | 1392 { |
1393 struct font_info *font_info | 1393 struct font_info *font_info |
1394 = FONT_INFO_FROM_ID (f, face->font_info_id); | 1394 = FONT_INFO_FROM_ID (f, face->font_info_id); |
1395 if (font_info) | 1395 if (font_info) |
1396 { | 1396 { |
1397 x_encode_char (glyph->u.ch.code, char2b, font_info); | 1397 x_encode_char (glyph->u.ch, char2b, font_info); |
1398 if (charset == charset_latin_iso8859_1) | 1398 if (charset == charset_latin_iso8859_1) |
1399 char2b->byte2 |= 0x80; | 1399 char2b->byte2 |= 0x80; |
1400 } | 1400 } |
1401 } | 1401 } |
1402 } | 1402 } |
1429 would prevent a comparison with GLYPH_EQUAL_P. */ | 1429 would prevent a comparison with GLYPH_EQUAL_P. */ |
1430 glyph->u.val = 0; | 1430 glyph->u.val = 0; |
1431 | 1431 |
1432 glyph->type = CHAR_GLYPH; | 1432 glyph->type = CHAR_GLYPH; |
1433 glyph->pixel_width = it->pixel_width; | 1433 glyph->pixel_width = it->pixel_width; |
1434 glyph->u.ch.code = it->char_to_display; | 1434 glyph->u.ch = it->char_to_display; |
1435 glyph->u.ch.face_id = it->face_id; | 1435 glyph->face_id = it->face_id; |
1436 glyph->charpos = CHARPOS (it->position); | 1436 glyph->charpos = CHARPOS (it->position); |
1437 glyph->object = it->object; | 1437 glyph->object = it->object; |
1438 glyph->left_box_line_p = it->start_of_box_run_p; | 1438 glyph->left_box_line_p = it->start_of_box_run_p; |
1439 glyph->right_box_line_p = it->end_of_box_run_p; | 1439 glyph->right_box_line_p = it->end_of_box_run_p; |
1440 glyph->voffset = it->voffset; | 1440 glyph->voffset = it->voffset; |
1465 would prevent a comparison with GLYPH_EQUAL_P. */ | 1465 would prevent a comparison with GLYPH_EQUAL_P. */ |
1466 glyph->u.val = 0; | 1466 glyph->u.val = 0; |
1467 | 1467 |
1468 glyph->type = COMPOSITE_GLYPH; | 1468 glyph->type = COMPOSITE_GLYPH; |
1469 glyph->pixel_width = it->pixel_width; | 1469 glyph->pixel_width = it->pixel_width; |
1470 glyph->u.cmp.id = it->cmp_id; | 1470 glyph->u.cmp_id = it->cmp_id; |
1471 glyph->u.cmp.face_id = it->face_id; | 1471 glyph->face_id = it->face_id; |
1472 glyph->charpos = CHARPOS (it->position); | 1472 glyph->charpos = CHARPOS (it->position); |
1473 glyph->object = it->object; | 1473 glyph->object = it->object; |
1474 glyph->left_box_line_p = it->start_of_box_run_p; | 1474 glyph->left_box_line_p = it->start_of_box_run_p; |
1475 glyph->right_box_line_p = it->end_of_box_run_p; | 1475 glyph->right_box_line_p = it->end_of_box_run_p; |
1476 glyph->voffset = it->voffset; | 1476 glyph->voffset = it->voffset; |
1550 | 1550 |
1551 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; | 1551 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
1552 if (glyph < it->glyph_row->glyphs[area + 1]) | 1552 if (glyph < it->glyph_row->glyphs[area + 1]) |
1553 { | 1553 { |
1554 glyph->type = IMAGE_GLYPH; | 1554 glyph->type = IMAGE_GLYPH; |
1555 glyph->u.img.id = img->id; | 1555 glyph->u.img_id = img->id; |
1556 glyph->u.img.face_id = it->face_id; | 1556 glyph->face_id = it->face_id; |
1557 glyph->pixel_width = it->pixel_width; | 1557 glyph->pixel_width = it->pixel_width; |
1558 glyph->charpos = CHARPOS (it->position); | 1558 glyph->charpos = CHARPOS (it->position); |
1559 glyph->object = it->object; | 1559 glyph->object = it->object; |
1560 glyph->left_box_line_p = it->start_of_box_run_p; | 1560 glyph->left_box_line_p = it->start_of_box_run_p; |
1561 glyph->right_box_line_p = it->end_of_box_run_p; | 1561 glyph->right_box_line_p = it->end_of_box_run_p; |
1588 if (glyph < it->glyph_row->glyphs[area + 1]) | 1588 if (glyph < it->glyph_row->glyphs[area + 1]) |
1589 { | 1589 { |
1590 glyph->type = STRETCH_GLYPH; | 1590 glyph->type = STRETCH_GLYPH; |
1591 glyph->u.stretch.ascent = height * ascent; | 1591 glyph->u.stretch.ascent = height * ascent; |
1592 glyph->u.stretch.height = height; | 1592 glyph->u.stretch.height = height; |
1593 glyph->u.stretch.face_id = it->face_id; | 1593 glyph->face_id = it->face_id; |
1594 glyph->pixel_width = width; | 1594 glyph->pixel_width = width; |
1595 glyph->charpos = CHARPOS (it->position); | 1595 glyph->charpos = CHARPOS (it->position); |
1596 glyph->object = object; | 1596 glyph->object = object; |
1597 glyph->left_box_line_p = it->start_of_box_run_p; | 1597 glyph->left_box_line_p = it->start_of_box_run_p; |
1598 glyph->right_box_line_p = it->end_of_box_run_p; | 1598 glyph->right_box_line_p = it->end_of_box_run_p; |
4136 | 4136 |
4137 while (glyph < last | 4137 while (glyph < last |
4138 && glyph->type == CHAR_GLYPH | 4138 && glyph->type == CHAR_GLYPH |
4139 && glyph->voffset == voffset | 4139 && glyph->voffset == voffset |
4140 /* Same face id implies same charset, nowadays. */ | 4140 /* Same face id implies same charset, nowadays. */ |
4141 && glyph->u.ch.face_id == face_id) | 4141 && glyph->face_id == face_id) |
4142 { | 4142 { |
4143 s->face = x_get_glyph_face_and_encoding (s->f, glyph, | 4143 s->face = x_get_glyph_face_and_encoding (s->f, glyph, |
4144 s->char2b + s->nchars); | 4144 s->char2b + s->nchars); |
4145 if (s->char2b[s->nchars].byte2 != 0) | 4145 if (s->char2b[s->nchars].byte2 != 0) |
4146 s->two_byte_p = 1; | 4146 s->two_byte_p = 1; |
4177 static void | 4177 static void |
4178 x_fill_image_glyph_string (s) | 4178 x_fill_image_glyph_string (s) |
4179 struct glyph_string *s; | 4179 struct glyph_string *s; |
4180 { | 4180 { |
4181 xassert (s->first_glyph->type == IMAGE_GLYPH); | 4181 xassert (s->first_glyph->type == IMAGE_GLYPH); |
4182 s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img.id); | 4182 s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id); |
4183 xassert (s->img); | 4183 xassert (s->img); |
4184 s->face = FACE_FROM_ID (s->f, s->first_glyph->u.img.face_id); | 4184 s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id); |
4185 s->font = s->face->font; | 4185 s->font = s->face->font; |
4186 s->width = s->first_glyph->pixel_width; | 4186 s->width = s->first_glyph->pixel_width; |
4187 | 4187 |
4188 /* Adjust base line for subscript/superscript text. */ | 4188 /* Adjust base line for subscript/superscript text. */ |
4189 s->ybase += s->first_glyph->voffset; | 4189 s->ybase += s->first_glyph->voffset; |
4195 static void | 4195 static void |
4196 x_fill_stretch_glyph_string (s) | 4196 x_fill_stretch_glyph_string (s) |
4197 struct glyph_string *s; | 4197 struct glyph_string *s; |
4198 { | 4198 { |
4199 xassert (s->first_glyph->type == STRETCH_GLYPH); | 4199 xassert (s->first_glyph->type == STRETCH_GLYPH); |
4200 s->face = FACE_FROM_ID (s->f, s->first_glyph->u.stretch.face_id); | 4200 s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id); |
4201 s->font = s->face->font; | 4201 s->font = s->face->font; |
4202 s->width = s->first_glyph->pixel_width; | 4202 s->width = s->first_glyph->pixel_width; |
4203 | 4203 |
4204 /* Adjust base line for subscript/superscript text. */ | 4204 /* Adjust base line for subscript/superscript text. */ |
4205 s->ybase += s->first_glyph->voffset; | 4205 s->ybase += s->first_glyph->voffset; |
4333 do \ | 4333 do \ |
4334 { \ | 4334 { \ |
4335 int c, charset, face_id; \ | 4335 int c, charset, face_id; \ |
4336 XChar2b *char2b; \ | 4336 XChar2b *char2b; \ |
4337 \ | 4337 \ |
4338 c = (ROW)->glyphs[AREA][START].u.ch.code; \ | 4338 c = (ROW)->glyphs[AREA][START].u.ch; \ |
4339 charset = CHAR_CHARSET (c); \ | 4339 charset = CHAR_CHARSET (c); \ |
4340 face_id = (ROW)->glyphs[AREA][START].u.ch.face_id; \ | 4340 face_id = (ROW)->glyphs[AREA][START].face_id; \ |
4341 \ | 4341 \ |
4342 s = (struct glyph_string *) alloca (sizeof *s); \ | 4342 s = (struct glyph_string *) alloca (sizeof *s); \ |
4343 char2b = (XChar2b *) alloca ((END - START) * sizeof *char2b); \ | 4343 char2b = (XChar2b *) alloca ((END - START) * sizeof *char2b); \ |
4344 x_init_glyph_string (s, char2b, W, ROW, AREA, START, HL); \ | 4344 x_init_glyph_string (s, char2b, W, ROW, AREA, START, HL); \ |
4345 x_append_glyph_string (&HEAD, &TAIL, s); \ | 4345 x_append_glyph_string (&HEAD, &TAIL, s); \ |
4360 DRAW_CURSOR if a cursor has to be drawn. LAST_X is the right-most | 4360 DRAW_CURSOR if a cursor has to be drawn. LAST_X is the right-most |
4361 x-position of the drawing area. */ | 4361 x-position of the drawing area. */ |
4362 | 4362 |
4363 #define BUILD_COMPOSITE_GLYPH_STRING(W, ROW, AREA, START, END, HEAD, TAIL, HL, X, LAST_X, OVERLAPS_P) \ | 4363 #define BUILD_COMPOSITE_GLYPH_STRING(W, ROW, AREA, START, END, HEAD, TAIL, HL, X, LAST_X, OVERLAPS_P) \ |
4364 do { \ | 4364 do { \ |
4365 int cmp_id = (ROW)->glyphs[AREA][START].u.cmp.id; \ | 4365 int cmp_id = (ROW)->glyphs[AREA][START].u.cmp_id; \ |
4366 int face_id = (ROW)->glyphs[AREA][START].u.cmp.face_id; \ | 4366 int face_id = (ROW)->glyphs[AREA][START].face_id; \ |
4367 struct composition *cmp = composition_table[cmp_id]; \ | 4367 struct composition *cmp = composition_table[cmp_id]; \ |
4368 int glyph_len = cmp->glyph_len; \ | 4368 int glyph_len = cmp->glyph_len; \ |
4369 XChar2b *char2b; \ | 4369 XChar2b *char2b; \ |
4370 struct face **faces; \ | 4370 struct face **faces; \ |
4371 struct glyph_string *first_s = NULL; \ | 4371 struct glyph_string *first_s = NULL; \ |
4374 char2b = (XChar2b *) alloca ((sizeof *char2b) * glyph_len); \ | 4374 char2b = (XChar2b *) alloca ((sizeof *char2b) * glyph_len); \ |
4375 faces = (struct face **) alloca ((sizeof *faces) * glyph_len); \ | 4375 faces = (struct face **) alloca ((sizeof *faces) * glyph_len); \ |
4376 /* At first, fill in `char2b' and `faces'. */ \ | 4376 /* At first, fill in `char2b' and `faces'. */ \ |
4377 for (n = 0; n < glyph_len; n++) \ | 4377 for (n = 0; n < glyph_len; n++) \ |
4378 { \ | 4378 { \ |
4379 int c = FAST_GLYPH_CHAR (COMPOSITION_GLYPH (cmp, n)); \ | 4379 int c = COMPOSITION_GLYPH (cmp, n); \ |
4380 faces[n] = x_get_char_face_and_encoding (XFRAME (w->frame), c, \ | 4380 faces[n] = x_get_char_face_and_encoding (XFRAME (w->frame), c, \ |
4381 face_id, char2b + n, 1); \ | 4381 face_id, char2b + n, 1); \ |
4382 } \ | 4382 } \ |
4383 \ | 4383 \ |
4384 /* Make glyph_strings for each glyph sequence that is drawable by \ | 4384 /* Make glyph_strings for each glyph sequence that is drawable by \ |