}
}
-void BC_WindowBase::draw_xft_text(int x, int y,
+void BC_WindowBase::draw_xft_text(int x, int y,
const char *text, int length, BC_Pixmap *pixmap, int is_utf8)
{
int l = length + 1;
}
}
-int BC_WindowBase::wcharpos(const wchar_t *text, XftFont *font, int length,
- int *charpos)
-{
- XGlyphInfo extents;
-
- if(charpos)
- {
- int bpos = charpos[-1];
-
- for(int i = 0; i < length; i++)
- {
- XftTextExtents32(top_level->display,
- font,
- (const FcChar32*)text,
- i + 1,
- &extents);
- charpos[i] = extents.xOff + bpos;
- }
- return charpos[length - 1] - bpos;
- }
- else
- {
- XftTextExtents32(top_level->display,
- font,
- (const FcChar32*)text,
- length,
- &extents);
- return extents.xOff;
- }
-}
-
void BC_WindowBase::xft_draw_string(XftColor *xft_color, XftFont *xft_font,
int x, int y, const FcChar32 *fc, int len, BC_Pixmap *pixmap)
{
}
void BC_WindowBase::draw_wtext(int x, int y,
- const wchar_t *text, int length, BC_Pixmap *pixmap, int *charpos)
+ const wchar_t *text, int length, BC_Pixmap *pixmap)
{
if( !get_resources()->use_xft ) {
if( !get_font_struct(current_font) ) return;
XRenderColor color;
XftColor xft_color;
const wchar_t *up, *ubp;
- int l, *cp;
+ int l;
FcPattern *newpat;
XftFont *curfont, *nextfont, *altfont, *basefont;
if(length < 0)
length = wcslen(text);
- if(charpos)
- charpos[0] = 0;
if(!length)
return;
curfont = nextfont = basefont;
altfont = 0;
- cp = 0;
ubp = text;
for(up = text; up < &text[length]; up++)
xft_draw_string(&xft_color, curfont, x, y,
(const FcChar32*)ubp, l, pixmap);
- if(charpos)
- cp = &charpos[ubp - text + 1];
+ XGlyphInfo extents;
+ XftTextExtents32(top_level->display, curfont,
+ (const FcChar32*)ubp, l, &extents);
+ x += extents.xOff;
- x += wcharpos(ubp, curfont, l, cp);
ubp = up;
curfont = nextfont;
}
{
xft_draw_string(&xft_color, curfont, x, y,
(const FcChar32*)ubp, up - ubp, pixmap);
- if(charpos)
- wcharpos(ubp, curfont, up - ubp, &charpos[ubp - text + 1]);
}
if(altfont)
pixmap);
}
-void BC_WindowBase::draw_tooltip()
+void BC_WindowBase::draw_tooltip(const char *text)
{
- if(tooltip_popup && tooltip_text)
+ if( !text )
+ text = tooltip_text;
+ if(tooltip_popup && text)
{
int w = tooltip_popup->get_w(), h = tooltip_popup->get_h();
tooltip_popup->set_color(get_resources()->tooltip_bg_color);
tooltip_popup->set_font(MEDIUMFONT);
tooltip_popup->draw_text(TOOLTIP_MARGIN,
get_text_ascent(MEDIUMFONT) + TOOLTIP_MARGIN,
- tooltip_text);
+ text);
}
}