Merge remote-tracking branch 'suckless/master' into wayland

This commit is contained in:
Michael Forney 2016-12-21 20:24:19 -08:00
commit b27f17da65
2 changed files with 27 additions and 7 deletions

View File

@ -132,6 +132,13 @@ static unsigned int defaultrcs = 257;
*/ */
static unsigned int cursorshape = 2; static unsigned int cursorshape = 2;
/*
* Default columns and rows numbers
*/
static unsigned int cols = 80;
static unsigned int rows = 24;
/* /*
* Default shape of the mouse cursor * Default shape of the mouse cursor
*/ */

27
st.c
View File

@ -3159,16 +3159,32 @@ wlclear(int x1, int y1, int x2, int y2)
int int
wlloadfont(Font *f, FcPattern *pattern) wlloadfont(Font *f, FcPattern *pattern)
{ {
FcPattern *configured;
FcPattern *match; FcPattern *match;
FcResult result; FcResult result;
struct wld_extents extents; struct wld_extents extents;
int wantattr, haveattr; int wantattr, haveattr;
match = FcFontMatch(NULL, pattern, &result); /*
if (!match) * Manually configure instead of calling XftMatchFont
* so that we can use the configured pattern for
* "missing glyph" lookups.
*/
configured = FcPatternDuplicate(pattern);
if (!configured)
return 1; return 1;
FcConfigSubstitute(NULL, configured, FcMatchPattern);
FcDefaultSubstitute(configured);
match = FcFontMatch(NULL, configured, &result);
if (!match) {
FcPatternDestroy(configured);
return 1;
}
if (!(f->match = wld_font_open_pattern(wld.fontctx, match))) { if (!(f->match = wld_font_open_pattern(wld.fontctx, match))) {
FcPatternDestroy(configured);
FcPatternDestroy(match); FcPatternDestroy(match);
return 1; return 1;
} }
@ -3199,7 +3215,7 @@ wlloadfont(Font *f, FcPattern *pattern)
wld_font_text_extents(f->match, ascii_printable, &extents); wld_font_text_extents(f->match, ascii_printable, &extents);
f->set = NULL; f->set = NULL;
f->pattern = FcPatternDuplicate(pattern); f->pattern = configured;
f->ascent = f->match->ascent; f->ascent = f->match->ascent;
f->descent = f->match->descent; f->descent = f->match->descent;
@ -3261,9 +3277,6 @@ wlloadfonts(char *fontstr, double fontsize)
if (usedfontsize < 0) { if (usedfontsize < 0) {
FcPatternGetDouble(dc.font.pattern, FcPatternGetDouble(dc.font.pattern,
FC_PIXEL_SIZE, 0, &fontval); FC_PIXEL_SIZE, 0, &fontval);
FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fontval);
if (wlloadfont(&dc.font, pattern))
die("st: can't open font %s\n", fontstr);
usedfontsize = fontval; usedfontsize = fontval;
if (fontsize == 0) if (fontsize == 0)
defaultfontsize = fontval; defaultfontsize = fontval;
@ -4537,7 +4550,7 @@ run:
opt_title = basename(xstrdup(argv[0])); opt_title = basename(xstrdup(argv[0]));
} }
setlocale(LC_CTYPE, ""); setlocale(LC_CTYPE, "");
tnew(80, 24); tnew(MAX(cols, 1), MAX(rows, 1));
wlinit(); wlinit();
selinit(); selinit();
run(); run();