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.48 by root, Sun Nov 21 20:19:24 2004 UTC vs.
Revision 1.67 by root, Sat Feb 12 18:55:04 2005 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: defaultfont.C 2 * File: rxvtfont.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> 4 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com>
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
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_ZH || ENCODING_ZH_EXT 93#if ENCODING_ZH || ENCODING_ZH_EXT
94# if XFT 94# if XFT
95 { CS_GBK_0, "xft:AR PL KaitiM GB" },
96 { CS_GBK_0, "xft:AR PL SungtiL GB" },
97 { CS_GBK_0, "xft::spacing=100:lang=zh" },
95 { CS_BIG5_EXT, "xft:AR PL Mingti2L Big5" }, 98 { CS_BIG5_EXT, "xft:AR PL Mingti2L Big5" },
96 { CS_BIG5_EXT, "xft:AR PL KaitiM Big5" }, 99 { CS_BIG5_EXT, "xft:AR PL KaitiM Big5" },
97 { CS_GB2312_1980_0, "xft:AR PL KaitiM GB" }, 100 { CS_GB2312_1980_0, "xft:AR PL KaitiM GB" },
98 { CS_GB2312_1980_0, "xft:AR PL SungtiL GB" }, 101 { CS_GB2312_1980_0, "xft:AR PL SungtiL GB" },
99 { CS_GB2312_1980_0, "xft::spacing=100:lang=zh" }, 102 { CS_GB2312_1980_0, "xft::spacing=100:lang=zh" },
100# endif 103# endif
104 { CS_GBK_0, "-*-*-*-*-*-*-*-*-*-*-c-*-gbk*-0" },
101 { CS_BIG5, "-*-*-*-*-*-*-*-*-*-*-c-*-big5-0" }, 105 { CS_BIG5, "-*-*-*-*-*-*-*-*-*-*-c-*-big5-0" },
102 { CS_BIG5_PLUS, "-*-*-*-*-*-*-*-*-*-*-c-*-big5p-0" }, 106 { CS_BIG5_PLUS, "-*-*-*-*-*-*-*-*-*-*-c-*-big5p-0" },
103 { CS_BIG5_EXT, "-*-*-*-*-*-*-*-*-*-*-c-*-big5.eten-0" }, 107 { CS_BIG5_EXT, "-*-*-*-*-*-*-*-*-*-*-c-*-big5.eten-0" },
108 { CS_GB2312_1980_0, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" },
104 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" }, 109 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" },
105 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" }, 110 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" },
106 { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" }, 111 { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" },
107 { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" }, 112 { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" },
108 { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" }, 113 { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" },
138 143
139 { CS_UNKNOWN, 0 } 144 { CS_UNKNOWN, 0 }
140}; 145};
141 146
142// these characters are used to guess the font height and width 147// these characters are used to guess the font height and width
143// pango uses a similar algorithm and eosn't trust the font either. 148// pango uses a similar algorithm and doesn't trust the font either.
144static uint16_t extent_test_chars[] = { 149static uint16_t extent_test_chars[] = {
145 '0', '1', '8', 'a', 'd', 'x', 'm', 'y', 'g', 'W', 'X', '\'', '_', 150 '0', '1', '8', 'a', 'd', 'x', 'm', 'y', 'g', 'W', 'X', '\'', '_',
146 0x00cd, 0x00d5, 0x0114, 0x0177, 0x0643, // ÍÕĔŷﻙ 151 0x00cd, 0x00d5, 0x0114, 0x0177, 0x0643, // ÍÕĔŷﻙ
147 0x304c, 0x672c, // が本 152 0x304c, 0x672c, // が本
148}; 153};
326void 331void
327rxvt_font_default::draw (rxvt_drawable &d, int x, int y, 332rxvt_font_default::draw (rxvt_drawable &d, int x, int y,
328 const text_t *text, int len, 333 const text_t *text, int len,
329 int fg, int bg) 334 int fg, int bg)
330{ 335{
336 Display *disp = d.display->display;
337
331 clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg); 338 clear_rect (d, x, y, r->TermWin.fwidth * len, r->TermWin.fheight, bg);
332 339
333 XSetForeground (d.display->display, TGC, r->pix_colors[fg]); 340 XSetForeground (disp, TGC, r->pix_colors[fg]);
334 341
335 while (len--) 342 while (len)
336 { 343 {
337#if ENABLE_COMBINING 344#if ENABLE_COMBINING
338 compose_char *cc; 345 compose_char *cc;
339#endif 346#endif
347 const text_t *tp = text;
340 text_t t = *text++; 348 text_t t = *tp;
349
350 while (++text, --len && *text == NOCHAR)
351 ;
352
353 int width = text - tp;
354 int fwidth = r->TermWin.fwidth * width;
341 355
342 if (0x2500 <= t && t <= 0x259f) 356 if (0x2500 <= t && t <= 0x259f)
343 { 357 {
344 uint16_t offs = linedraw_offs[t - 0x2500]; 358 uint16_t offs = linedraw_offs[t - 0x2500];
345 uint32_t *a = linedraw_command + (offs >> 4); 359 uint32_t *a = linedraw_command + (offs >> 4);
346 uint32_t *b = a + (offs & 15); 360 uint32_t *b = a + (offs & 15);
347 361
348 int W = r->TermWin.fwidth; 362 int W = fwidth;
349 int H = r->TermWin.fheight; 363 int H = r->TermWin.fheight;
350 364
351 int x_[16]; 365 int x_[16];
352 int y_[16]; 366 int y_[16];
353 367
362 376
363 XGCValues gcv; 377 XGCValues gcv;
364 378
365 gcv.cap_style = CapButt; 379 gcv.cap_style = CapButt;
366 gcv.line_width = 0; 380 gcv.line_width = 0;
367 XChangeGC (d.display->display, TGC, GCLineWidth | GCCapStyle, &gcv); 381 XChangeGC (disp, TGC, GCLineWidth | GCCapStyle, &gcv);
368 382
369 while (a < b) 383 while (a < b)
370 { 384 {
371 uint32_t command = *a++; 385 uint32_t command = *a++;
372 386
379 int y2 = y_[(command >> 0) & 15]; 393 int y2 = y_[(command >> 0) & 15];
380 394
381 switch (op) 395 switch (op)
382 { 396 {
383 case 0: // line 397 case 0: // line
384 XDrawLine (d.display->display, d, TGC, x1, y1, x2, y2); 398 XDrawLine (disp, d, TGC, x1, y1, x2, y2);
385 break; 399 break;
386 400
387 case 1: // rectangle, possibly stippled 401 case 1: // rectangle, possibly stippled
388 if (a) 402 if (a)
389 { 403 {
390 static char bm[] = { 0,0 , 3,1 , 1,2 , 1,0 }; 404 static char bm[] = { 0,0 , 3,1 , 1,2 , 1,0 };
391 405
392 gcv.fill_style = FillStippled; 406 gcv.fill_style = FillStippled;
393 gcv.stipple = XCreateBitmapFromData (d.display->display, d, bm + a * 2, 2, 2); 407 gcv.stipple = XCreateBitmapFromData (disp, d, bm + a * 2, 2, 2);
394 gcv.ts_x_origin = x; 408 gcv.ts_x_origin = x;
395 gcv.ts_y_origin = y; 409 gcv.ts_y_origin = y;
396 410
397 XChangeGC (d.display->display, TGC, 411 XChangeGC (disp, TGC,
398 GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin, 412 GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin,
399 &gcv); 413 &gcv);
400 } 414 }
401 415
402 XFillRectangle (d.display->display, d, TGC, x1, y1, x2 - x1 + 1, y2 - y1 + 1); 416 XFillRectangle (disp, d, TGC, x1, y1, x2 - x1 + 1, y2 - y1 + 1);
403 417
404 if (a) 418 if (a)
405 { 419 {
406 XFreePixmap (d.display->display, gcv.stipple); 420 XFreePixmap (disp, gcv.stipple);
407 gcv.stipple = 0; 421 gcv.stipple = 0;
408 gcv.fill_style = FillSolid; 422 gcv.fill_style = FillSolid;
409 XChangeGC (d.display->display, TGC, GCFillStyle, &gcv); 423 XChangeGC (disp, TGC, GCFillStyle, &gcv);
410 } 424 }
411 break; 425 break;
412 case 2: // arc 426 case 2: // arc
413 XDrawArc (d.display->display, d, TGC, 427 XDrawArc (disp, d, TGC,
414 x1 - W/2, y1 - H/2, W-1, H-1, 428 x1 - W/2, y1 - H/2, W-1, H-1,
415 (a - 1) * 90*64, (b - 1) * 90*64); 429 (a - 1) * 90*64, (b - 1) * 90*64);
416 break; 430 break;
417 } 431 }
418 } 432 }
419 } 433 }
420#if ENABLE_COMBINING 434#if ENABLE_COMBINING
421 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) 435 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t]))
422 { 436 {
423 text_t c2[2]; 437 text_t chrs[2];
424 int len2 = 1; 438 width = min (2, width);
425 439 chrs [1] = NOCHAR;
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 440
433 c2[0] = cc->c1; 441 *chrs = cc->c1;
434 rxvt_font *f1 = (*fs)[fs->find_font (c2[0])]; 442 rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)];
435 f1->draw (d, x, y, c2, len2, fg, bg); 443 f1->draw (d, x, y, chrs, width, fg, bg);
436 444
437 if (cc->c2 != NOCHAR) 445 if (cc->c2 != NOCHAR)
438 { 446 {
439 bool careful; 447 bool careful;
440 448
441 // prefer font of first character, for no good reasons 449 // prefer font of first character, for no good reasons
442 c2[0] = cc->c2; 450 *chrs = cc->c2;
443 rxvt_font *f2 = (f1->has_char (c2[0], 0, careful) && !careful) 451 rxvt_font *f2 = (f1->has_char (cc->c2, 0, careful) && !careful)
444 ? f1 452 ? f1
445 : (*fs)[fs->find_font (c2[0])]; 453 : (*fs)[fs->find_font (cc->c2)];
446 454
447 f2->draw (d, x, y, c2, len2, fg, -1); 455 f2->draw (d, x, y, chrs, width, fg, -1);
448 } 456 }
449 } 457 }
450#endif 458#endif
451 else 459 else
452 switch (t) 460 switch (t)
455 case ZERO_WIDTH_CHAR: 463 case ZERO_WIDTH_CHAR:
456 case NOCHAR: 464 case NOCHAR:
457 break; 465 break;
458 466
459 default: 467 default:
460 int w = 0;
461 while (len > 0 && *text == NOCHAR)
462 {
463 ++text;
464 --len;
465 w += r->TermWin.fwidth;
466 }
467
468 XDrawRectangle (d.display->display, d, TGC, x + 2, y + 2, 468 XDrawRectangle (disp, d, TGC, x + 2, y + 2,
469 w + r->TermWin.fwidth - 4, r->TermWin.fheight - 4); 469 fwidth - 4, r->TermWin.fheight - 4);
470 x += w;
471 } 470 }
472 471
473 x += r->TermWin.fwidth; 472 x += fwidth;
474 } 473 }
475} 474}
476 475
477///////////////////////////////////////////////////////////////////////////// 476/////////////////////////////////////////////////////////////////////////////
478 477
534 533
535bool 534bool
536rxvt_font_x11::set_properties (rxvt_fontprop &p, XFontStruct *f) 535rxvt_font_x11::set_properties (rxvt_fontprop &p, XFontStruct *f)
537{ 536{
538 unsigned long height; 537 unsigned long height;
538
539#if 0
539 if (!XGetFontProperty (f, XInternAtom (DISPLAY, "PIXEL_SIZE", 0), &height)) 540 if (!XGetFontProperty (f, XInternAtom (DISPLAY, "PIXEL_SIZE", 0), &height))
540 return false; 541 return false;
542#else
543 height = f->ascent + f->descent;
544#endif
541 545
542 unsigned long avgwidth; 546 unsigned long avgwidth;
543 if (!XGetFontProperty (f, XInternAtom (DISPLAY, "AVERAGE_WIDTH", 0), &avgwidth)) 547 if (!XGetFontProperty (f, XInternAtom (DISPLAY, "AVERAGE_WIDTH", 0), &avgwidth))
544 avgwidth = 0; 548 avgwidth = 0;
545 549
628} 632}
629 633
630bool 634bool
631rxvt_font_x11::load (const rxvt_fontprop &prop) 635rxvt_font_x11::load (const rxvt_fontprop &prop)
632{ 636{
637 Display *disp = DISPLAY;
638
633 clear (); 639 clear ();
634 640
635 char field_str[64]; // enough for 128 bits 641 char field_str[64]; // enough for 128 bits
636 642
637 // first morph the font if required 643 // first morph the font if required
640 { 646 {
641 char fname[1024]; 647 char fname[1024];
642 648
643 if (name[0] != '-') 649 if (name[0] != '-')
644 { 650 {
645 f = XLoadQueryFont (DISPLAY, name); 651 f = XLoadQueryFont (disp, name);
646 652
647 if (!f) 653 if (!f)
648 return false; 654 return false;
649 655
650 char *new_name = get_property (f, "FONT", name); 656 char *new_name = get_property (f, "FONT", name);
652 if (new_name) 658 if (new_name)
653 set_name (new_name); 659 set_name (new_name);
654 else 660 else
655 rxvt_warn ("font '%s' has no FONT property, continuing without.", name); 661 rxvt_warn ("font '%s' has no FONT property, continuing without.", name);
656 662
657 XFreeFont (DISPLAY, f); 663 XFreeFont (disp, f);
658 f = 0; 664 f = 0;
659 } 665 }
660 666
661 if (prop.weight != rxvt_fontprop::unset) 667 if (prop.weight != rxvt_fontprop::unset)
662 { 668 {
673 ? "r" : "i"); // TODO: handle "o"blique, too 679 ? "r" : "i"); // TODO: handle "o"blique, too
674 set_name (strdup (fname)); 680 set_name (strdup (fname));
675 } 681 }
676 } 682 }
677 683
684 sprintf (field_str, "%d", prop.height == rxvt_fontprop::unset
685 ? 0 : prop.height);
686
687 struct font_weight {
688 char *name;
689 int diff;
690
691 void clear ()
692 {
693 name = 0;
694 diff = 0x7fffffff;
695 }
696
697 font_weight () { clear (); }
698 ~font_weight () { free (name); }
699 };
700
678 char **list; 701 char **list;
679 int count; 702 int count;
680 list = XListFonts (DISPLAY, name, 1024, &count); 703 list = XListFonts (disp, name, 4000, &count);
681 704
682 set_name (0); 705 set_name (0);
683 706
684 if (!list) 707 if (!list)
685 return false; 708 return false;
686 709
687 sprintf (field_str, "%d", prop.height == rxvt_fontprop::unset 710 font_weight *fonts = new font_weight[count];
688 ? 0 : prop.height);
689 711
690 int bestdiff = 0x7fffffff;
691 for (int i = 0; i < count; i++) 712 for (int i = 0; i < count; i++)
692 { 713 {
693 rxvt_fontprop p; 714 rxvt_fontprop p;
694 char fname[1024]; 715 char fname[1024];
695 716
708 if (prop.height != rxvt_fontprop::unset) diff += (prop.height - p.height) * 128; 729 if (prop.height != rxvt_fontprop::unset) diff += (prop.height - p.height) * 128;
709 if (prop.weight != rxvt_fontprop::unset) diff += abs (prop.weight - p.weight); 730 if (prop.weight != rxvt_fontprop::unset) diff += abs (prop.weight - p.weight);
710 if (prop.slant != rxvt_fontprop::unset) diff += abs (prop.slant - p.slant); 731 if (prop.slant != rxvt_fontprop::unset) diff += abs (prop.slant - p.slant);
711 //if (prop.width != rxvt_fontprop::unset) diff += abs (prop.width - p.width); 732 //if (prop.width != rxvt_fontprop::unset) diff += abs (prop.width - p.width);
712 733
713 if (!name // compare against best found so far 734 fonts[i].name = strdup (fname);
714 || diff < bestdiff) 735 fonts[i].diff = diff;
715 {
716 set_name (strdup (fname));
717 bestdiff = diff;
718 }
719 } 736 }
720 737
721 XFreeFontNames (list); 738 XFreeFontNames (list);
722 739
723 if (!name) 740 // this loop only iterates when the guessed font-size is too small
724 return false; 741 for (;;)
742 {
743 font_weight *best = fonts + count - 1;
725 744
726 f = XLoadQueryFont (DISPLAY, name); 745 for (font_weight *w = best; w-- > fonts; )
746 if (w->diff < best->diff)
747 best = w;
748
749 if (!best->name
750 || !(f = XLoadQueryFont (disp, best->name)))
751 break;
752
753 set_name (best->name);
754 best->clear ();
755
756 ascent = f->ascent;
757 descent = f->descent;
758 height = ascent + descent;
759
760 if (prop.height == rxvt_fontprop::unset
761 || height <= prop.height)
762 break; // font is ready for use
763
764 // PIXEL_SIZE small enough, but real height too large
765 clear ();
766 }
767
768 delete [] fonts;
727 769
728 if (!f) 770 if (!f)
729 return false; 771 return false;
730 772
731 char *registry = get_property (f, "CHARSET_REGISTRY", 0); 773 char *registry = get_property (f, "CHARSET_REGISTRY", 0);
759 if (cs == CS_UNICODE) 801 if (cs == CS_UNICODE)
760 cs = CS_UNICODE_16; // X11 can have a max. of 65536 chars per font 802 cs = CS_UNICODE_16; // X11 can have a max. of 65536 chars per font
761 803
762 encm = f->min_byte1 != 0 || f->max_byte1 != 0; 804 encm = f->min_byte1 != 0 || f->max_byte1 != 0;
763 enc2b = encm || f->max_char_or_byte2 > 255; 805 enc2b = encm || f->max_char_or_byte2 > 255;
764
765 ascent = f->ascent;
766 descent = f->descent;
767 height = ascent + descent;
768 806
769 slow = false; 807 slow = false;
770 808
771#if 1 // only used for slow detection, TODO optimize 809#if 1 // only used for slow detection, TODO optimize
772 if (f->min_bounds.width == f->max_bounds.width) 810 if (f->min_bounds.width == f->max_bounds.width)
1046} 1084}
1047 1085
1048bool 1086bool
1049rxvt_font_xft::load (const rxvt_fontprop &prop) 1087rxvt_font_xft::load (const rxvt_fontprop &prop)
1050{ 1088{
1089 Display *disp = DISPLAY;
1090
1051 clear (); 1091 clear ();
1052 1092
1053 FcPattern *p = FcNameParse ((FcChar8 *) name); 1093 FcPattern *p = FcNameParse ((FcChar8 *) name);
1054 1094
1055 if (!p) 1095 if (!p)
1056 return false; 1096 return false;
1057 1097
1058 FcValue v; 1098 FcValue v;
1059 1099
1060 if (prop.height != rxvt_fontprop::unset 1100 if (prop.height != rxvt_fontprop::unset
1061 || FcPatternGet (p, FC_PIXEL_SIZE, 0, &v) != FcResultMatch) 1101 || (FcPatternGet (p, FC_PIXEL_SIZE, 0, &v) != FcResultMatch
1102 && FcPatternGet (p, FC_SIZE, 0, &v) != FcResultMatch))
1062 FcPatternAddInteger (p, FC_PIXEL_SIZE, prop.height); 1103 FcPatternAddInteger (p, FC_PIXEL_SIZE, prop.height);
1063 1104
1064 if (prop.weight != rxvt_fontprop::unset 1105 if (prop.weight != rxvt_fontprop::unset
1065 && FcPatternGet (p, FC_WEIGHT, 0, &v) != FcResultMatch) 1106 && FcPatternGet (p, FC_WEIGHT, 0, &v) != FcResultMatch)
1066 FcPatternAddInteger (p, FC_WEIGHT, prop.weight); 1107 FcPatternAddInteger (p, FC_WEIGHT, prop.weight);
1080 1121
1081 // store generated name so iso14755 view gives better results 1122 // store generated name so iso14755 view gives better results
1082 set_name ((char *)FcNameUnparse (p)); 1123 set_name ((char *)FcNameUnparse (p));
1083 1124
1084 XftResult result; 1125 XftResult result;
1085 FcPattern *match = XftFontMatch (DISPLAY, DefaultScreen (DISPLAY), p, &result); 1126 FcPattern *match = XftFontMatch (disp, r->display->screen, p, &result);
1086 1127
1087 FcPatternDestroy (p); 1128 FcPatternDestroy (p);
1088 1129
1089 if (!match) 1130 if (!match)
1090 return false; 1131 return false;
1092 int ftheight = 0; 1133 int ftheight = 0;
1093 bool success = true; 1134 bool success = true;
1094 1135
1095 for (;;) 1136 for (;;)
1096 { 1137 {
1097 f = XftFontOpenPattern (DISPLAY, FcPatternDuplicate (match)); 1138 f = XftFontOpenPattern (disp, FcPatternDuplicate (match));
1098 1139
1099 if (!f) 1140 if (!f)
1100 { 1141 {
1101 success = false; 1142 success = false;
1102 break; 1143 break;
1126 bool careful; 1167 bool careful;
1127 if (!has_char (*t, &prop, careful)) 1168 if (!has_char (*t, &prop, careful))
1128 continue; 1169 continue;
1129 1170
1130 XGlyphInfo g; 1171 XGlyphInfo g;
1131 XftTextExtents16 (DISPLAY, f, &ch, 1, &g); 1172 XftTextExtents16 (disp, f, &ch, 1, &g);
1132 1173
1133 int wcw = wcwidth (ch); 1174 int wcw = wcwidth (ch);
1134 if (wcw > 0) g.width = g.width / wcw; 1175 if (wcw > 0) g.width = g.width / wcw;
1135 1176
1136 if (width < g.width) width = g.width; 1177 if (width < g.width) width = g.width;
1153 ftheight -= height - prop.height; 1194 ftheight -= height - prop.height;
1154 } 1195 }
1155 else 1196 else
1156 ftheight = prop.height - 1; 1197 ftheight = prop.height - 1;
1157 1198
1158 XftFontClose (DISPLAY, f); 1199 XftFontClose (disp, f);
1159 FcPatternDel (match, FC_PIXEL_SIZE); 1200 FcPatternDel (match, FC_PIXEL_SIZE);
1160 FcPatternAddInteger (match, FC_PIXEL_SIZE, ftheight); 1201 FcPatternAddInteger (match, FC_PIXEL_SIZE, ftheight);
1161 } 1202 }
1162 1203
1163 FcPatternDestroy (match); 1204 FcPatternDestroy (match);
1340 char buf[512]; 1381 char buf[512];
1341 const char *end; 1382 const char *end;
1342 1383
1343 do 1384 do
1344 { 1385 {
1345 while (*desc <= ' ') desc++; 1386 while (*desc && *desc <= ' ')
1387 desc++;
1346 1388
1347 codeset cs = CS_UNICODE; 1389 codeset cs = CS_UNICODE;
1348 1390
1349 if (*desc == '[') 1391 if (*desc == '[')
1350 { 1392 {
1508 FcPatternAddInteger (p, FC_SLANT, prop.slant); 1550 FcPatternAddInteger (p, FC_SLANT, prop.slant);
1509 FcPatternAddBool (p, FC_MINSPACE, 1); 1551 FcPatternAddBool (p, FC_MINSPACE, 1);
1510 //FcPatternAddBool (p, FC_ANTIALIAS, 1); 1552 //FcPatternAddBool (p, FC_ANTIALIAS, 1);
1511 1553
1512 XftResult result; 1554 XftResult result;
1513 FcPattern *match = XftFontMatch (DISPLAY, DefaultScreen (DISPLAY), p, &result); 1555 FcPattern *match = XftFontMatch (DISPLAY, r->display->screen, p, &result);
1514 1556
1515 FcPatternDestroy (p); 1557 FcPatternDestroy (p);
1516 1558
1517 if (match) 1559 if (match)
1518 { 1560 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines