Mercurial > emacs
comparison src/w32term.c @ 111235:24c75a5f002a
Implement various display methods for glyphless characters.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 29 Oct 2010 09:50:13 +0900 |
parents | dd114432ab01 |
children | 00c31cf912da |
comparison
equal
deleted
inserted
replaced
111234:0576327092ab | 111235:24c75a5f002a |
---|---|
1392 SelectObject (s->hdc, old_font); | 1392 SelectObject (s->hdc, old_font); |
1393 } | 1393 } |
1394 } | 1394 } |
1395 | 1395 |
1396 | 1396 |
1397 /* Draw the foreground of glyph string S for glyphless characters. */ | |
1398 | |
1399 static void | |
1400 x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) | |
1401 { | |
1402 struct glyph *glyph = s->first_glyph; | |
1403 XChar2b char2b[8]; | |
1404 int x, i, j; | |
1405 | |
1406 /* If first glyph of S has a left box line, start drawing the text | |
1407 of S to the right of that box line. */ | |
1408 if (s->face->box != FACE_NO_BOX | |
1409 && s->first_glyph->left_box_line_p) | |
1410 x = s->x + eabs (s->face->box_line_width); | |
1411 else | |
1412 x = s->x; | |
1413 | |
1414 SetTextColor (s->hdc, s->gc->foreground); | |
1415 SetBkColor (s->hdc, s->gc->background); | |
1416 SetTextAlign (s->hdc, TA_BASELINE | TA_LEFT); | |
1417 | |
1418 s->char2b = char2b; | |
1419 | |
1420 for (i = 0; i < s->nchars; i++, glyph++) | |
1421 { | |
1422 char buf[7], *str = NULL; | |
1423 int len = glyph->u.glyphless.len; | |
1424 | |
1425 if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM) | |
1426 { | |
1427 if (len > 1 | |
1428 && CHAR_TABLE_P (Vglyphless_char_display) | |
1429 && (CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) | |
1430 >= 1)) | |
1431 { | |
1432 Lisp_Object acronym | |
1433 = (! glyph->u.glyphless.for_no_font | |
1434 ? CHAR_TABLE_REF (Vglyphless_char_display, | |
1435 glyph->u.glyphless.ch) | |
1436 : XCHAR_TABLE (Vglyphless_char_display)->extras[0]); | |
1437 if (STRINGP (acronym)) | |
1438 str = (char *) SDATA (acronym); | |
1439 } | |
1440 } | |
1441 else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEXA_CODE) | |
1442 { | |
1443 sprintf ((char *) buf, "%0*X", | |
1444 glyph->u.glyphless.ch < 0x10000 ? 4 : 6, | |
1445 glyph->u.glyphless.ch); | |
1446 str = buf; | |
1447 } | |
1448 | |
1449 if (str) | |
1450 { | |
1451 struct font *font = s->font; | |
1452 int upper_len = (len + 1) / 2; | |
1453 unsigned code; | |
1454 HFONT old_font; | |
1455 | |
1456 old_font = SelectObject (s->hdc, FONT_HANDLE (font)); | |
1457 /* It is assured that all LEN characters in STR is ASCII. */ | |
1458 for (j = 0; j < len; j++) | |
1459 { | |
1460 code = font->driver->encode_char (font, str[j]); | |
1461 STORE_XCHAR2B (char2b + j, code >> 8, code & 0xFF); | |
1462 } | |
1463 font->driver->draw (s, 0, upper_len, | |
1464 x + glyph->slice.glyphless.upper_xoff, | |
1465 s->ybase + glyph->slice.glyphless.upper_yoff, | |
1466 0); | |
1467 font->driver->draw (s, upper_len, len, | |
1468 x + glyph->slice.glyphless.lower_xoff, | |
1469 s->ybase + glyph->slice.glyphless.lower_yoff, | |
1470 0); | |
1471 SelectObject (s->hdc, old_font); | |
1472 } | |
1473 if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) | |
1474 w32_draw_rectangle (s->hdc, s->gc, | |
1475 x, s->ybase - glyph->ascent, | |
1476 glyph->pixel_width - 1, | |
1477 glyph->ascent + glyph->descent - 1); | |
1478 x += glyph->pixel_width; | |
1479 } | |
1480 } | |
1481 | |
1482 | |
1397 /* Brightness beyond which a color won't have its highlight brightness | 1483 /* Brightness beyond which a color won't have its highlight brightness |
1398 boosted. | 1484 boosted. |
1399 | 1485 |
1400 Nominally, highlight colors for `3d' faces are calculated by | 1486 Nominally, highlight colors for `3d' faces are calculated by |
1401 brightening an object's color by a constant scale factor, but this | 1487 brightening an object's color by a constant scale factor, but this |
2278 && ! s->first_glyph->u.cmp.automatic)) | 2364 && ! s->first_glyph->u.cmp.automatic)) |
2279 s->background_filled_p = 1; | 2365 s->background_filled_p = 1; |
2280 else | 2366 else |
2281 x_draw_glyph_string_background (s, 1); | 2367 x_draw_glyph_string_background (s, 1); |
2282 x_draw_composite_glyph_string_foreground (s); | 2368 x_draw_composite_glyph_string_foreground (s); |
2369 break; | |
2370 | |
2371 case GLYPHLESS_GLYPH: | |
2372 if (s->for_overlaps || (s->cmp_from > 0 | |
2373 && ! s->first_glyph->u.cmp.automatic)) | |
2374 s->background_filled_p = 1; | |
2375 else | |
2376 x_draw_glyph_string_background (s, 1); | |
2377 x_draw_glyphless_glyph_string_foreground (s); | |
2283 break; | 2378 break; |
2284 | 2379 |
2285 default: | 2380 default: |
2286 abort (); | 2381 abort (); |
2287 } | 2382 } |