… | |
… | |
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 (uint32_t unicode) |
277 | { |
279 | { |
278 | if (unicode <= 0x001f) |
280 | if (unicode <= 0x001f) |
279 | return true; |
281 | return true; |
|
|
282 | |
280 | if (unicode >= 0x0080 && unicode <= 0x009f) |
283 | if (unicode >= 0x0080 && unicode <= 0x009f) |
281 | return true; |
284 | return true; |
282 | |
285 | |
283 | if (unicode >= 0x2500 && unicode <= 0x257f |
286 | if (unicode >= 0x2500 && unicode <= 0x257f |
284 | && linedraw_cmds[unicode - 0x2500]) |
287 | && linedraw_cmds[unicode - 0x2500]) |
|
|
288 | return true; |
|
|
289 | |
|
|
290 | if (IS_COMPOSE (unicode)) |
285 | return true; |
291 | return true; |
286 | |
292 | |
287 | switch (unicode) |
293 | switch (unicode) |
288 | { |
294 | { |
289 | case ZERO_WIDTH_CHAR: |
295 | case ZERO_WIDTH_CHAR: |
… | |
… | |
307 | |
313 | |
308 | XSetForeground (d.display->display, GC, r->PixColors[fg]); |
314 | XSetForeground (d.display->display, GC, r->PixColors[fg]); |
309 | |
315 | |
310 | while (len--) |
316 | while (len--) |
311 | { |
317 | { |
|
|
318 | compose_char *cc; |
312 | text_t t = *text++; |
319 | text_t t = *text++; |
313 | |
320 | |
314 | // is it in our linedrawing table? |
321 | // is it in our linedrawing table? |
315 | if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) |
322 | if (t >= 0x2500 & t <= 0x2580 && linedraw_cmds[t - 0x2500]) |
316 | { |
323 | { |
317 | const char *p = linedraw_cmds[t - 0x2500]; |
324 | const char *p = linedraw_cmds[t - 0x2500]; |
318 | |
325 | |
319 | int x0 = x, x1 = x + r->TermWin.fwidth / 2, x2 = x + r->TermWin.fwidth - 1; |
326 | int x0 = x, x1 = x + (r->TermWin.fwidth - 1) / 2, x2 = x + r->TermWin.fwidth - 1; |
320 | int y0 = y, y1 = y + r->TermWin.fheight / 2, y2 = y + r->TermWin.fheight - 1; |
327 | int y0 = y, y1 = y + (r->TermWin.fheight - 1) / 2, y2 = y + r->TermWin.fheight - 1; |
321 | |
328 | |
322 | XGCValues gcv; |
329 | XGCValues gcv; |
323 | |
330 | |
324 | while (*p) |
331 | while (*p) |
325 | { |
332 | { |
… | |
… | |
344 | } |
351 | } |
345 | } |
352 | } |
346 | |
353 | |
347 | gcv.line_width = 0; |
354 | gcv.line_width = 0; |
348 | XChangeGC (d.display->display, GC, GCLineWidth, &gcv); |
355 | XChangeGC (d.display->display, GC, GCLineWidth, &gcv); |
|
|
356 | } |
|
|
357 | else if (IS_COMPOSE (t) && (cc = rxvt_composite[t])) |
|
|
358 | { |
|
|
359 | rxvt_font *f1 = (*fs)[fs->find_font (cc->c1)]; |
|
|
360 | f1->draw (d, x, y, &(t = cc->c1), 1, fg, bg); |
|
|
361 | if (cc->c2 != NOCHAR) |
|
|
362 | { |
|
|
363 | // prefer font of first character, for no good reasons |
|
|
364 | rxvt_font *f2 = f1->has_codepoint (cc->c2) |
|
|
365 | ? f1 |
|
|
366 | : (*fs)[fs->find_font (cc->c2)]; |
|
|
367 | |
|
|
368 | f2->draw (d, x, y, &(t = cc->c2), 1, fg, -1); |
|
|
369 | } |
349 | } |
370 | } |
350 | else |
371 | else |
351 | switch (t) |
372 | switch (t) |
352 | { |
373 | { |
353 | case ZERO_WIDTH_CHAR: |
374 | case ZERO_WIDTH_CHAR: |
… | |
… | |
1017 | f = new rxvt_font_x11; |
1038 | f = new rxvt_font_x11; |
1018 | } |
1039 | } |
1019 | else |
1040 | else |
1020 | f = new rxvt_font_x11; |
1041 | f = new rxvt_font_x11; |
1021 | |
1042 | |
|
|
1043 | f->fs = this; |
1022 | f->set_term (r); |
1044 | f->set_term (r); |
1023 | f->set_name (strdup (name)); |
1045 | f->set_name (strdup (name)); |
1024 | |
1046 | |
1025 | f->cs = cs; |
1047 | f->cs = cs; |
1026 | f->loaded = false; |
1048 | f->loaded = false; |