ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtfont.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtfont.C (file contents):
Revision 1.50 by root, Wed Dec 1 02:29:14 2004 UTC vs.
Revision 1.56 by root, Fri Dec 10 19:55:55 2004 UTC

90 { CS_JIS0212_1990_0, "-*-*-*-r-*--*-*-*-*-c-*-jisx0212*-0" }, 90 { CS_JIS0212_1990_0, "-*-*-*-r-*--*-*-*-*-c-*-jisx0212*-0" },
91#endif 91#endif
92 92
93#if ENCODING_ZH || ENCODING_ZH_EXT 93#if ENCODING_ZH || ENCODING_ZH_EXT
94# if XFT 94# if XFT
95 { CS_GBK_0, "xft:AR PL KaitiM GB" },
96 { CS_GBK_0, "xft:AR PL SungtiL GB" },
97 { CS_GBK_0, "xft::spacing=100:lang=zh" },
95 { CS_BIG5_EXT, "xft:AR PL Mingti2L Big5" }, 98 { CS_BIG5_EXT, "xft:AR PL Mingti2L Big5" },
96 { CS_BIG5_EXT, "xft:AR PL KaitiM Big5" }, 99 { CS_BIG5_EXT, "xft:AR PL KaitiM Big5" },
97 { CS_GB2312_1980_0, "xft:AR PL KaitiM GB" }, 100 { CS_GB2312_1980_0, "xft:AR PL KaitiM GB" },
98 { CS_GB2312_1980_0, "xft:AR PL SungtiL GB" }, 101 { CS_GB2312_1980_0, "xft:AR PL SungtiL GB" },
99 { CS_GB2312_1980_0, "xft::spacing=100:lang=zh" }, 102 { CS_GB2312_1980_0, "xft::spacing=100:lang=zh" },
100# endif 103# endif
104 { CS_GBK_0, "-*-*-*-*-*-*-*-*-*-*-c-*-gbk*-0" },
101 { CS_BIG5, "-*-*-*-*-*-*-*-*-*-*-c-*-big5-0" }, 105 { CS_BIG5, "-*-*-*-*-*-*-*-*-*-*-c-*-big5-0" },
102 { CS_BIG5_PLUS, "-*-*-*-*-*-*-*-*-*-*-c-*-big5p-0" }, 106 { CS_BIG5_PLUS, "-*-*-*-*-*-*-*-*-*-*-c-*-big5p-0" },
103 { CS_BIG5_EXT, "-*-*-*-*-*-*-*-*-*-*-c-*-big5.eten-0" }, 107 { CS_BIG5_EXT, "-*-*-*-*-*-*-*-*-*-*-c-*-big5.eten-0" },
108 { CS_GB2312_1980_0, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" },
104 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" }, 109 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" },
105 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" }, 110 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" },
106 { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" }, 111 { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" },
107 { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" }, 112 { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" },
108 { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" }, 113 { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" },
330{ 335{
331 clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); 336 clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg);
332 337
333 XSetForeground (d.display->display, TGC, r->pix_colors[fg]); 338 XSetForeground (d.display->display, TGC, r->pix_colors[fg]);
334 339
335 while (len--) 340 while (len)
336 { 341 {
337#if ENABLE_COMBINING 342#if ENABLE_COMBINING
338 compose_char *cc; 343 compose_char *cc;
339#endif 344#endif
345 const text_t *tp = text;
340 text_t t = *text++; 346 text_t t = *tp;
347
348 while (++text, --len && *text == NOCHAR)
349 ;
350
351 int width = text - tp;
352 int fwidth = r->TermWin.fwidth * width;
341 353
342 if (0x2500 <= t && t <= 0x259f) 354 if (0x2500 <= t && t <= 0x259f)
343 { 355 {
344 uint16_t offs = linedraw_offs[t - 0x2500]; 356 uint16_t offs = linedraw_offs[t - 0x2500];
345 uint32_t *a = linedraw_command + (offs >> 4); 357 uint32_t *a = linedraw_command + (offs >> 4);
346 uint32_t *b = a + (offs & 15); 358 uint32_t *b = a + (offs & 15);
347 359
348 int W = r->TermWin.fwidth * wcwidth (t); 360 int W = fwidth;
349 int H = r->TermWin.fheight; 361 int H = r->TermWin.fheight;
350 362
351 int x_[16]; 363 int x_[16];
352 int y_[16]; 364 int y_[16];
353 365
418 } 430 }
419 } 431 }
420#if ENABLE_COMBINING 432#if ENABLE_COMBINING
421 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) 433 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t]))
422 { 434 {
423 text_t c2[2]; 435 text_t chrs[2];
424 int len2 = 1; 436 width = min (2, width);
425 437 chrs [1] = NOCHAR;
426 // support double-width (but not more) combining characters
427 if (len && *text == NOCHAR)
428 {
429 c2[1] = *text; // not text++ to get correct x-width
430 len2++;
431 }
432 438
433 c2[0] = cc->c1; 439 *chrs = cc->c1;
434 rxvt_font *f1 = (*fs)[fs->find_font (c2[0])]; 440 rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)];
435 f1->draw (d, x, y, c2, len2, fg, bg); 441 f1->draw (d, x, y, chrs, width, fg, bg);
436 442
437 if (cc->c2 != NOCHAR) 443 if (cc->c2 != NOCHAR)
438 { 444 {
439 bool careful; 445 bool careful;
440 446
441 // prefer font of first character, for no good reasons 447 // prefer font of first character, for no good reasons
442 c2[0] = cc->c2; 448 *chrs = cc->c2;
443 rxvt_font *f2 = (f1->has_char (c2[0], 0, careful) && !careful) 449 rxvt_font *f2 = (f1->has_char (cc->c2, 0, careful) && !careful)
444 ? f1 450 ? f1
445 : (*fs)[fs->find_font (c2[0])]; 451 : (*fs)[fs->find_font (cc->c2)];
446 452
447 f2->draw (d, x, y, c2, len2, fg, -1); 453 f2->draw (d, x, y, chrs, width, fg, -1);
448 } 454 }
449 } 455 }
450#endif 456#endif
451 else 457 else
452 switch (t) 458 switch (t)
455 case ZERO_WIDTH_CHAR: 461 case ZERO_WIDTH_CHAR:
456 case NOCHAR: 462 case NOCHAR:
457 break; 463 break;
458 464
459 default: 465 default:
460 int w = 0;
461 while (len > 0 && *text == NOCHAR)
462 {
463 ++text;
464 --len;
465 w += r->TermWin.fwidth;
466 }
467
468 XDrawRectangle (d.display->display, d, TGC, x + 2, y + 2, 466 XDrawRectangle (d.display->display, d, TGC, x + 2, y + 2,
469 w + r->TermWin.fwidth - 4, r->TermWin.fheight - 4); 467 fwidth - 4, r->TermWin.fheight - 4);
470 x += w;
471 } 468 }
472 469
473 x += r->TermWin.fwidth; 470 x += fwidth;
474 } 471 }
475} 472}
476 473
477///////////////////////////////////////////////////////////////////////////// 474/////////////////////////////////////////////////////////////////////////////
478 475

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines