1 | /*----------------------------------------------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: rxvtfont.C |
2 | * File: rxvtfont.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * Copyright (c) 2003-2008 Marc Lehmann <pcg@goof.com> |
4 | * Copyright (c) 2003-2008 Marc Lehmann <schmorp@schmorp.de> |
5 | * - original version. |
5 | * - original version. |
6 | * |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
9 | * the Free Software Foundation; either version 2 of the License, or |
… | |
… | |
524 | |
524 | |
525 | void draw (rxvt_drawable &d, int x, int y, |
525 | void draw (rxvt_drawable &d, int x, int y, |
526 | const text_t *text, int len, |
526 | const text_t *text, int len, |
527 | int fg, int bg) |
527 | int fg, int bg) |
528 | { |
528 | { |
529 | while (len--) |
529 | while (len) |
530 | { |
530 | { |
531 | int fid = fs->find_font_idx (*text); |
531 | int fid = fs->find_font_idx (*text); |
|
|
532 | int w = 1; |
|
|
533 | while (w < len && text[w] == NOCHAR) |
|
|
534 | w++; |
532 | (*fs)[fid]->draw (d, x, y, text, 1, fg, bg); |
535 | (*fs)[fid]->draw (d, x, y, text, w, fg, bg); |
533 | ++text; |
536 | text += w; |
|
|
537 | len -= w; |
534 | x += term->fwidth; |
538 | x += term->fwidth * w; |
535 | } |
539 | } |
536 | } |
540 | } |
537 | }; |
541 | }; |
538 | |
542 | |
539 | ///////////////////////////////////////////////////////////////////////////// |
543 | ///////////////////////////////////////////////////////////////////////////// |
… | |
… | |
921 | } |
925 | } |
922 | #endif |
926 | #endif |
923 | |
927 | |
924 | width = 1; |
928 | width = 1; |
925 | |
929 | |
926 | for (uint16_t *t = extent_test_chars + ARRAY_LENGTH(extent_test_chars); t-- > extent_test_chars; ) |
930 | for (uint16_t *t = extent_test_chars + ecb_array_length (extent_test_chars); t-- > extent_test_chars; ) |
927 | { |
931 | { |
928 | if (FROM_UNICODE (cs, *t) == NOCHAR) |
932 | if (FROM_UNICODE (cs, *t) == NOCHAR) |
929 | continue; |
933 | continue; |
930 | |
934 | |
931 | // ignore characters we wouldn't use anyways |
935 | // ignore characters we wouldn't use anyways |
… | |
… | |
967 | } |
971 | } |
968 | |
972 | |
969 | bool |
973 | bool |
970 | rxvt_font_x11::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const |
974 | rxvt_font_x11::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const |
971 | { |
975 | { |
|
|
976 | careful = false; |
|
|
977 | |
972 | uint32_t ch = FROM_UNICODE (cs, unicode); |
978 | uint32_t ch = FROM_UNICODE (cs, unicode); |
973 | |
979 | |
974 | if (ch == NOCHAR) |
980 | if (ch == NOCHAR) |
975 | return false; |
981 | return false; |
976 | |
982 | |
… | |
… | |
1241 | |
1247 | |
1242 | XftUnlockFace (f); |
1248 | XftUnlockFace (f); |
1243 | |
1249 | |
1244 | int glheight = height; |
1250 | int glheight = height; |
1245 | |
1251 | |
1246 | for (uint16_t *t = extent_test_chars + ARRAY_LENGTH(extent_test_chars); t-- > extent_test_chars; ) |
1252 | for (uint16_t *t = extent_test_chars + ecb_array_length (extent_test_chars); t-- > extent_test_chars; ) |
1247 | { |
1253 | { |
1248 | FcChar16 ch = *t; |
1254 | FcChar16 ch = *t; |
1249 | |
1255 | |
1250 | if (cs != CS_UNICODE |
1256 | if (cs != CS_UNICODE |
1251 | && ch > 0x100 |
1257 | && ch > 0x100 |
… | |
… | |
1412 | && (bg == Color_transparent || bg == Color_bg |
1418 | && (bg == Color_transparent || bg == Color_bg |
1413 | || (bg >= 0 && !term->pix_colors[bg].is_opaque () && ((dst = XftDrawPicture (d2)))))) |
1419 | || (bg >= 0 && !term->pix_colors[bg].is_opaque () && ((dst = XftDrawPicture (d2)))))) |
1414 | { |
1420 | { |
1415 | int src_x = x, src_y = y; |
1421 | int src_x = x, src_y = y; |
1416 | |
1422 | |
1417 | if (term->bg_flags & rxvt_term::isTransparent) |
1423 | if (term->bg_flags & rxvt_term::BG_IS_TRANSPARENT) |
1418 | { |
1424 | { |
1419 | src_x += term->window_vt_x; |
1425 | src_x += term->window_vt_x; |
1420 | src_y += term->window_vt_y; |
1426 | src_y += term->window_vt_y; |
1421 | } |
1427 | } |
1422 | |
1428 | |