diff options
Diffstat (limited to 'x.c')
| -rw-r--r-- | x.c | 27 |
1 files changed, 13 insertions, 14 deletions
| @@ -742,9 +742,9 @@ xloadcols(void) | |||
| 742 | for (i = 0; i < dc.collen; i++) | 742 | for (i = 0; i < dc.collen; i++) |
| 743 | if (!xloadcolor(i, NULL, &dc.col[i])) { | 743 | if (!xloadcolor(i, NULL, &dc.col[i])) { |
| 744 | if (colorname[i]) | 744 | if (colorname[i]) |
| 745 | die("Could not allocate color '%s'\n", colorname[i]); | 745 | die("could not allocate color '%s'\n", colorname[i]); |
| 746 | else | 746 | else |
| 747 | die("Could not allocate color %d\n", i); | 747 | die("could not allocate color %d\n", i); |
| 748 | } | 748 | } |
| 749 | loaded = 1; | 749 | loaded = 1; |
| 750 | } | 750 | } |
| @@ -869,7 +869,7 @@ xloadfont(Font *f, FcPattern *pattern) | |||
| 869 | if ((XftPatternGetInteger(f->match->pattern, "slant", 0, | 869 | if ((XftPatternGetInteger(f->match->pattern, "slant", 0, |
| 870 | &haveattr) != XftResultMatch) || haveattr < wantattr) { | 870 | &haveattr) != XftResultMatch) || haveattr < wantattr) { |
| 871 | f->badslant = 1; | 871 | f->badslant = 1; |
| 872 | fputs("st: font slant does not match\n", stderr); | 872 | fputs("font slant does not match\n", stderr); |
| 873 | } | 873 | } |
| 874 | } | 874 | } |
| 875 | 875 | ||
| @@ -878,7 +878,7 @@ xloadfont(Font *f, FcPattern *pattern) | |||
| 878 | if ((XftPatternGetInteger(f->match->pattern, "weight", 0, | 878 | if ((XftPatternGetInteger(f->match->pattern, "weight", 0, |
| 879 | &haveattr) != XftResultMatch) || haveattr != wantattr) { | 879 | &haveattr) != XftResultMatch) || haveattr != wantattr) { |
| 880 | f->badweight = 1; | 880 | f->badweight = 1; |
| 881 | fputs("st: font weight does not match\n", stderr); | 881 | fputs("font weight does not match\n", stderr); |
| 882 | } | 882 | } |
| 883 | } | 883 | } |
| 884 | 884 | ||
| @@ -906,14 +906,13 @@ xloadfonts(char *fontstr, double fontsize) | |||
| 906 | FcPattern *pattern; | 906 | FcPattern *pattern; |
| 907 | double fontval; | 907 | double fontval; |
| 908 | 908 | ||
| 909 | if (fontstr[0] == '-') { | 909 | if (fontstr[0] == '-') |
| 910 | pattern = XftXlfdParse(fontstr, False, False); | 910 | pattern = XftXlfdParse(fontstr, False, False); |
| 911 | } else { | 911 | else |
| 912 | pattern = FcNameParse((FcChar8 *)fontstr); | 912 | pattern = FcNameParse((FcChar8 *)fontstr); |
| 913 | } | ||
| 914 | 913 | ||
| 915 | if (!pattern) | 914 | if (!pattern) |
| 916 | die("st: can't open font %s\n", fontstr); | 915 | die("can't open font %s\n", fontstr); |
| 917 | 916 | ||
| 918 | if (fontsize > 1) { | 917 | if (fontsize > 1) { |
| 919 | FcPatternDel(pattern, FC_PIXEL_SIZE); | 918 | FcPatternDel(pattern, FC_PIXEL_SIZE); |
| @@ -939,7 +938,7 @@ xloadfonts(char *fontstr, double fontsize) | |||
| 939 | } | 938 | } |
| 940 | 939 | ||
| 941 | if (xloadfont(&dc.font, pattern)) | 940 | if (xloadfont(&dc.font, pattern)) |
| 942 | die("st: can't open font %s\n", fontstr); | 941 | die("can't open font %s\n", fontstr); |
| 943 | 942 | ||
| 944 | if (usedfontsize < 0) { | 943 | if (usedfontsize < 0) { |
| 945 | FcPatternGetDouble(dc.font.match->pattern, | 944 | FcPatternGetDouble(dc.font.match->pattern, |
| @@ -956,17 +955,17 @@ xloadfonts(char *fontstr, double fontsize) | |||
| 956 | FcPatternDel(pattern, FC_SLANT); | 955 | FcPatternDel(pattern, FC_SLANT); |
| 957 | FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); | 956 | FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); |
| 958 | if (xloadfont(&dc.ifont, pattern)) | 957 | if (xloadfont(&dc.ifont, pattern)) |
| 959 | die("st: can't open font %s\n", fontstr); | 958 | die("can't open font %s\n", fontstr); |
| 960 | 959 | ||
| 961 | FcPatternDel(pattern, FC_WEIGHT); | 960 | FcPatternDel(pattern, FC_WEIGHT); |
| 962 | FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); | 961 | FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); |
| 963 | if (xloadfont(&dc.ibfont, pattern)) | 962 | if (xloadfont(&dc.ibfont, pattern)) |
| 964 | die("st: can't open font %s\n", fontstr); | 963 | die("can't open font %s\n", fontstr); |
| 965 | 964 | ||
| 966 | FcPatternDel(pattern, FC_SLANT); | 965 | FcPatternDel(pattern, FC_SLANT); |
| 967 | FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); | 966 | FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); |
| 968 | if (xloadfont(&dc.bfont, pattern)) | 967 | if (xloadfont(&dc.bfont, pattern)) |
| 969 | die("st: can't open font %s\n", fontstr); | 968 | die("can't open font %s\n", fontstr); |
| 970 | 969 | ||
| 971 | FcPatternDestroy(pattern); | 970 | FcPatternDestroy(pattern); |
| 972 | } | 971 | } |
| @@ -1003,13 +1002,13 @@ xinit(int cols, int rows) | |||
| 1003 | XColor xmousefg, xmousebg; | 1002 | XColor xmousefg, xmousebg; |
| 1004 | 1003 | ||
| 1005 | if (!(xw.dpy = XOpenDisplay(NULL))) | 1004 | if (!(xw.dpy = XOpenDisplay(NULL))) |
| 1006 | die("Can't open display\n"); | 1005 | die("can't open display\n"); |
| 1007 | xw.scr = XDefaultScreen(xw.dpy); | 1006 | xw.scr = XDefaultScreen(xw.dpy); |
| 1008 | xw.vis = XDefaultVisual(xw.dpy, xw.scr); | 1007 | xw.vis = XDefaultVisual(xw.dpy, xw.scr); |
| 1009 | 1008 | ||
| 1010 | /* font */ | 1009 | /* font */ |
| 1011 | if (!FcInit()) | 1010 | if (!FcInit()) |
| 1012 | die("Could not init fontconfig.\n"); | 1011 | die("could not init fontconfig.\n"); |
| 1013 | 1012 | ||
| 1014 | usedfont = (opt_font == NULL)? font : opt_font; | 1013 | usedfont = (opt_font == NULL)? font : opt_font; |
| 1015 | xloadfonts(usedfont, 0); | 1014 | xloadfonts(usedfont, 0); |
