|
|
@ -156,7 +156,8 @@ static void xresize(int, int); |
|
|
|
static void xhints(void); |
|
|
|
static void xhints(void); |
|
|
|
static int xloadcolor(int, const char *, Color *); |
|
|
|
static int xloadcolor(int, const char *, Color *); |
|
|
|
static int xloadfont(Font *, FcPattern *); |
|
|
|
static int xloadfont(Font *, FcPattern *); |
|
|
|
static void xloadfonts(char *, double); |
|
|
|
static int xloaditalicfont(Font *, FcPattern *); |
|
|
|
|
|
|
|
static void xloadfonts(char *, char *, double); |
|
|
|
static void xunloadfont(Font *); |
|
|
|
static void xunloadfont(Font *); |
|
|
|
static void xunloadfonts(void); |
|
|
|
static void xunloadfonts(void); |
|
|
|
static void xsetenv(void); |
|
|
|
static void xsetenv(void); |
|
|
@ -305,7 +306,7 @@ void |
|
|
|
zoomabs(const Arg *arg) |
|
|
|
zoomabs(const Arg *arg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
xunloadfonts(); |
|
|
|
xunloadfonts(); |
|
|
|
xloadfonts(usedfont, arg->f); |
|
|
|
xloadfonts(usedfont, italicfont, arg->f); |
|
|
|
cresize(0, 0); |
|
|
|
cresize(0, 0); |
|
|
|
redraw(); |
|
|
|
redraw(); |
|
|
|
xhints(); |
|
|
|
xhints(); |
|
|
@ -950,9 +951,10 @@ xloadfont(Font *f, FcPattern *pattern) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
|
xloadfonts(char *fontstr, double fontsize) |
|
|
|
xloadfonts(char *fontstr, char *italicfontstr, double fontsize) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FcPattern *pattern; |
|
|
|
FcPattern *pattern; |
|
|
|
|
|
|
|
FcPattern *italicpattern; |
|
|
|
double fontval; |
|
|
|
double fontval; |
|
|
|
|
|
|
|
|
|
|
|
if (fontstr[0] == '-') |
|
|
|
if (fontstr[0] == '-') |
|
|
@ -960,13 +962,21 @@ xloadfonts(char *fontstr, double fontsize) |
|
|
|
else |
|
|
|
else |
|
|
|
pattern = FcNameParse((FcChar8 *)fontstr); |
|
|
|
pattern = FcNameParse((FcChar8 *)fontstr); |
|
|
|
|
|
|
|
|
|
|
|
if (!pattern) |
|
|
|
if (italicfontstr[0] == '-') |
|
|
|
die("can't open font %s\n", fontstr); |
|
|
|
italicpattern = XftXlfdParse(italicfontstr, False, False); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
italicpattern = FcNameParse((FcChar8 *)italicfontstr); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!italicpattern) |
|
|
|
|
|
|
|
die("can't open font %s\n", italicfontstr); |
|
|
|
|
|
|
|
|
|
|
|
if (fontsize > 1) { |
|
|
|
if (fontsize > 1) { |
|
|
|
FcPatternDel(pattern, FC_PIXEL_SIZE); |
|
|
|
FcPatternDel(pattern, FC_PIXEL_SIZE); |
|
|
|
FcPatternDel(pattern, FC_SIZE); |
|
|
|
FcPatternDel(pattern, FC_SIZE); |
|
|
|
FcPatternAddDouble(pattern, FC_PIXEL_SIZE, (double)fontsize); |
|
|
|
FcPatternAddDouble(pattern, FC_PIXEL_SIZE, (double)fontsize); |
|
|
|
|
|
|
|
FcPatternDel(italicpattern, FC_PIXEL_SIZE); |
|
|
|
|
|
|
|
FcPatternDel(italicpattern, FC_SIZE); |
|
|
|
|
|
|
|
FcPatternAddDouble(italicpattern, FC_PIXEL_SIZE, (double)fontsize); |
|
|
|
usedfontsize = fontsize; |
|
|
|
usedfontsize = fontsize; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) == |
|
|
|
if (FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) == |
|
|
@ -1002,9 +1012,9 @@ xloadfonts(char *fontstr, double fontsize) |
|
|
|
win.ch = ceilf(dc.font.height * chscale); |
|
|
|
win.ch = ceilf(dc.font.height * chscale); |
|
|
|
|
|
|
|
|
|
|
|
FcPatternDel(pattern, FC_SLANT); |
|
|
|
FcPatternDel(pattern, FC_SLANT); |
|
|
|
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); |
|
|
|
FcPatternAddInteger(italicpattern, FC_SLANT, FC_SLANT_ITALIC); |
|
|
|
if (xloadfont(&dc.ifont, pattern)) |
|
|
|
if (xloadfont(&dc.ifont, italicpattern)) |
|
|
|
die("can't open font %s\n", fontstr); |
|
|
|
die("can't open font %s\n", italicfontstr); |
|
|
|
|
|
|
|
|
|
|
|
FcPatternDel(pattern, FC_WEIGHT); |
|
|
|
FcPatternDel(pattern, FC_WEIGHT); |
|
|
|
FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); |
|
|
|
FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); |
|
|
@ -1114,7 +1124,7 @@ xinit(int cols, int rows) |
|
|
|
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, italicfont, 0); |
|
|
|
|
|
|
|
|
|
|
|
/* colors */ |
|
|
|
/* colors */ |
|
|
|
xw.cmap = XDefaultColormap(xw.dpy, xw.scr); |
|
|
|
xw.cmap = XDefaultColormap(xw.dpy, xw.scr); |
|
|
|