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.27 by pcg, Wed Mar 3 00:20:33 2004 UTC vs.
Revision 1.37 by pcg, Fri Mar 5 05:52:02 2004 UTC

72 { CS_BIG5_EXT, "xft:AR PL Mingti2L Big5" }, 72 { CS_BIG5_EXT, "xft:AR PL Mingti2L Big5" },
73 { CS_BIG5_EXT, "xft:AR PL KaitiM Big5" }, 73 { CS_BIG5_EXT, "xft:AR PL KaitiM Big5" },
74 { CS_GB2312_1980_0, "xft:AR PL KaitiM GB" }, 74 { CS_GB2312_1980_0, "xft:AR PL KaitiM GB" },
75 { CS_GB2312_1980_0, "xft:AR PL SungtiL GB" }, 75 { CS_GB2312_1980_0, "xft:AR PL SungtiL GB" },
76# endif 76# endif
77 { CS_BIG5_EXT, "-*-*-*-*-*-*-*-*-*-*-c-*-big5*-0" }, 77 { CS_BIG5, "-*-*-*-*-*-*-*-*-*-*-c-*-big5-0" },
78 { CS_BIG5_PLUS, "-*-*-*-*-*-*-*-*-*-*-c-*-big5p-0" },
79 { CS_BIG5_EXT, "-*-*-*-*-*-*-*-*-*-*-c-*-big5.eten-0" },
78 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" }, 80 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" },
79 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" }, 81 { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" },
80 { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" }, 82 { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" },
81 { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" }, 83 { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" },
82 { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" }, 84 { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" },
94 { CS_UNICODE, "xft:FreeMono" }, 96 { CS_UNICODE, "xft:FreeMono" },
95 { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, 97 { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" },
96 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, 98 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" },
97 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, 99 { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" },
98 100
101#if UNICODE_3 && XFT
102 { CS_UNICODE, "xft:Code2001" }, // contains many plane-1 characters
103#endif
104
99 { CS_UNKNOWN, 0 } 105 { CS_UNKNOWN, 0 }
100}; 106};
101 107
102///////////////////////////////////////////////////////////////////////////// 108/////////////////////////////////////////////////////////////////////////////
103 109
269 275
270 bool has_codepoint (uint32_t unicode) 276 bool has_codepoint (uint32_t unicode)
271 { 277 {
272 if (unicode <= 0x001f) 278 if (unicode <= 0x001f)
273 return true; 279 return true;
280
274 if (unicode >= 0x0080 && unicode <= 0x009f) 281 if (unicode >= 0x0080 && unicode <= 0x009f)
275 return true; 282 return true;
276 283
277 if (unicode >= 0x2500 && unicode <= 0x257f 284 if (unicode >= 0x2500 && unicode <= 0x257f
278 && linedraw_cmds[unicode - 0x2500]) 285 && linedraw_cmds[unicode - 0x2500])
286 return true;
287
288 if (IS_COMPOSE (unicode))
279 return true; 289 return true;
280 290
281 switch (unicode) 291 switch (unicode)
282 { 292 {
283 case ZERO_WIDTH_CHAR: 293 case ZERO_WIDTH_CHAR:
301 311
302 XSetForeground (d.display->display, GC, r->PixColors[fg]); 312 XSetForeground (d.display->display, GC, r->PixColors[fg]);
303 313
304 while (len--) 314 while (len--)
305 { 315 {
316 compose_char *cc;
306 text_t t = *text++; 317 text_t t = *text++;
307 318
308 // is it in our linedrawing table? 319 // is it in our linedrawing table?
309 if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) 320 if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500])
310 { 321 {
311 const char *p = linedraw_cmds[t - 0x2500]; 322 const char *p = linedraw_cmds[t - 0x2500];
312 323
313 int x0 = x, x1 = x + r->TermWin.fwidth / 2, x2 = x + r->TermWin.fwidth - 1; 324 int x0 = x, x1 = x + (r->TermWin.fwidth - 1) / 2, x2 = x + r->TermWin.fwidth - 1;
314 int y0 = y, y1 = y + r->TermWin.fheight / 2, y2 = y + r->TermWin.fheight - 1; 325 int y0 = y, y1 = y + (r->TermWin.fheight - 1) / 2, y2 = y + r->TermWin.fheight - 1;
315 326
316 XGCValues gcv; 327 XGCValues gcv;
317 328
318 while (*p) 329 while (*p)
319 { 330 {
338 } 349 }
339 } 350 }
340 351
341 gcv.line_width = 0; 352 gcv.line_width = 0;
342 XChangeGC (d.display->display, GC, GCLineWidth, &gcv); 353 XChangeGC (d.display->display, GC, GCLineWidth, &gcv);
354 }
355 else if (IS_COMPOSE (t) && (cc = rxvt_composite[t]))
356 {
357 rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)];
358 f1->draw (d, x, y, &(t = cc->c1), 1, fg, bg);
359 if (cc->c2 != NOCHAR)
360 {
361 // prefer font of first character, for no good reasons
362 rxvt_font *f2 = f1->has_codepoint (cc->c2)
363 ? f1
364 : (*fs)[fs->find_font (cc->c2)];
365
366 f2->draw (d, x, y, &(t = cc->c2), 1, fg, -1);
367 }
343 } 368 }
344 else 369 else
345 switch (t) 370 switch (t)
346 { 371 {
347 case ZERO_WIDTH_CHAR: 372 case ZERO_WIDTH_CHAR:
440 465
441bool 466bool
442rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name) 467rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name)
443{ 468{
444 int slashes = 0; 469 int slashes = 0;
445 const char *comp[12]; 470 const char *comp[13];
446 471
447 for (const char *c = name; *c; c++) 472 for (const char *c = name; *c; c++)
448 if (*c == '-') 473 if (*c == '-')
449 { 474 {
450 comp[slashes++] = c + 1; 475 comp[slashes++] = c + 1;
1011 f = new rxvt_font_x11; 1036 f = new rxvt_font_x11;
1012 } 1037 }
1013 else 1038 else
1014 f = new rxvt_font_x11; 1039 f = new rxvt_font_x11;
1015 1040
1041 f->fs = this;
1016 f->set_term (r); 1042 f->set_term (r);
1017 f->set_name (strdup (name)); 1043 f->set_name (strdup (name));
1018 1044
1019 f->cs = cs; 1045 f->cs = cs;
1020 f->loaded = false; 1046 f->loaded = false;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines