- if(charpos)
- charpos[0] = 0;
- if(!length)
- return;
-
- color.red = (top_level->current_color & 0xff0000) >> 16;
- color.red |= color.red << 8;
- color.green = (top_level->current_color & 0xff00) >> 8;
- color.green |= color.green << 8;
- color.blue = (top_level->current_color & 0xff);
- color.blue |= color.blue << 8;
- color.alpha = 0xffff;
-
- XftColorAllocValue(top_level->display,
- top_level->vis,
- top_level->cmap,
- &color,
- &xft_color);
-
- basefont = top_level->get_xft_struct(top_level->current_font);
-
- curfont = nextfont = basefont;
- altfont = 0;
- cp = 0;
- ubp = text;
-
- for(up = text; up < &text[length]; up++)
- {
- if(XftCharExists(top_level->display, basefont, *up))
- nextfont = basefont;
- else if(altfont && XftCharExists(top_level->display, altfont, *up))
- nextfont = altfont;
- else
- {
- if(altfont)
- XftFontClose(top_level->display, altfont);
-
- if( (newpat = BC_Resources::find_similar_font(*up, basefont->pattern)) != 0 ) {
- double psize;
-
- FcPatternGetDouble(basefont->pattern, FC_PIXEL_SIZE,
- 0, &psize);
- FcPatternAddDouble(newpat, FC_PIXEL_SIZE, psize);
- FcPatternDel(newpat, FC_SCALABLE);
- altfont = XftFontOpenPattern(top_level->display,
- newpat);
- if(altfont)
- nextfont = altfont;
- }
- else
- {
+#ifdef HAVE_XFT
+ XftColor xft_color;
+ if( draw ) {
+ XRenderColor color;
+ color.red = (top_level->current_color & 0xff0000) >> 16;
+ color.red |= color.red << 8;
+ color.green = (top_level->current_color & 0xff00) >> 8;
+ color.green |= color.green << 8;
+ color.blue = (top_level->current_color & 0xff);
+ color.blue |= color.blue << 8;
+ color.alpha = 0xffff;
+
+ xftColorAllocValue(top_level->display, top_level->vis, top_level->cmap,
+ &color, &xft_color);
+ }
+
+ int x0 = x;
+ XftFont *basefont = top_level->get_xft_struct(font);
+ XftFont *curfont = 0, *altfont = 0;
+ const wchar_t *up = text, *ubp = up, *uep = ubp + length;
+
+ while( up < uep ) {
+ XftFont *xft_font = 0;
+ if( xftCharExists(top_level->display, basefont, *up) )
+ xft_font = basefont;
+ else if( altfont ) {
+ if( xftCharExists(top_level->display, altfont, *up))
+ xft_font = altfont;
+ else {
+ xftFontClose(top_level->display, altfont);