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.41 by root, Wed Aug 25 02:33:09 2004 UTC vs.
Revision 1.50 by root, Wed Dec 1 02:29:14 2004 UTC

88 { CS_JIS0201_1976_0, "-*-*-*-r-*--*-*-*-*-c-*-jisx0201*-0" }, 88 { CS_JIS0201_1976_0, "-*-*-*-r-*--*-*-*-*-c-*-jisx0201*-0" },
89 { CS_JIS0208_1990_0, "-*-*-*-r-*--*-*-*-*-c-*-jisx0208*-0" }, 89 { CS_JIS0208_1990_0, "-*-*-*-r-*--*-*-*-*-c-*-jisx0208*-0" },
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_CN || ENCODING_CN_EXT 93#if ENCODING_ZH || ENCODING_ZH_EXT
94# if XFT 94# if XFT
95 { CS_BIG5_EXT, "xft:AR PL Mingti2L Big5" }, 95 { CS_BIG5_EXT, "xft:AR PL Mingti2L Big5" },
96 { CS_BIG5_EXT, "xft:AR PL KaitiM Big5" }, 96 { CS_BIG5_EXT, "xft:AR PL KaitiM Big5" },
97 { CS_GB2312_1980_0, "xft:AR PL KaitiM GB" }, 97 { CS_GB2312_1980_0, "xft:AR PL KaitiM GB" },
98 { CS_GB2312_1980_0, "xft:AR PL SungtiL GB" }, 98 { CS_GB2312_1980_0, "xft:AR PL SungtiL GB" },
125 { CS_UNICODE, "-*-lucidatypewriter-*-*-*-*-*-*-*-*-m-*-iso10646-1" }, 125 { CS_UNICODE, "-*-lucidatypewriter-*-*-*-*-*-*-*-*-m-*-iso10646-1" },
126 { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, 126 { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" },
127 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, 127 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" },
128 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, 128 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" },
129#if XFT 129#if XFT
130 { CS_UNICODE, "xft:Bitstream Vera Sans Mono:antialias=false"}, 130 { CS_UNICODE, "xft:Bitstream Vera Sans Mono:antialias=false:autohint=true"},
131 { CS_UNICODE, "xft:Courier New:antialias=false:autohint=true" },
131 { CS_UNICODE, "xft:Andale Mono:antialias=false" }, 132 { CS_UNICODE, "xft:Andale Mono:antialias=false" },
132 { CS_UNICODE, "xft:Arial Unicode MS:antialias=false" }, 133 { CS_UNICODE, "xft:Arial Unicode MS:antialias=false" },
133 { CS_UNICODE, "xft:Courier New:antialias=false" },
134 134
135 // FreeMono is usually uglier than x fonts, so try last only. 135 // FreeMono is usually uglier than x fonts, so try last only.
136 { CS_UNICODE, "xft:FreeMono" }, 136 { CS_UNICODE, "xft:FreeMono:autohint=true" },
137#endif 137#endif
138 138
139 { CS_UNKNOWN, 0 } 139 { CS_UNKNOWN, 0 }
140}; 140};
141 141
343 { 343 {
344 uint16_t offs = linedraw_offs[t - 0x2500]; 344 uint16_t offs = linedraw_offs[t - 0x2500];
345 uint32_t *a = linedraw_command + (offs >> 4); 345 uint32_t *a = linedraw_command + (offs >> 4);
346 uint32_t *b = a + (offs & 15); 346 uint32_t *b = a + (offs & 15);
347 347
348 int W = r->TermWin.fwidth; 348 int W = r->TermWin.fwidth * wcwidth (t);
349 int H = r->TermWin.fheight; 349 int H = r->TermWin.fheight;
350 350
351 int x_[16]; 351 int x_[16];
352 int y_[16]; 352 int y_[16];
353 353
418 } 418 }
419 } 419 }
420#if ENABLE_COMBINING 420#if ENABLE_COMBINING
421 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) 421 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t]))
422 { 422 {
423 text_t c2[2];
424 int len2 = 1;
425
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
433 c2[0] = cc->c1;
423 rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)]; 434 rxvt_font *f1 = (*fs)[fs->find_font (c2[0])];
424 f1->draw (d, x, y, &(t = cc->c1), 1, fg, bg); 435 f1->draw (d, x, y, c2, len2, fg, bg);
436
425 if (cc->c2 != NOCHAR) 437 if (cc->c2 != NOCHAR)
426 { 438 {
439 bool careful;
440
427 // prefer font of first character, for no good reasons 441 // prefer font of first character, for no good reasons
428 bool careful; 442 c2[0] = cc->c2;
429 rxvt_font *f2 = f1->has_char (cc->c2, 0, careful) 443 rxvt_font *f2 = (f1->has_char (c2[0], 0, careful) && !careful)
430 ? f1 444 ? f1
431 : (*fs)[fs->find_font (cc->c2)]; 445 : (*fs)[fs->find_font (c2[0])];
432 446
433 f2->draw (d, x, y, &(t = cc->c2), 1, fg, -1); 447 f2->draw (d, x, y, c2, len2, fg, -1);
434 } 448 }
435 } 449 }
436#endif 450#endif
437 else 451 else
438 switch (t) 452 switch (t)
678 { 692 {
679 rxvt_fontprop p; 693 rxvt_fontprop p;
680 char fname[1024]; 694 char fname[1024];
681 695
682 int diff = 0; 696 int diff = 0;
683 697
684 if (replace_field (fname, list[i], 6, '0', field_str)) 698 if (replace_field (fname, list[i], 6, '0', field_str))
685 diff += 10; // slightly penalize scalable fonts 699 diff += 10; // slightly penalize scalable fonts
686 700
687 if (!set_properties (p, fname)) 701 if (!set_properties (p, fname))
688 continue; 702 continue;
1042 return false; 1056 return false;
1043 1057
1044 FcValue v; 1058 FcValue v;
1045 1059
1046 if (prop.height != rxvt_fontprop::unset 1060 if (prop.height != rxvt_fontprop::unset
1047 && FcPatternGet (p, FC_PIXEL_SIZE, 0, &v) != FcResultMatch) 1061 || (FcPatternGet (p, FC_PIXEL_SIZE, 0, &v) != FcResultMatch
1062 && FcPatternGet (p, FC_SIZE, 0, &v) != FcResultMatch))
1048 FcPatternAddInteger (p, FC_PIXEL_SIZE, prop.height); 1063 FcPatternAddInteger (p, FC_PIXEL_SIZE, prop.height);
1049 1064
1050 if (prop.weight != rxvt_fontprop::unset 1065 if (prop.weight != rxvt_fontprop::unset
1051 && FcPatternGet (p, FC_WEIGHT, 0, &v) != FcResultMatch) 1066 && FcPatternGet (p, FC_WEIGHT, 0, &v) != FcResultMatch)
1052 FcPatternAddInteger (p, FC_WEIGHT, prop.weight); 1067 FcPatternAddInteger (p, FC_WEIGHT, prop.weight);
1264} 1279}
1265 1280
1266void 1281void
1267rxvt_fontset::clear () 1282rxvt_fontset::clear ()
1268{ 1283{
1284 prop.width = prop.height = prop.weight = prop.slant
1285 = rxvt_fontprop::unset;
1286
1269 for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++) 1287 for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++)
1270 FONT_UNREF (*i); 1288 FONT_UNREF (*i);
1271 1289
1272 for (pagemap **p = fmap.begin (); p != fmap.end (); p++) 1290 for (pagemap **p = fmap.begin (); p != fmap.end (); p++)
1273 delete *p; 1291 delete *p;
1393 1411
1394 return true; 1412 return true;
1395} 1413}
1396 1414
1397bool 1415bool
1398rxvt_fontset::populate (const char *desc, const rxvt_fontprop &prop) 1416rxvt_fontset::populate (const char *desc)
1399{ 1417{
1400 clear (); 1418 clear ();
1401 1419
1402 fontdesc = strdup (desc); 1420 fontdesc = strdup (desc);
1403 1421
1404 fonts.push_back (new_font (0, CS_UNICODE)); 1422 fonts.push_back (new_font (0, CS_UNICODE));
1405 realize_font (0); 1423 realize_font (0);
1406
1407 this->prop = prop;
1408 1424
1409 add_fonts (desc); 1425 add_fonts (desc);
1410 1426
1411 return true; 1427 return true;
1412} 1428}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines