41 |
|
|
42 |
display = XOpenDisplay(NULL); |
display = XOpenDisplay(NULL); |
43 |
if (display == NULL) |
if (display == NULL) |
44 |
|
{ |
45 |
|
ERROR("Failed to open display\n"); |
46 |
return False; |
return False; |
47 |
|
} |
48 |
|
|
49 |
/* Check the screen supports 8-bit depth. */ |
/* Check the screen supports 8-bit depth. */ |
50 |
screen = DefaultScreenOfDisplay(display); |
screen = DefaultScreenOfDisplay(display); |
494 |
} |
} |
495 |
} |
} |
496 |
|
|
497 |
void ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, |
void ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y, |
498 |
int y, int boxx, int boxy, int boxcx, int boxcy, |
int clipx, int clipy, int clipcx, int clipcy, |
499 |
|
int boxx, int boxy, int boxcx, int boxcy, |
500 |
int bgcolour, int fgcolour, uint8 *text, uint8 length) |
int bgcolour, int fgcolour, uint8 *text, uint8 length) |
501 |
{ |
{ |
502 |
FONTGLYPH *glyph; |
FONTGLYPH *glyph; |
506 |
{ |
{ |
507 |
ui_rect(boxx, boxy, boxcx, boxcy, bgcolour); |
ui_rect(boxx, boxy, boxcx, boxcy, bgcolour); |
508 |
} |
} |
509 |
|
else if (mixmode == MIX_OPAQUE) |
510 |
|
{ |
511 |
|
ui_rect(clipx, clipy, clipcx, clipcy, bgcolour); |
512 |
|
} |
513 |
|
|
514 |
/* Paint text, character by character */ |
/* Paint text, character by character */ |
515 |
for (i = 0; i < length; i++) |
for (i = 0; i < length; i++) |
516 |
{ |
{ |
517 |
glyph = cache_get_font(font, text[i]); |
glyph = cache_get_font(font, text[i]); |
518 |
|
|
519 |
|
if (!(flags & TEXT2_IMPLICIT_X)) |
520 |
|
x += text[++i]; |
521 |
|
|
522 |
if (glyph != NULL) |
if (glyph != NULL) |
523 |
{ |
{ |
524 |
ui_draw_glyph(mixmode, x, |
ui_draw_glyph(mixmode, x + (short)glyph->offset, |
525 |
y + (short)glyph->baseline, |
y + (short)glyph->baseline, |
526 |
glyph->width, glyph->height, |
glyph->width, glyph->height, |
527 |
glyph->pixmap, 0, 0, |
glyph->pixmap, 0, 0, |
529 |
|
|
530 |
if (flags & TEXT2_IMPLICIT_X) |
if (flags & TEXT2_IMPLICIT_X) |
531 |
x += glyph->width; |
x += glyph->width; |
|
else |
|
|
x += text[++i]; |
|
532 |
} |
} |
533 |
} |
} |
534 |
} |
} |