|
|
@ -742,9 +742,9 @@ xloadcols(void) |
|
|
|
for (i = 0; i < dc.collen; i++) |
|
|
|
for (i = 0; i < dc.collen; i++) |
|
|
|
if (!xloadcolor(i, NULL, &dc.col[i])) { |
|
|
|
if (!xloadcolor(i, NULL, &dc.col[i])) { |
|
|
|
if (colorname[i]) |
|
|
|
if (colorname[i]) |
|
|
|
die("Could not allocate color '%s'\n", colorname[i]); |
|
|
|
die("could not allocate color '%s'\n", colorname[i]); |
|
|
|
else |
|
|
|
else |
|
|
|
die("Could not allocate color %d\n", i); |
|
|
|
die("could not allocate color %d\n", i); |
|
|
|
} |
|
|
|
} |
|
|
|
loaded = 1; |
|
|
|
loaded = 1; |
|
|
|
} |
|
|
|
} |
|
|
@ -869,7 +869,7 @@ xloadfont(Font *f, FcPattern *pattern) |
|
|
|
if ((XftPatternGetInteger(f->match->pattern, "slant", 0, |
|
|
|
if ((XftPatternGetInteger(f->match->pattern, "slant", 0, |
|
|
|
&haveattr) != XftResultMatch) || haveattr < wantattr) { |
|
|
|
&haveattr) != XftResultMatch) || haveattr < wantattr) { |
|
|
|
f->badslant = 1; |
|
|
|
f->badslant = 1; |
|
|
|
fputs("st: font slant does not match\n", stderr); |
|
|
|
fputs("font slant does not match\n", stderr); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -878,7 +878,7 @@ xloadfont(Font *f, FcPattern *pattern) |
|
|
|
if ((XftPatternGetInteger(f->match->pattern, "weight", 0, |
|
|
|
if ((XftPatternGetInteger(f->match->pattern, "weight", 0, |
|
|
|
&haveattr) != XftResultMatch) || haveattr != wantattr) { |
|
|
|
&haveattr) != XftResultMatch) || haveattr != wantattr) { |
|
|
|
f->badweight = 1; |
|
|
|
f->badweight = 1; |
|
|
|
fputs("st: font weight does not match\n", stderr); |
|
|
|
fputs("font weight does not match\n", stderr); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -906,14 +906,13 @@ xloadfonts(char *fontstr, double fontsize) |
|
|
|
FcPattern *pattern; |
|
|
|
FcPattern *pattern; |
|
|
|
double fontval; |
|
|
|
double fontval; |
|
|
|
|
|
|
|
|
|
|
|
if (fontstr[0] == '-') { |
|
|
|
if (fontstr[0] == '-') |
|
|
|
pattern = XftXlfdParse(fontstr, False, False); |
|
|
|
pattern = XftXlfdParse(fontstr, False, False); |
|
|
|
} else { |
|
|
|
else |
|
|
|
pattern = FcNameParse((FcChar8 *)fontstr); |
|
|
|
pattern = FcNameParse((FcChar8 *)fontstr); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!pattern) |
|
|
|
if (!pattern) |
|
|
|
die("st: can't open font %s\n", fontstr); |
|
|
|
die("can't open font %s\n", fontstr); |
|
|
|
|
|
|
|
|
|
|
|
if (fontsize > 1) { |
|
|
|
if (fontsize > 1) { |
|
|
|
FcPatternDel(pattern, FC_PIXEL_SIZE); |
|
|
|
FcPatternDel(pattern, FC_PIXEL_SIZE); |
|
|
@ -939,7 +938,7 @@ xloadfonts(char *fontstr, double fontsize) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (xloadfont(&dc.font, pattern)) |
|
|
|
if (xloadfont(&dc.font, pattern)) |
|
|
|
die("st: can't open font %s\n", fontstr); |
|
|
|
die("can't open font %s\n", fontstr); |
|
|
|
|
|
|
|
|
|
|
|
if (usedfontsize < 0) { |
|
|
|
if (usedfontsize < 0) { |
|
|
|
FcPatternGetDouble(dc.font.match->pattern, |
|
|
|
FcPatternGetDouble(dc.font.match->pattern, |
|
|
@ -956,17 +955,17 @@ xloadfonts(char *fontstr, double fontsize) |
|
|
|
FcPatternDel(pattern, FC_SLANT); |
|
|
|
FcPatternDel(pattern, FC_SLANT); |
|
|
|
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); |
|
|
|
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); |
|
|
|
if (xloadfont(&dc.ifont, pattern)) |
|
|
|
if (xloadfont(&dc.ifont, pattern)) |
|
|
|
die("st: can't open font %s\n", fontstr); |
|
|
|
die("can't open font %s\n", fontstr); |
|
|
|
|
|
|
|
|
|
|
|
FcPatternDel(pattern, FC_WEIGHT); |
|
|
|
FcPatternDel(pattern, FC_WEIGHT); |
|
|
|
FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); |
|
|
|
FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); |
|
|
|
if (xloadfont(&dc.ibfont, pattern)) |
|
|
|
if (xloadfont(&dc.ibfont, pattern)) |
|
|
|
die("st: can't open font %s\n", fontstr); |
|
|
|
die("can't open font %s\n", fontstr); |
|
|
|
|
|
|
|
|
|
|
|
FcPatternDel(pattern, FC_SLANT); |
|
|
|
FcPatternDel(pattern, FC_SLANT); |
|
|
|
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); |
|
|
|
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); |
|
|
|
if (xloadfont(&dc.bfont, pattern)) |
|
|
|
if (xloadfont(&dc.bfont, pattern)) |
|
|
|
die("st: can't open font %s\n", fontstr); |
|
|
|
die("can't open font %s\n", fontstr); |
|
|
|
|
|
|
|
|
|
|
|
FcPatternDestroy(pattern); |
|
|
|
FcPatternDestroy(pattern); |
|
|
|
} |
|
|
|
} |
|
|
@ -1003,13 +1002,13 @@ xinit(int cols, int rows) |
|
|
|
XColor xmousefg, xmousebg; |
|
|
|
XColor xmousefg, xmousebg; |
|
|
|
|
|
|
|
|
|
|
|
if (!(xw.dpy = XOpenDisplay(NULL))) |
|
|
|
if (!(xw.dpy = XOpenDisplay(NULL))) |
|
|
|
die("Can't open display\n"); |
|
|
|
die("can't open display\n"); |
|
|
|
xw.scr = XDefaultScreen(xw.dpy); |
|
|
|
xw.scr = XDefaultScreen(xw.dpy); |
|
|
|
xw.vis = XDefaultVisual(xw.dpy, xw.scr); |
|
|
|
xw.vis = XDefaultVisual(xw.dpy, xw.scr); |
|
|
|
|
|
|
|
|
|
|
|
/* font */ |
|
|
|
/* font */ |
|
|
|
if (!FcInit()) |
|
|
|
if (!FcInit()) |
|
|
|
die("Could not init fontconfig.\n"); |
|
|
|
die("could not init fontconfig.\n"); |
|
|
|
|
|
|
|
|
|
|
|
usedfont = (opt_font == NULL)? font : opt_font; |
|
|
|
usedfont = (opt_font == NULL)? font : opt_font; |
|
|
|
xloadfonts(usedfont, 0); |
|
|
|
xloadfonts(usedfont, 0); |
|
|
|