#include <X11/cursorfont.h>
#include <X11/Xft/Xft.h>
-#define Glyph Glyph_
-#define Font Font_
-
#include "st.h"
#include "win.h"
static char *base64dec(const char *);
static ssize_t xwrite(int, const char *, size_t);
-static void *xrealloc(void *, size_t);
/* Globals */
TermWindow win;
static STREscape strescseq;
static int iofd = 1;
-char *usedfont = NULL;
-double usedfontsize = 0;
-double defaultfontsize = 0;
-
static uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0};
static uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
static Rune utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000};
free(term.alt[i]);
}
- /* resize to new width */
- term.specbuf = xrealloc(term.specbuf, col * sizeof(GlyphFontSpec));
-
/* resize to new height */
term.line = xrealloc(term.line, row * sizeof(Line));
term.alt = xrealloc(term.alt, row * sizeof(Line));
typedef uint_least32_t Rune;
+#define Glyph Glyph_
typedef struct {
Rune u; /* character code */
ushort mode; /* attribute flags */
} Glyph;
typedef Glyph *Line;
-typedef XftGlyphFontSpec GlyphFontSpec;
typedef struct {
Glyph attr; /* current char attributes */
Line *line; /* screen */
Line *alt; /* alternate screen */
int *dirty; /* dirtyness of lines */
- GlyphFontSpec *specbuf; /* font spec buffer used for rendering */
TCursor c; /* cursor */
int top; /* top scroll limit */
int bot; /* bottom scroll limit */
size_t utf8encode(Rune, char *);
void *xmalloc(size_t);
+void *xrealloc(void *, size_t);
char *xstrdup(char *);
/* Globals */
extern char *opt_title;
extern int oldbutton;
-extern char *usedfont;
-extern double usedfontsize;
-extern double defaultfontsize;
-
/* config.h globals */
extern char font[];
extern int borderpx;
static char *argv0;
#include "arg.h"
-
-#define Glyph Glyph_
-#define Font Font_
-
#include "st.h"
#include "win.h"
typedef XftDraw *Draw;
typedef XftColor Color;
+typedef XftGlyphFontSpec GlyphFontSpec;
/* Purely graphic info */
typedef struct {
Colormap cmap;
Window win;
Drawable buf;
+ GlyphFontSpec *specbuf; /* font spec buffer used for rendering */
Atom xembed, wmdeletewin, netwmname, netwmpid;
XIM xim;
XIC xic;
} XSelection;
/* Font structure */
+#define Font Font_
typedef struct {
int height;
int width;
/* Fontcache is an array now. A new font will be appended to the array. */
static Fontcache frc[16];
static int frclen = 0;
+static char *usedfont = NULL;
+static double usedfontsize = 0;
+static double defaultfontsize = 0;
void
zoom(const Arg *arg)
DefaultDepth(xw.dpy, xw.scr));
XftDrawChange(xw.draw, xw.buf);
xclear(0, 0, win.w, win.h);
+
+ /* resize to new width */
+ xw.specbuf = xrealloc(xw.specbuf, col * sizeof(GlyphFontSpec));
}
ushort
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
+ /* font spec buffer */
+ xw.specbuf = xmalloc(term.col * sizeof(GlyphFontSpec));
+
/* Xft rendering context */
xw.draw = XftDrawCreate(xw.dpy, xw.buf, xw.vis, xw.cmap);
term.dirty[y] = 0;
- specs = term.specbuf;
+ specs = xw.specbuf;
numspecs = xmakeglyphfontspecs(specs, &term.line[y][x1], x2 - x1, x1, y);
i = ox = 0;