edox: Deactivate use of XFontStruct (use XFontSet).
SVN revision: 33208
This commit is contained in:
parent
5b5b014b85
commit
ed03edf14f
|
@ -56,8 +56,6 @@
|
||||||
#define EAllocColor(pxc) \
|
#define EAllocColor(pxc) \
|
||||||
XAllocColor(disp, VRoot.cmap, pxc)
|
XAllocColor(disp, VRoot.cmap, pxc)
|
||||||
|
|
||||||
#define FILEPATH_LEN_MAX 4096
|
|
||||||
|
|
||||||
#ifndef MAX
|
#ifndef MAX
|
||||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,6 +64,8 @@
|
||||||
#define USE_WORD_MB
|
#define USE_WORD_MB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define USE_XFONT 0
|
||||||
|
|
||||||
typedef struct _efont Efont;
|
typedef struct _efont Efont;
|
||||||
|
|
||||||
typedef struct _root
|
typedef struct _root
|
||||||
|
@ -85,7 +85,9 @@ typedef struct _textstate
|
||||||
XColor bg_col;
|
XColor bg_col;
|
||||||
int effect;
|
int effect;
|
||||||
Efont *efont;
|
Efont *efont;
|
||||||
|
#if USE_XFONT
|
||||||
XFontStruct *xfont;
|
XFontStruct *xfont;
|
||||||
|
#endif
|
||||||
XFontSet xfontset;
|
XFontSet xfontset;
|
||||||
int xfontset_ascent;
|
int xfontset_ascent;
|
||||||
int height;
|
int height;
|
||||||
|
|
14
dox/format.c
14
dox/format.c
|
@ -569,15 +569,7 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
Imlib_Image im;
|
Imlib_Image im;
|
||||||
int wastext = 0;
|
int wastext = 0;
|
||||||
|
|
||||||
ts.fontname = NULL;
|
memset(&ts, 0, sizeof(ts));
|
||||||
ESetColor(&ts.fg_col, 0, 0, 0);
|
|
||||||
ESetColor(&ts.bg_col, 0, 0, 0);
|
|
||||||
ts.effect = 0;
|
|
||||||
ts.efont = NULL;
|
|
||||||
ts.xfont = NULL;
|
|
||||||
ts.xfontset = 0;
|
|
||||||
ts.xfontset_ascent = 0;
|
|
||||||
ts.height = 0;
|
|
||||||
pg = &(page[page_num]);
|
pg = &(page[page_num]);
|
||||||
x = pg->padding;
|
x = pg->padding;
|
||||||
y = pg->padding;
|
y = pg->padding;
|
||||||
|
@ -649,9 +641,11 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
if (ts.efont)
|
if (ts.efont)
|
||||||
Efont_free(ts.efont);
|
Efont_free(ts.efont);
|
||||||
ts.efont = NULL;
|
ts.efont = NULL;
|
||||||
|
#if USE_XFONT
|
||||||
if (ts.xfont)
|
if (ts.xfont)
|
||||||
XFreeFont(disp, ts.xfont);
|
XFreeFont(disp, ts.xfont);
|
||||||
ts.xfont = NULL;
|
ts.xfont = NULL;
|
||||||
|
#endif
|
||||||
if (ts.xfontset)
|
if (ts.xfontset)
|
||||||
XFreeFontSet(disp, ts.xfontset);
|
XFreeFontSet(disp, ts.xfontset);
|
||||||
ts.xfontset = NULL;
|
ts.xfontset = NULL;
|
||||||
|
@ -1040,8 +1034,10 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
|
|
||||||
if (ts.efont)
|
if (ts.efont)
|
||||||
Efont_free(ts.efont);
|
Efont_free(ts.efont);
|
||||||
|
#if USE_XFONT
|
||||||
if (ts.xfont)
|
if (ts.xfont)
|
||||||
XFreeFont(disp, ts.xfont);
|
XFreeFont(disp, ts.xfont);
|
||||||
|
#endif
|
||||||
if (ts.xfontset)
|
if (ts.xfontset)
|
||||||
XFreeFontSet(disp, ts.xfontset);
|
XFreeFontSet(disp, ts.xfontset);
|
||||||
|
|
||||||
|
|
78
dox/text.c
78
dox/text.c
|
@ -57,7 +57,11 @@ TextGetLines(const char *text, int *count)
|
||||||
void
|
void
|
||||||
TextStateLoadFont(TextState * ts)
|
TextStateLoadFont(TextState * ts)
|
||||||
{
|
{
|
||||||
|
#if USE_XFONT
|
||||||
if ((ts->efont) || (ts->xfont) || (ts->xfontset))
|
if ((ts->efont) || (ts->xfont) || (ts->xfontset))
|
||||||
|
#else
|
||||||
|
if ((ts->efont) || (ts->xfontset))
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!ts->fontname)
|
if (!ts->fontname)
|
||||||
|
@ -89,46 +93,48 @@ TextStateLoadFont(TextState * ts)
|
||||||
}
|
}
|
||||||
if (s2)
|
if (s2)
|
||||||
free(s2);
|
free(s2);
|
||||||
|
if (ts->efont)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ts->efont)
|
#if USE_XFONT
|
||||||
|
if ((!ts->xfont) && (strchr(ts->fontname, ',') == NULL))
|
||||||
{
|
{
|
||||||
if ((!ts->xfont) && (strchr(ts->fontname, ',') == NULL))
|
ts->xfont = XLoadQueryFont(disp, ts->fontname);
|
||||||
|
if (ts->xfont)
|
||||||
{
|
{
|
||||||
ts->xfont = XLoadQueryFont(disp, ts->fontname);
|
ts->xfontset_ascent = ts->xfont->ascent;
|
||||||
if (ts->xfont)
|
ts->height = ts->xfont->ascent + ts->xfont->descent;
|
||||||
{
|
return;
|
||||||
ts->xfontset_ascent = ts->xfont->ascent;
|
|
||||||
ts->height = ts->xfont->ascent + ts->xfont->descent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!ts->xfontset)
|
|
||||||
{
|
|
||||||
int i, missing_cnt, font_cnt;
|
|
||||||
int descent;
|
|
||||||
char **missing_list, *def_str, **fn;
|
|
||||||
XFontStruct **fs;
|
|
||||||
|
|
||||||
ts->xfontset = XCreateFontSet(disp, ts->fontname, &missing_list,
|
|
||||||
&missing_cnt, &def_str);
|
|
||||||
if (missing_cnt)
|
|
||||||
{
|
|
||||||
XFreeStringList(missing_list);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!ts->xfontset)
|
|
||||||
return;
|
|
||||||
font_cnt = XFontsOfFontSet(ts->xfontset, &fs, &fn);
|
|
||||||
ts->xfontset_ascent = 0;
|
|
||||||
for (i = 0; i < font_cnt; i++)
|
|
||||||
ts->xfontset_ascent = MAX(fs[i]->ascent, ts->xfontset_ascent);
|
|
||||||
descent = 0;
|
|
||||||
for (i = 0; i < font_cnt; i++)
|
|
||||||
descent = MAX(fs[i]->descent, descent);
|
|
||||||
ts->height = ts->xfontset_ascent + descent;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
#endif
|
||||||
|
|
||||||
|
if (!ts->xfontset)
|
||||||
|
{
|
||||||
|
int i, missing_cnt, font_cnt;
|
||||||
|
int descent;
|
||||||
|
char **missing_list, *def_str, **fn;
|
||||||
|
XFontStruct **fs;
|
||||||
|
|
||||||
|
ts->xfontset = XCreateFontSet(disp, ts->fontname, &missing_list,
|
||||||
|
&missing_cnt, &def_str);
|
||||||
|
if (missing_cnt)
|
||||||
|
{
|
||||||
|
XFreeStringList(missing_list);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!ts->xfontset)
|
||||||
|
return;
|
||||||
|
font_cnt = XFontsOfFontSet(ts->xfontset, &fs, &fn);
|
||||||
|
ts->xfontset_ascent = 0;
|
||||||
|
for (i = 0; i < font_cnt; i++)
|
||||||
|
ts->xfontset_ascent = MAX(fs[i]->ascent, ts->xfontset_ascent);
|
||||||
|
descent = 0;
|
||||||
|
for (i = 0; i < font_cnt; i++)
|
||||||
|
descent = MAX(fs[i]->descent, descent);
|
||||||
|
ts->height = ts->xfontset_ascent + descent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -175,6 +181,7 @@ TextSize(TextState * ts, const char *text, int *width, int *height, int fsize)
|
||||||
*width = ret2.width;
|
*width = ret2.width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if USE_XFONT
|
||||||
else if ((ts->xfont) && (ts->xfont->min_byte1 == 0) &&
|
else if ((ts->xfont) && (ts->xfont->min_byte1 == 0) &&
|
||||||
(ts->xfont->max_byte1 == 0))
|
(ts->xfont->max_byte1 == 0))
|
||||||
{
|
{
|
||||||
|
@ -201,6 +208,7 @@ TextSize(TextState * ts, const char *text, int *width, int *height, int fsize)
|
||||||
*width = wid;
|
*width = wid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* USE_XFONT */
|
||||||
freestrlist(lines, num_lines);
|
freestrlist(lines, num_lines);
|
||||||
return;
|
return;
|
||||||
fsize = 0;
|
fsize = 0;
|
||||||
|
@ -306,6 +314,7 @@ TextDraw(TextState * ts, Window win, char *text,
|
||||||
yy += ret2.height;
|
yy += ret2.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if USE_XFONT
|
||||||
else if ((ts->xfont) && (ts->xfont->min_byte1 == 0) &&
|
else if ((ts->xfont) && (ts->xfont->min_byte1 == 0) &&
|
||||||
(ts->xfont->max_byte1 == 0))
|
(ts->xfont->max_byte1 == 0))
|
||||||
{
|
{
|
||||||
|
@ -383,6 +392,7 @@ TextDraw(TextState * ts, Window win, char *text,
|
||||||
yy += ts->xfont->ascent + ts->xfont->descent;
|
yy += ts->xfont->ascent + ts->xfont->descent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* USE_XFONT */
|
||||||
freestrlist(lines, num_lines);
|
freestrlist(lines, num_lines);
|
||||||
return;
|
return;
|
||||||
h = fsize = 0;
|
h = fsize = 0;
|
||||||
|
|
Loading…
Reference in New Issue