… | |
… | |
212 | } |
212 | } |
213 | |
213 | |
214 | ///////////////////////////////////////////////////////////////////////////// |
214 | ///////////////////////////////////////////////////////////////////////////// |
215 | |
215 | |
216 | rxvt_font::rxvt_font () |
216 | rxvt_font::rxvt_font () |
217 | : name(0), width(rxvt_fontprop::unset), height(rxvt_fontprop::unset) |
217 | : name(0), width(rxvt_fontprop::unset), height(rxvt_fontprop::unset), can_compose(false) |
218 | { |
218 | { |
219 | } |
219 | } |
220 | |
220 | |
221 | void |
221 | void |
222 | rxvt_font::set_name (char *name_) |
222 | rxvt_font::set_name (char *name_) |
… | |
… | |
345 | |
345 | |
346 | XSetForeground (disp, gc, term->pix_colors[fg]); |
346 | XSetForeground (disp, gc, term->pix_colors[fg]); |
347 | |
347 | |
348 | while (len) |
348 | while (len) |
349 | { |
349 | { |
|
|
350 | const text_t *tp = text; |
|
|
351 | text_t t = *tp; |
|
|
352 | |
|
|
353 | while (++text, --len && *text == NOCHAR) |
|
|
354 | ; |
|
|
355 | |
350 | #if ENABLE_COMBINING |
356 | #if ENABLE_COMBINING |
351 | compose_char *cc; |
357 | compose_char *cc; |
352 | #endif |
358 | #endif |
353 | const text_t *tp = text; |
|
|
354 | text_t t = *tp; |
|
|
355 | |
|
|
356 | while (++text, --len && *text == NOCHAR) |
|
|
357 | ; |
|
|
358 | |
|
|
359 | int width = text - tp; |
359 | int width = text - tp; |
360 | int fwidth = term->fwidth * width; |
360 | int fwidth = term->fwidth * width; |
361 | |
361 | |
362 | #ifdef BUILTIN_GLYPHS |
362 | #ifdef BUILTIN_GLYPHS |
363 | if (0x2500 <= t && t <= 0x259f) |
363 | if (0x2500 <= t && t <= 0x259f) |
… | |
… | |
442 | #else |
442 | #else |
443 | if (0) |
443 | if (0) |
444 | ; |
444 | ; |
445 | #endif |
445 | #endif |
446 | #if ENABLE_COMBINING |
446 | #if ENABLE_COMBINING |
447 | else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) |
447 | else if (IS_COMPOSE (t) && rxvt_composite[t]) |
448 | { |
448 | { |
449 | min_it (width, 2); // we only support wcwidth up to 2 |
449 | min_it (width, 2); // we only support wcwidth up to 2 |
450 | |
450 | |
|
|
451 | #if NOT_YET |
|
|
452 | vector<text_t> chrs; |
|
|
453 | chrs.reserve (rxvt_composite.expand (t)); |
|
|
454 | rxvt_composite.expand (t, &chrs[0]); |
|
|
455 | |
|
|
456 | while (!chrs.empty ()) |
|
|
457 | { |
|
|
458 | rxvt_font *f1 = fs->find_font_idx (chrs[0]) |
|
|
459 | |
|
|
460 | int i = 0; |
|
|
461 | while (i < chrs.size () - 1 |
|
|
462 | && f1->can_combine |
|
|
463 | && f1->has-char (chrs[i + 1], careful) |
|
|
464 | && !careful |
|
|
465 | ++i; |
|
|
466 | |
|
|
467 | (*fs)[f1]->draw (d, x, y, &chrs[0], width, fg, bg); |
|
|
468 | chrs.erase (&chrs[0], &chrs[i]); |
|
|
469 | } |
|
|
470 | #endif |
|
|
471 | |
|
|
472 | #if 1 |
451 | text_t chrs[2]; |
473 | text_t chrs[2]; |
452 | chrs [1] = NOCHAR; |
474 | chrs [1] = NOCHAR; |
453 | |
475 | |
454 | *chrs = cc->c1; |
476 | *chrs = cc->c1; |
455 | rxvt_font *f1 = (*fs)[fs->find_font_idx (cc->c1)]; |
477 | rxvt_font *f1 = (*fs)[fs->find_font_idx (cc->c1)]; |
… | |
… | |
465 | ? f1 |
487 | ? f1 |
466 | : (*fs)[fs->find_font_idx (cc->c2)]; |
488 | : (*fs)[fs->find_font_idx (cc->c2)]; |
467 | |
489 | |
468 | f2->draw (d, x, y, chrs, width, fg, Color_none); |
490 | f2->draw (d, x, y, chrs, width, fg, Color_none); |
469 | } |
491 | } |
|
|
492 | #endif |
470 | } |
493 | } |
471 | #endif |
494 | #endif |
472 | else |
495 | else |
473 | switch (t) |
496 | switch (t) |
474 | { |
497 | { |
… | |
… | |
1140 | |
1163 | |
1141 | struct rxvt_font_xft : rxvt_font |
1164 | struct rxvt_font_xft : rxvt_font |
1142 | { |
1165 | { |
1143 | rxvt_font_xft () |
1166 | rxvt_font_xft () |
1144 | { |
1167 | { |
|
|
1168 | can_compose = true; |
1145 | f = 0; |
1169 | f = 0; |
1146 | } |
1170 | } |
1147 | |
1171 | |
1148 | void clear (); |
1172 | void clear (); |
1149 | |
1173 | |