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.52 by root, Sat Dec 4 02:56:06 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; 360 int W = fwidth;
349 int H = r->TermWin.fheight; 361 int H = r->TermWin.fheight;
350
351 // support double-width (but not more) graphics chars
352 // TODO: do this outside the if/elsif.. statement for all cases
353 if (len && *text == NOCHAR)
354 W += r->TermWin.fwidth;
355 362
356 int x_[16]; 363 int x_[16];
357 int y_[16]; 364 int y_[16];
358 365
359 for (int i = 0; i <= 8; i++) 366 for (int i = 0; i <= 8; i++)
423 } 430 }
424 } 431 }
425#if ENABLE_COMBINING 432#if ENABLE_COMBINING
426 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) 433 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t]))
427 { 434 {
428 text_t c2[2]; 435 text_t chrs[2];
429 int len2 = 1; 436 width = min (2, width);
430 437 chrs [1] = NOCHAR;
431 // support double-width (but not more) combining characters
432 if (len && *text == NOCHAR)
433 {
434 c2[1] = *text; // not text++ to get correct x-width
435 len2++;
436 }
437 438
438 c2[0] = cc->c1; 439 *chrs = cc->c1;
439 rxvt_font *f1 = (*fs)[fs->find_font (c2[0])]; 440 rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)];
440 f1->draw (d, x, y, c2, len2, fg, bg); 441 f1->draw (d, x, y, chrs, width, fg, bg);
441 442
442 if (cc->c2 != NOCHAR) 443 if (cc->c2 != NOCHAR)
443 { 444 {
444 bool careful; 445 bool careful;
445 446
446 // prefer font of first character, for no good reasons 447 // prefer font of first character, for no good reasons
447 c2[0] = cc->c2; 448 *chrs = cc->c2;
448 rxvt_font *f2 = (f1->has_char (c2[0], 0, careful) && !careful) 449 rxvt_font *f2 = (f1->has_char (cc->c2, 0, careful) && !careful)
449 ? f1 450 ? f1
450 : (*fs)[fs->find_font (c2[0])]; 451 : (*fs)[fs->find_font (cc->c2)];
451 452
452 f2->draw (d, x, y, c2, len2, fg, -1); 453 f2->draw (d, x, y, chrs, width, fg, -1);
453 } 454 }
454 } 455 }
455#endif 456#endif
456 else 457 else
457 switch (t) 458 switch (t)
460 case ZERO_WIDTH_CHAR: 461 case ZERO_WIDTH_CHAR:
461 case NOCHAR: 462 case NOCHAR:
462 break; 463 break;
463 464
464 default: 465 default:
465 int w = 0;
466 while (len > 0 && *text == NOCHAR)
467 {
468 ++text;
469 --len;
470 w += r->TermWin.fwidth;
471 }
472
473 XDrawRectangle (d.display->display, d, TGC, x + 2, y + 2, 466 XDrawRectangle (d.display->display, d, TGC, x + 2, y + 2,
474 w + r->TermWin.fwidth - 4, r->TermWin.fheight - 4); 467 fwidth - 4, r->TermWin.fheight - 4);
475 x += w;
476 } 468 }
477 469
478 x += r->TermWin.fwidth; 470 x += fwidth;
479 } 471 }
480} 472}
481 473
482///////////////////////////////////////////////////////////////////////////// 474/////////////////////////////////////////////////////////////////////////////
483 475

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines