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.170 by sf-exg, Thu Dec 30 01:13:24 2010 UTC vs.
Revision 1.179 by sf-exg, Tue May 3 08:48:26 2011 UTC

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
241 { 241 {
242#if XFT 242#if XFT
243 Picture dst; 243 Picture dst;
244 244
245# ifdef HAVE_BG_PIXMAP 245# ifdef HAVE_BG_PIXMAP
246 if (term->bgPixmap.pixmap 246 if (term->bg_pixmap
247 && !term->pix_colors[color].is_opaque () 247 && !term->pix_colors[color].is_opaque ()
248 && ((dst = XftDrawPicture (d)))) 248 && ((dst = XftDrawPicture (d))))
249 { 249 {
250 XClearArea (disp, d, x, y, w, h, false); 250 XClearArea (disp, d, x, y, w, h, false);
251 251
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/////////////////////////////////////////////////////////////////////////////
718 f = XLoadQueryFont (disp, name); 722 f = XLoadQueryFont (disp, name);
719 723
720 if (!f) 724 if (!f)
721 return false; 725 return false;
722 726
723 char *new_name = get_property (f, XA_FONT, name); 727 char *new_name = get_property (f, XA_FONT, 0);
724 728
725 if (new_name) 729 if (new_name)
726 set_name (new_name); 730 set_name (new_name);
727 else 731 else
728 rxvt_warn ("font '%s' has no FONT property, continuing without.", name); 732 rxvt_warn ("font '%s' has no FONT property, continuing without.\n", name);
729 733
730 XFreeFont (disp, f); 734 XFreeFont (disp, f);
731 f = 0; 735 f = 0;
732 } 736 }
733 737
864 free (registry); 868 free (registry);
865 free (encoding); 869 free (encoding);
866 870
867 if (cs == CS_UNKNOWN) 871 if (cs == CS_UNKNOWN)
868 { 872 {
869 const char *charset = get_property (f, XA_FONT, 0); 873 char *value = get_property (f, XA_FONT, 0);
874 const char *charset = value;
870 875
871 if (!charset) 876 if (!charset)
872 charset = name; 877 charset = name;
873 878
874 int count = 13; 879 int count = 13;
877 break; 882 break;
878 883
879 cs = codeset_from_name (charset); 884 cs = codeset_from_name (charset);
880 if (cs == CS_UNKNOWN) 885 if (cs == CS_UNKNOWN)
881 rxvt_warn ("%s: cannot deduce encoding from font name property \"%s\", ignoring font.\n", name, charset); 886 rxvt_warn ("%s: cannot deduce encoding from font name property \"%s\", ignoring font.\n", name, charset);
887
888 free (value);
882 } 889 }
883 890
884 if (cs == CS_UNKNOWN) 891 if (cs == CS_UNKNOWN)
885 { 892 {
886 clear (); 893 clear ();
964} 971}
965 972
966bool 973bool
967rxvt_font_x11::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const 974rxvt_font_x11::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const
968{ 975{
976 careful = false;
977
969 uint32_t ch = FROM_UNICODE (cs, unicode); 978 uint32_t ch = FROM_UNICODE (cs, unicode);
970 979
971 if (ch == NOCHAR) 980 if (ch == NOCHAR)
972 return false; 981 return false;
973 982
1215 int ftheight = 0; 1224 int ftheight = 0;
1216 bool success = true; 1225 bool success = true;
1217 1226
1218 for (;;) 1227 for (;;)
1219 { 1228 {
1229 p = FcPatternDuplicate (match);
1220 f = XftFontOpenPattern (disp, FcPatternDuplicate (match)); 1230 f = XftFontOpenPattern (disp, p);
1221 1231
1222 if (!f) 1232 if (!f)
1223 { 1233 {
1234 FcPatternDestroy (p);
1224 success = false; 1235 success = false;
1225 break; 1236 break;
1226 } 1237 }
1227 1238
1228 FT_Face face = XftLockFace (f); 1239 FT_Face face = XftLockFace (f);
1401 rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); 1412 rxvt_drawable &d2 = d.screen->scratch_drawable (w, h);
1402 1413
1403#ifdef HAVE_BG_PIXMAP 1414#ifdef HAVE_BG_PIXMAP
1404 Picture dst = 0; // the only assignment is done conditionally in the following if condition 1415 Picture dst = 0; // the only assignment is done conditionally in the following if condition
1405 1416
1406 if (term->bgPixmap.pixmap 1417 if (term->bg_pixmap
1407 && (bg == Color_transparent || bg == Color_bg 1418 && (bg == Color_transparent || bg == Color_bg
1408 || (bg >= 0 && !term->pix_colors[bg].is_opaque () && ((dst = XftDrawPicture (d2)))))) 1419 || (bg >= 0 && !term->pix_colors[bg].is_opaque () && ((dst = XftDrawPicture (d2))))))
1409 { 1420 {
1410 int src_x = x, src_y = y; 1421 int src_x = x, src_y = y;
1411 1422
1412 if (term->bgPixmap.flags & bgPixmap_t::isTransparent) 1423 if (term->bg_flags & rxvt_term::BG_IS_TRANSPARENT)
1413 { 1424 {
1414 src_x += term->window_vt_x; 1425 src_x += term->window_vt_x;
1415 src_y += term->window_vt_y; 1426 src_y += term->window_vt_y;
1416 } 1427 }
1417 1428
1418 if (term->bgPixmap.pmap_width >= src_x + w 1429 if (term->bg_pmap_width >= src_x + w
1419 && term->bgPixmap.pmap_height >= src_y + h) 1430 && term->bg_pmap_height >= src_y + h)
1420 { 1431 {
1421 XCopyArea (disp, term->bgPixmap.pixmap, d2, gc, 1432 XCopyArea (disp, term->bg_pixmap, d2, gc,
1422 src_x, src_y, w, h, 0, 0); 1433 src_x, src_y, w, h, 0, 0);
1423 } 1434 }
1424 else 1435 else
1425 { 1436 {
1426 XGCValues gcv; 1437 XGCValues gcv;
1427 1438
1428 gcv.fill_style = FillTiled; 1439 gcv.fill_style = FillTiled;
1429 gcv.tile = term->bgPixmap.pixmap; 1440 gcv.tile = term->bg_pixmap;
1430 gcv.ts_x_origin = -src_x; 1441 gcv.ts_x_origin = -src_x;
1431 gcv.ts_y_origin = -src_y; 1442 gcv.ts_y_origin = -src_y;
1432 1443
1433 XChangeGC (disp, gc, 1444 XChangeGC (disp, gc,
1434 GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, 1445 GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle,
1609 buf[end - desc] = 0; 1620 buf[end - desc] = 0;
1610 1621
1611 push_font (new_font (buf, cs)); 1622 push_font (new_font (buf, cs));
1612 } 1623 }
1613 else 1624 else
1614 rxvt_warn ("fontset element too long (>511 bytes), ignored."); 1625 rxvt_warn ("fontset element too long (>511 bytes), ignored.\n");
1615 1626
1616 desc = end + 1; 1627 desc = end + 1;
1617 } 1628 }
1618 while (*end); 1629 while (*end);
1619 } 1630 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines