Browse Source

do not truncate font size when zooming

master
Quentin Rameau 9 years ago
committed by Roberto E. Vargas Caballero
parent
commit
bdd649a102
2 changed files with 10 additions and 11 deletions
  1. +3
    -3
      config.def.h
  2. +7
    -8
      st.c

+ 3
- 3
config.def.h View File

@ -120,9 +120,9 @@ static Shortcut shortcuts[] = {
{ ControlMask, XK_Print, toggleprinter, {.i = 0} }, { ControlMask, XK_Print, toggleprinter, {.i = 0} },
{ ShiftMask, XK_Print, printscreen, {.i = 0} }, { ShiftMask, XK_Print, printscreen, {.i = 0} },
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} }, { XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
{ MODKEY|ShiftMask, XK_Prior, xzoom, {.i = +1} },
{ MODKEY|ShiftMask, XK_Next, xzoom, {.i = -1} },
{ MODKEY|ShiftMask, XK_Home, xzoomreset, {.i = 0} },
{ MODKEY|ShiftMask, XK_Prior, xzoom, {.f = +1} },
{ MODKEY|ShiftMask, XK_Next, xzoom, {.f = -1} },
{ MODKEY|ShiftMask, XK_Home, xzoomreset, {.f = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} }, { ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} }, { MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} },
{ MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} }, { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} },


+ 7
- 8
st.c View File

@ -3061,7 +3061,6 @@ xloadfont(Font *f, FcPattern *pattern) {
void void
xloadfonts(char *fontstr, double fontsize) { xloadfonts(char *fontstr, double fontsize) {
FcPattern *pattern; FcPattern *pattern;
FcResult r_sz, r_psz;
double fontval; double fontval;
float ceilf(float); float ceilf(float);
@ -3080,11 +3079,11 @@ xloadfonts(char *fontstr, double fontsize) {
FcPatternAddDouble(pattern, FC_PIXEL_SIZE, (double)fontsize); FcPatternAddDouble(pattern, FC_PIXEL_SIZE, (double)fontsize);
usedfontsize = fontsize; usedfontsize = fontsize;
} else { } else {
r_psz = FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval);
r_sz = FcPatternGetDouble(pattern, FC_SIZE, 0, &fontval);
if(r_psz == FcResultMatch) {
if(FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) ==
FcResultMatch) {
usedfontsize = fontval; usedfontsize = fontval;
} else if(r_sz == FcResultMatch) {
} else if(FcPatternGetDouble(pattern, FC_SIZE, 0, &fontval) ==
FcResultMatch) {
usedfontsize = -1; usedfontsize = -1;
} else { } else {
/* /*
@ -3157,14 +3156,14 @@ void
xzoom(const Arg *arg) { xzoom(const Arg *arg) {
Arg larg; Arg larg;
larg.i = usedfontsize + arg->i;
larg.f = usedfontsize + arg->f;
xzoomabs(&larg); xzoomabs(&larg);
} }
void void
xzoomabs(const Arg *arg) { xzoomabs(const Arg *arg) {
xunloadfonts(); xunloadfonts();
xloadfonts(usedfont, arg->i);
xloadfonts(usedfont, arg->f);
cresize(0, 0); cresize(0, 0);
redraw(); redraw();
xhints(); xhints();
@ -3175,7 +3174,7 @@ xzoomreset(const Arg *arg) {
Arg larg; Arg larg;
if(defaultfontsize > 0) { if(defaultfontsize > 0) {
larg.i = defaultfontsize;
larg.f = defaultfontsize;
xzoomabs(&larg); xzoomabs(&larg);
} }
} }


Loading…
Cancel
Save