… | |
… | |
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, "-*-*-*-*-*-*-*-*-*-*-c-*-big5-0" }, |
|
|
78 | { CS_BIG5_PLUS, "-*-*-*-*-*-*-*-*-*-*-c-*-big5p-0" }, |
|
|
79 | { CS_BIG5_EXT, "-*-*-*-*-*-*-*-*-*-*-c-*-big5.eten-0" }, |
77 | { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" }, |
80 | { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-gb2312*-0" }, |
78 | { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" }, |
81 | { CS_CNS11643_1992_1, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-1" }, |
79 | { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" }, |
82 | { CS_CNS11643_1992_2, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-2" }, |
80 | { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" }, |
83 | { CS_CNS11643_1992_3, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-3" }, |
81 | { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" }, |
84 | { CS_CNS11643_1992_4, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-4" }, |
82 | { CS_CNS11643_1992_5, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-5" }, |
85 | { CS_CNS11643_1992_5, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-5" }, |
83 | { CS_CNS11643_1992_6, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-6" }, |
86 | { CS_CNS11643_1992_6, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-6" }, |
84 | { CS_CNS11643_1992_7, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-7" }, |
87 | { CS_CNS11643_1992_7, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-7" }, |
85 | { CS_CNS11643_1992_F, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-f" }, |
88 | { CS_CNS11643_1992_F, "-*-*-*-*-*-*-*-*-*-*-c-*-cns11643*-f" }, |
86 | #endif |
89 | #endif |
87 | |
90 | |
88 | #if XFT |
91 | #if XFT |
89 | { CS_UNICODE, "xft:Andale Mono" }, |
92 | { CS_UNICODE, "xft:Andale Mono" }, |
90 | { CS_UNICODE, "xft:Arial Unicode MS" }, |
93 | { CS_UNICODE, "xft:Arial Unicode MS" }, |
… | |
… | |
93 | { CS_UNICODE, "xft:FreeMono" }, |
96 | { CS_UNICODE, "xft:FreeMono" }, |
94 | { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, |
97 | { CS_UNICODE, "-*-unifont-*-*-*-*-*-*-*-*-c-*-iso10646-1" }, |
95 | { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, |
98 | { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1" }, |
96 | { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, |
99 | { CS_UNICODE, "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1" }, |
97 | |
100 | |
|
|
101 | #if UNICODE_3 && XFT |
|
|
102 | { CS_UNICODE, "xft:Code2001" }, // contains many plane-1 characters |
|
|
103 | #endif |
|
|
104 | |
98 | { CS_UNKNOWN, 0 } |
105 | { CS_UNKNOWN, 0 } |
99 | }; |
106 | }; |
100 | |
107 | |
101 | ///////////////////////////////////////////////////////////////////////////// |
108 | ///////////////////////////////////////////////////////////////////////////// |
102 | |
109 | |
… | |
… | |
268 | |
275 | |
269 | bool has_codepoint (uint32_t unicode) |
276 | bool has_codepoint (uint32_t unicode) |
270 | { |
277 | { |
271 | if (unicode <= 0x001f) |
278 | if (unicode <= 0x001f) |
272 | return true; |
279 | return true; |
|
|
280 | |
273 | if (unicode >= 0x0080 && unicode <= 0x009f) |
281 | if (unicode >= 0x0080 && unicode <= 0x009f) |
274 | return true; |
282 | return true; |
275 | |
283 | |
276 | if (unicode >= 0x2500 && unicode <= 0x257f |
284 | if (unicode >= 0x2500 && unicode <= 0x257f |
277 | && linedraw_cmds[unicode - 0x2500]) |
285 | && linedraw_cmds[unicode - 0x2500]) |
|
|
286 | return true; |
|
|
287 | |
|
|
288 | if (IS_COMPOSE (unicode)) |
278 | return true; |
289 | return true; |
279 | |
290 | |
280 | switch (unicode) |
291 | switch (unicode) |
281 | { |
292 | { |
282 | case ZERO_WIDTH_CHAR: |
293 | case ZERO_WIDTH_CHAR: |
… | |
… | |
300 | |
311 | |
301 | XSetForeground (d.display->display, GC, r->PixColors[fg]); |
312 | XSetForeground (d.display->display, GC, r->PixColors[fg]); |
302 | |
313 | |
303 | while (len--) |
314 | while (len--) |
304 | { |
315 | { |
|
|
316 | compose_char *cc; |
305 | text_t t = *text++; |
317 | text_t t = *text++; |
306 | |
318 | |
|
|
319 | // is it in our linedrawing table? |
307 | if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) |
320 | if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) |
308 | { |
321 | { |
309 | const char *p = linedraw_cmds[t - 0x2500]; |
322 | const char *p = linedraw_cmds[t - 0x2500]; |
310 | |
323 | |
311 | 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; |
312 | 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; |
313 | |
326 | |
314 | XGCValues gcv; |
327 | XGCValues gcv; |
315 | |
328 | |
316 | while (*p) |
329 | while (*p) |
317 | { |
330 | { |
… | |
… | |
337 | } |
350 | } |
338 | |
351 | |
339 | gcv.line_width = 0; |
352 | gcv.line_width = 0; |
340 | XChangeGC (d.display->display, GC, GCLineWidth, &gcv); |
353 | XChangeGC (d.display->display, GC, GCLineWidth, &gcv); |
341 | } |
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 | } |
|
|
368 | } |
342 | else |
369 | else |
343 | switch (*text++) |
370 | switch (t) |
344 | { |
371 | { |
345 | case NOCHAR: |
|
|
346 | case ZERO_WIDTH_CHAR: |
372 | case ZERO_WIDTH_CHAR: |
347 | break; |
373 | break; |
348 | default: |
374 | default: |
349 | XDrawRectangle (d.display->display, d, GC, x + 2, y + 2, r->TermWin.fwidth - 5, r->TermWin.fheight - 5); |
375 | int w = 0; |
|
|
376 | while (len > 0 && *text == NOCHAR) |
|
|
377 | { |
|
|
378 | ++text; |
|
|
379 | --len; |
|
|
380 | w += r->TermWin.fwidth; |
|
|
381 | } |
|
|
382 | |
|
|
383 | XDrawRectangle (d.display->display, d, GC, x + 2, y + 2, |
|
|
384 | w + r->TermWin.fwidth - 5, r->TermWin.fheight - 5); |
|
|
385 | x += w; |
350 | } |
386 | } |
351 | |
387 | |
352 | x += r->TermWin.fwidth; |
388 | x += r->TermWin.fwidth; |
353 | } |
389 | } |
354 | } |
390 | } |
… | |
… | |
429 | |
465 | |
430 | bool |
466 | bool |
431 | rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name) |
467 | rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name) |
432 | { |
468 | { |
433 | int slashes = 0; |
469 | int slashes = 0; |
434 | const char *comp[12]; |
470 | const char *comp[13]; |
435 | |
471 | |
436 | for (const char *c = name; *c; c++) |
472 | for (const char *c = name; *c; c++) |
437 | if (*c == '-') |
473 | if (*c == '-') |
438 | { |
474 | { |
439 | comp[slashes++] = c + 1; |
475 | comp[slashes++] = c + 1; |
… | |
… | |
1000 | f = new rxvt_font_x11; |
1036 | f = new rxvt_font_x11; |
1001 | } |
1037 | } |
1002 | else |
1038 | else |
1003 | f = new rxvt_font_x11; |
1039 | f = new rxvt_font_x11; |
1004 | |
1040 | |
|
|
1041 | f->fs = this; |
1005 | f->set_term (r); |
1042 | f->set_term (r); |
1006 | f->set_name (strdup (name)); |
1043 | f->set_name (strdup (name)); |
1007 | |
1044 | |
1008 | f->cs = cs; |
1045 | f->cs = cs; |
1009 | f->loaded = false; |
1046 | f->loaded = false; |