Adding font2 patch as per request #3
This commit is contained in:
parent
188ec2fa1c
commit
9f1a2db7c5
9 changed files with 140 additions and 13 deletions
25
x.c
25
x.c
|
|
@ -254,8 +254,9 @@ typedef struct {
|
|||
} Fontcache;
|
||||
|
||||
/* Fontcache is an array now. A new font will be appended to the array. */
|
||||
static Fontcache frc[16];
|
||||
static Fontcache *frc = NULL;
|
||||
static int frclen = 0;
|
||||
static int frccap = 0;
|
||||
static char *usedfont = NULL;
|
||||
static double usedfontsize = 0;
|
||||
static double defaultfontsize = 0;
|
||||
|
|
@ -331,6 +332,9 @@ zoomabs(const Arg *arg)
|
|||
{
|
||||
xunloadfonts();
|
||||
xloadfonts(usedfont, arg->f);
|
||||
#if FONT2_PATCH
|
||||
xloadsparefonts();
|
||||
#endif // FONT2_PATCH
|
||||
cresize(0, 0);
|
||||
redraw();
|
||||
xhints();
|
||||
|
|
@ -861,7 +865,6 @@ xsetcolorname(int x, const char *name)
|
|||
if (!BETWEEN(x, 0, dc.collen))
|
||||
return 1;
|
||||
|
||||
|
||||
if (!xloadcolor(x, name, &ncolor))
|
||||
return 1;
|
||||
|
||||
|
|
@ -1163,6 +1166,11 @@ xinit(int cols, int rows)
|
|||
usedfont = (opt_font == NULL)? font : opt_font;
|
||||
xloadfonts(usedfont, 0);
|
||||
|
||||
#if FONT2_PATCH
|
||||
/* spare fonts */
|
||||
xloadsparefonts();
|
||||
#endif // FONT2_PATCH
|
||||
|
||||
/* colors */
|
||||
#if ALPHA_PATCH
|
||||
xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
|
||||
|
|
@ -1447,14 +1455,11 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
|
|||
fontpattern = FcFontSetMatch(0, fcsets, 1,
|
||||
fcpattern, &fcres);
|
||||
|
||||
/*
|
||||
* Overwrite or create the new cache entry.
|
||||
*/
|
||||
if (frclen >= LEN(frc)) {
|
||||
frclen = LEN(frc) - 1;
|
||||
XftFontClose(xw.dpy, frc[frclen].font);
|
||||
frc[frclen].unicodep = 0;
|
||||
}
|
||||
/* Allocate memory for the new cache entry. */
|
||||
if (frclen >= frccap) {
|
||||
frccap += 16;
|
||||
frc = xrealloc(frc, frccap * sizeof(Fontcache));
|
||||
}
|
||||
|
||||
frc[frclen].font = XftFontOpenPattern(xw.dpy,
|
||||
fontpattern);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue