ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/defaultfont.C
(Generate patch)

Comparing rxvt-unicode/src/defaultfont.C (file contents):
Revision 1.36 by pcg, Fri Mar 5 04:43:41 2004 UTC vs.
Revision 1.41 by pcg, Mon Mar 15 01:27:46 2004 UTC

61# if XFT 61# if XFT
62 // prefer xft for complex scripts 62 // prefer xft for complex scripts
63 { CS_UNICODE, "xft:Kochi Gothic:antialias=false" }, 63 { CS_UNICODE, "xft:Kochi Gothic:antialias=false" },
64# endif 64# endif
65 { CS_JIS0201_1976_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0201*-0" }, 65 { CS_JIS0201_1976_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0201*-0" },
66 { CS_JIS0208_1983_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0208*-0" }, 66 { CS_JIS0208_1990_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0208*-0" },
67 { CS_JIS0212_1990_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0212*-0" }, 67 { CS_JIS0212_1990_0, "-*-mincho-*-r-*--*-*-*-*-c-*-jisx0212*-0" },
68#endif 68#endif
69 69
70#if ENCODING_CN || ENCODING_CN_EXT 70#if ENCODING_CN || ENCODING_CN_EXT
71# if XFT 71# if XFT
268 bool load (const rxvt_fontprop &prop) 268 bool load (const rxvt_fontprop &prop)
269 { 269 {
270 width = 1; height = 1; 270 width = 1; height = 1;
271 ascent = 1; descent = 0; 271 ascent = 1; descent = 0;
272 272
273 set_name ("built-in pseudofont");
274
273 return true; 275 return true;
274 } 276 }
275 277
276 bool has_codepoint (uint32_t unicode) 278 bool has_codepoint (unicode_t unicode)
277 { 279 {
278 if (unicode <= 0x001f) 280 if (unicode <= 0x001f)
279 return true; 281 return true;
280 282
281 if (unicode >= 0x0080 && unicode <= 0x009f) 283 if (unicode >= 0x0080 && unicode <= 0x009f)
311 313
312 XSetForeground (d.display->display, GC, r->PixColors[fg]); 314 XSetForeground (d.display->display, GC, r->PixColors[fg]);
313 315
314 while (len--) 316 while (len--)
315 { 317 {
318#if ENABLE_COMBINING
316 compose_char *cc; 319 compose_char *cc;
320#endif
317 text_t t = *text++; 321 text_t t = *text++;
318 322
319 // is it in our linedrawing table? 323 // is it in our linedrawing table?
320 if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) 324 if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500])
321 { 325 {
350 } 354 }
351 355
352 gcv.line_width = 0; 356 gcv.line_width = 0;
353 XChangeGC (d.display->display, GC, GCLineWidth, &gcv); 357 XChangeGC (d.display->display, GC, GCLineWidth, &gcv);
354 } 358 }
359#if ENABLE_COMBINING
355 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) 360 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t]))
356 { 361 {
362 rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)];
357 (*fs)[fs->find_font (cc->c1)]->draw (d, x, y, &(t = cc->c1), 1, fg, bg); 363 f1->draw (d, x, y, &(t = cc->c1), 1, fg, bg);
358 if (cc->c2 != NOCHAR) 364 if (cc->c2 != NOCHAR)
365 {
366 // prefer font of first character, for no good reasons
367 rxvt_font *f2 = f1->has_codepoint (cc->c2)
368 ? f1
369 : (*fs)[fs->find_font (cc->c2)];
370
359 (*fs)[fs->find_font (cc->c2)]->draw (d, x, y, &(t = cc->c2), 1, fg, -1); 371 f2->draw (d, x, y, &(t = cc->c2), 1, fg, -1);
360 } 372 }
373 }
374#endif
361 else 375 else
362 switch (t) 376 switch (t)
363 { 377 {
364 case ZERO_WIDTH_CHAR: 378 case ZERO_WIDTH_CHAR:
365 break; 379 break;
390 404
391 rxvt_fontprop properties (); 405 rxvt_fontprop properties ();
392 406
393 bool load (const rxvt_fontprop &prop); 407 bool load (const rxvt_fontprop &prop);
394 408
395 bool has_codepoint (uint32_t unicode); 409 bool has_codepoint (unicode_t unicode);
396 410
397 void draw (rxvt_drawable &d, int x, int y, 411 void draw (rxvt_drawable &d, int x, int y,
398 const text_t *text, int len, 412 const text_t *text, int len,
399 int fg, int bg); 413 int fg, int bg);
400 414
647 f = 0; 661 f = 0;
648 } 662 }
649} 663}
650 664
651bool 665bool
652rxvt_font_x11::has_codepoint (uint32_t unicode) 666rxvt_font_x11::has_codepoint (unicode_t unicode)
653{ 667{
654 uint32_t ch = FROM_UNICODE (cs, unicode); 668 uint32_t ch = FROM_UNICODE (cs, unicode);
655 669
656 if (ch == NOCHAR) 670 if (ch == NOCHAR)
657 return false; 671 return false;
799 813
800 void draw (rxvt_drawable &d, int x, int y, 814 void draw (rxvt_drawable &d, int x, int y,
801 const text_t *text, int len, 815 const text_t *text, int len,
802 int fg, int bg); 816 int fg, int bg);
803 817
804 bool has_codepoint (uint32_t unicode); 818 bool has_codepoint (unicode_t unicode);
805 819
806protected: 820protected:
807 XftFont *f; 821 XftFont *f;
808}; 822};
809 823
922 936
923 return true; 937 return true;
924} 938}
925 939
926bool 940bool
927rxvt_font_xft::has_codepoint (uint32_t unicode) 941rxvt_font_xft::has_codepoint (unicode_t unicode)
928{ 942{
929 return XftCharExists (DISPLAY, f, unicode); 943 return XftCharExists (DISPLAY, f, unicode);
930} 944}
931 945
932void 946void
1135 1149
1136 return true; 1150 return true;
1137} 1151}
1138 1152
1139int 1153int
1140rxvt_fontset::find_font (uint32_t unicode) 1154rxvt_fontset::find_font (unicode_t unicode)
1141{ 1155{
1142 for (unsigned int i = 0; i < fonts.size (); i++) 1156 for (unsigned int i = 0; i < fonts.size (); i++)
1143 { 1157 {
1144 rxvt_font *f = fonts[i]; 1158 rxvt_font *f = fonts[i];
1145 1159

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines