… | |
… | |
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 | |
… | |
… | |
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; |
349 | int H = r->TermWin.fheight; |
349 | 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; |
350 | |
355 | |
351 | int x_[16]; |
356 | int x_[16]; |
352 | int y_[16]; |
357 | int y_[16]; |
353 | |
358 | |
354 | for (int i = 0; i <= 8; i++) |
359 | for (int i = 0; i <= 8; i++) |
… | |
… | |
418 | } |
423 | } |
419 | } |
424 | } |
420 | #if ENABLE_COMBINING |
425 | #if ENABLE_COMBINING |
421 | else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) |
426 | else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) |
422 | { |
427 | { |
|
|
428 | text_t c2[2]; |
|
|
429 | int len2 = 1; |
|
|
430 | |
|
|
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 | c2[0] = cc->c1; |
423 | rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)]; |
439 | rxvt_font *f1 = (*fs)[fs->find_font (c2[0])]; |
424 | f1->draw (d, x, y, &(t = cc->c1), 1, fg, bg); |
440 | f1->draw (d, x, y, c2, len2, fg, bg); |
|
|
441 | |
425 | if (cc->c2 != NOCHAR) |
442 | if (cc->c2 != NOCHAR) |
426 | { |
443 | { |
|
|
444 | bool careful; |
|
|
445 | |
427 | // prefer font of first character, for no good reasons |
446 | // prefer font of first character, for no good reasons |
428 | bool careful; |
447 | c2[0] = cc->c2; |
429 | rxvt_font *f2 = f1->has_char (cc->c2, 0, careful) |
448 | rxvt_font *f2 = (f1->has_char (c2[0], 0, careful) && !careful) |
430 | ? f1 |
449 | ? f1 |
431 | : (*fs)[fs->find_font (cc->c2)]; |
450 | : (*fs)[fs->find_font (c2[0])]; |
432 | |
451 | |
433 | f2->draw (d, x, y, &(t = cc->c2), 1, fg, -1); |
452 | f2->draw (d, x, y, c2, len2, fg, -1); |
434 | } |
453 | } |
435 | } |
454 | } |
436 | #endif |
455 | #endif |
437 | else |
456 | else |
438 | switch (t) |
457 | switch (t) |
… | |
… | |
678 | { |
697 | { |
679 | rxvt_fontprop p; |
698 | rxvt_fontprop p; |
680 | char fname[1024]; |
699 | char fname[1024]; |
681 | |
700 | |
682 | int diff = 0; |
701 | int diff = 0; |
683 | |
702 | |
684 | if (replace_field (fname, list[i], 6, '0', field_str)) |
703 | if (replace_field (fname, list[i], 6, '0', field_str)) |
685 | diff += 10; // slightly penalize scalable fonts |
704 | diff += 10; // slightly penalize scalable fonts |
686 | |
705 | |
687 | if (!set_properties (p, fname)) |
706 | if (!set_properties (p, fname)) |
688 | continue; |
707 | continue; |
… | |
… | |
1042 | return false; |
1061 | return false; |
1043 | |
1062 | |
1044 | FcValue v; |
1063 | FcValue v; |
1045 | |
1064 | |
1046 | if (prop.height != rxvt_fontprop::unset |
1065 | if (prop.height != rxvt_fontprop::unset |
1047 | && FcPatternGet (p, FC_PIXEL_SIZE, 0, &v) != FcResultMatch) |
1066 | || (FcPatternGet (p, FC_PIXEL_SIZE, 0, &v) != FcResultMatch |
|
|
1067 | && FcPatternGet (p, FC_SIZE, 0, &v) != FcResultMatch)) |
1048 | FcPatternAddInteger (p, FC_PIXEL_SIZE, prop.height); |
1068 | FcPatternAddInteger (p, FC_PIXEL_SIZE, prop.height); |
1049 | |
1069 | |
1050 | if (prop.weight != rxvt_fontprop::unset |
1070 | if (prop.weight != rxvt_fontprop::unset |
1051 | && FcPatternGet (p, FC_WEIGHT, 0, &v) != FcResultMatch) |
1071 | && FcPatternGet (p, FC_WEIGHT, 0, &v) != FcResultMatch) |
1052 | FcPatternAddInteger (p, FC_WEIGHT, prop.weight); |
1072 | FcPatternAddInteger (p, FC_WEIGHT, prop.weight); |
… | |
… | |
1264 | } |
1284 | } |
1265 | |
1285 | |
1266 | void |
1286 | void |
1267 | rxvt_fontset::clear () |
1287 | rxvt_fontset::clear () |
1268 | { |
1288 | { |
|
|
1289 | prop.width = prop.height = prop.weight = prop.slant |
|
|
1290 | = rxvt_fontprop::unset; |
|
|
1291 | |
1269 | for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++) |
1292 | for (rxvt_font **i = fonts.begin (); i != fonts.end (); i++) |
1270 | FONT_UNREF (*i); |
1293 | FONT_UNREF (*i); |
1271 | |
1294 | |
1272 | for (pagemap **p = fmap.begin (); p != fmap.end (); p++) |
1295 | for (pagemap **p = fmap.begin (); p != fmap.end (); p++) |
1273 | delete *p; |
1296 | delete *p; |
… | |
… | |
1393 | |
1416 | |
1394 | return true; |
1417 | return true; |
1395 | } |
1418 | } |
1396 | |
1419 | |
1397 | bool |
1420 | bool |
1398 | rxvt_fontset::populate (const char *desc, const rxvt_fontprop &prop) |
1421 | rxvt_fontset::populate (const char *desc) |
1399 | { |
1422 | { |
1400 | clear (); |
1423 | clear (); |
1401 | |
1424 | |
1402 | fontdesc = strdup (desc); |
1425 | fontdesc = strdup (desc); |
1403 | |
1426 | |
1404 | fonts.push_back (new_font (0, CS_UNICODE)); |
1427 | fonts.push_back (new_font (0, CS_UNICODE)); |
1405 | realize_font (0); |
1428 | realize_font (0); |
1406 | |
|
|
1407 | this->prop = prop; |
|
|
1408 | |
1429 | |
1409 | add_fonts (desc); |
1430 | add_fonts (desc); |
1410 | |
1431 | |
1411 | return true; |
1432 | return true; |
1412 | } |
1433 | } |