… | |
… | |
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 | |
|
|
110 | #if XFT |
103 | rxvt_drawable::~rxvt_drawable () |
111 | rxvt_drawable::~rxvt_drawable () |
104 | { |
112 | { |
105 | if (xftdrawable) |
113 | if (xftdrawable) |
106 | XftDrawDestroy (xftdrawable); |
114 | XftDrawDestroy (xftdrawable); |
107 | } |
115 | } |
… | |
… | |
111 | if (!xftdrawable) |
119 | if (!xftdrawable) |
112 | xftdrawable = XftDrawCreate (display->display, drawable, display->visual, display->cmap); |
120 | xftdrawable = XftDrawCreate (display->display, drawable, display->visual, display->cmap); |
113 | |
121 | |
114 | return xftdrawable; |
122 | return xftdrawable; |
115 | } |
123 | } |
|
|
124 | #endif |
116 | |
125 | |
117 | ///////////////////////////////////////////////////////////////////////////// |
126 | ///////////////////////////////////////////////////////////////////////////// |
118 | |
127 | |
119 | static void *enc_buf; |
128 | static void *enc_buf; |
120 | static uint32_t enc_len; |
129 | static uint32_t enc_len; |
… | |
… | |
266 | |
275 | |
267 | bool has_codepoint (uint32_t unicode) |
276 | bool has_codepoint (uint32_t unicode) |
268 | { |
277 | { |
269 | if (unicode <= 0x001f) |
278 | if (unicode <= 0x001f) |
270 | return true; |
279 | return true; |
|
|
280 | |
271 | if (unicode >= 0x0080 && unicode <= 0x009f) |
281 | if (unicode >= 0x0080 && unicode <= 0x009f) |
272 | return true; |
282 | return true; |
273 | |
283 | |
274 | if (unicode >= 0x2500 && unicode <= 0x257f |
284 | if (unicode >= 0x2500 && unicode <= 0x257f |
275 | && linedraw_cmds[unicode - 0x2500]) |
285 | && linedraw_cmds[unicode - 0x2500]) |
|
|
286 | return true; |
|
|
287 | |
|
|
288 | if (IS_COMPOSE (unicode)) |
276 | return true; |
289 | return true; |
277 | |
290 | |
278 | switch (unicode) |
291 | switch (unicode) |
279 | { |
292 | { |
280 | case ZERO_WIDTH_CHAR: |
293 | case ZERO_WIDTH_CHAR: |
… | |
… | |
298 | |
311 | |
299 | XSetForeground (d.display->display, GC, r->PixColors[fg]); |
312 | XSetForeground (d.display->display, GC, r->PixColors[fg]); |
300 | |
313 | |
301 | while (len--) |
314 | while (len--) |
302 | { |
315 | { |
|
|
316 | compose_char *cc; |
303 | text_t t = *text++; |
317 | text_t t = *text++; |
304 | |
318 | |
|
|
319 | // is it in our linedrawing table? |
305 | if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) |
320 | if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) |
306 | { |
321 | { |
307 | const char *p = linedraw_cmds[t - 0x2500]; |
322 | const char *p = linedraw_cmds[t - 0x2500]; |
308 | |
323 | |
309 | 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; |
310 | 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; |
311 | |
326 | |
312 | XGCValues gcv; |
327 | XGCValues gcv; |
313 | |
328 | |
314 | while (*p) |
329 | while (*p) |
315 | { |
330 | { |
… | |
… | |
335 | } |
350 | } |
336 | |
351 | |
337 | gcv.line_width = 0; |
352 | gcv.line_width = 0; |
338 | XChangeGC (d.display->display, GC, GCLineWidth, &gcv); |
353 | XChangeGC (d.display->display, GC, GCLineWidth, &gcv); |
339 | } |
354 | } |
|
|
355 | else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) |
|
|
356 | { |
|
|
357 | (*fs)[fs->find_font (cc->c1)]->draw (d, x, y, &(t = cc->c1), 1, fg, bg); |
|
|
358 | if (cc->c2 != NOCHAR) |
|
|
359 | (*fs)[fs->find_font (cc->c2)]->draw (d, x, y, &(t = cc->c2), 1, fg, -1); |
|
|
360 | } |
340 | else |
361 | else |
341 | switch (*text++) |
362 | switch (t) |
342 | { |
363 | { |
343 | case NOCHAR: |
|
|
344 | case ZERO_WIDTH_CHAR: |
364 | case ZERO_WIDTH_CHAR: |
345 | break; |
365 | break; |
346 | default: |
366 | default: |
347 | XDrawRectangle (d.display->display, d, GC, x + 2, y + 2, r->TermWin.fwidth - 5, r->TermWin.fheight - 5); |
367 | int w = 0; |
|
|
368 | while (len > 0 && *text == NOCHAR) |
|
|
369 | { |
|
|
370 | ++text; |
|
|
371 | --len; |
|
|
372 | w += r->TermWin.fwidth; |
|
|
373 | } |
|
|
374 | |
|
|
375 | XDrawRectangle (d.display->display, d, GC, x + 2, y + 2, |
|
|
376 | w + r->TermWin.fwidth - 5, r->TermWin.fheight - 5); |
|
|
377 | x += w; |
348 | } |
378 | } |
349 | |
379 | |
350 | x += r->TermWin.fwidth; |
380 | x += r->TermWin.fwidth; |
351 | } |
381 | } |
352 | } |
382 | } |
… | |
… | |
427 | |
457 | |
428 | bool |
458 | bool |
429 | rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name) |
459 | rxvt_font_x11::set_properties (rxvt_fontprop &p, const char *name) |
430 | { |
460 | { |
431 | int slashes = 0; |
461 | int slashes = 0; |
432 | const char *comp[12]; |
462 | const char *comp[13]; |
433 | |
463 | |
434 | for (const char *c = name; *c; c++) |
464 | for (const char *c = name; *c; c++) |
435 | if (*c == '-') |
465 | if (*c == '-') |
436 | { |
466 | { |
437 | comp[slashes++] = c + 1; |
467 | comp[slashes++] = c + 1; |
… | |
… | |
998 | f = new rxvt_font_x11; |
1028 | f = new rxvt_font_x11; |
999 | } |
1029 | } |
1000 | else |
1030 | else |
1001 | f = new rxvt_font_x11; |
1031 | f = new rxvt_font_x11; |
1002 | |
1032 | |
|
|
1033 | f->fs = this; |
1003 | f->set_term (r); |
1034 | f->set_term (r); |
1004 | f->set_name (strdup (name)); |
1035 | f->set_name (strdup (name)); |
1005 | |
1036 | |
1006 | f->cs = cs; |
1037 | f->cs = cs; |
1007 | f->loaded = false; |
1038 | f->loaded = false; |