aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@quinq.eu.org>2015-05-31 12:26:11 +0200
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2015-06-19 11:49:13 +0200
commitbdd649a10289ade364f3deab3bbf6ee3169d67ca (patch)
tree36b8019d0d2dc154d0fe646c7894ea32675c744e
parent71fa10f613a22b3e75e0e897ee1be6667be3f449 (diff)
downloadst-patched-bdd649a10289ade364f3deab3bbf6ee3169d67ca.tar.bz2
st-patched-bdd649a10289ade364f3deab3bbf6ee3169d67ca.tar.xz
st-patched-bdd649a10289ade364f3deab3bbf6ee3169d67ca.zip
do not truncate font size when zooming
-rw-r--r--config.def.h6
-rw-r--r--st.c15
2 files changed, 10 insertions, 11 deletions
diff --git a/config.def.h b/config.def.h
index bb5596e..64e75b8 100644
--- a/config.def.h
+++ b/config.def.h
@@ -120,9 +120,9 @@ static Shortcut shortcuts[] = {
120 { ControlMask, XK_Print, toggleprinter, {.i = 0} }, 120 { ControlMask, XK_Print, toggleprinter, {.i = 0} },
121 { ShiftMask, XK_Print, printscreen, {.i = 0} }, 121 { ShiftMask, XK_Print, printscreen, {.i = 0} },
122 { XK_ANY_MOD, XK_Print, printsel, {.i = 0} }, 122 { XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
123 { MODKEY|ShiftMask, XK_Prior, xzoom, {.i = +1} }, 123 { MODKEY|ShiftMask, XK_Prior, xzoom, {.f = +1} },
124 { MODKEY|ShiftMask, XK_Next, xzoom, {.i = -1} }, 124 { MODKEY|ShiftMask, XK_Next, xzoom, {.f = -1} },
125 { MODKEY|ShiftMask, XK_Home, xzoomreset, {.i = 0} }, 125 { MODKEY|ShiftMask, XK_Home, xzoomreset, {.f = 0} },
126 { ShiftMask, XK_Insert, selpaste, {.i = 0} }, 126 { ShiftMask, XK_Insert, selpaste, {.i = 0} },
127 { MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} }, 127 { MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} },
128 { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} }, 128 { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} },
diff --git a/st.c b/st.c
index 3dd5caf..bb64c55 100644
--- a/st.c
+++ b/st.c
@@ -3061,7 +3061,6 @@ xloadfont(Font *f, FcPattern *pattern) {
3061void 3061void
3062xloadfonts(char *fontstr, double fontsize) { 3062xloadfonts(char *fontstr, double fontsize) {
3063 FcPattern *pattern; 3063 FcPattern *pattern;
3064 FcResult r_sz, r_psz;
3065 double fontval; 3064 double fontval;
3066 float ceilf(float); 3065 float ceilf(float);
3067 3066
@@ -3080,11 +3079,11 @@ xloadfonts(char *fontstr, double fontsize) {
3080 FcPatternAddDouble(pattern, FC_PIXEL_SIZE, (double)fontsize); 3079 FcPatternAddDouble(pattern, FC_PIXEL_SIZE, (double)fontsize);
3081 usedfontsize = fontsize; 3080 usedfontsize = fontsize;
3082 } else { 3081 } else {
3083 r_psz = FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval); 3082 if(FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) ==
3084 r_sz = FcPatternGetDouble(pattern, FC_SIZE, 0, &fontval); 3083 FcResultMatch) {
3085 if(r_psz == FcResultMatch) {
3086 usedfontsize = fontval; 3084 usedfontsize = fontval;
3087 } else if(r_sz == FcResultMatch) { 3085 } else if(FcPatternGetDouble(pattern, FC_SIZE, 0, &fontval) ==
3086 FcResultMatch) {
3088 usedfontsize = -1; 3087 usedfontsize = -1;
3089 } else { 3088 } else {
3090 /* 3089 /*
@@ -3157,14 +3156,14 @@ void
3157xzoom(const Arg *arg) { 3156xzoom(const Arg *arg) {
3158 Arg larg; 3157 Arg larg;
3159 3158
3160 larg.i = usedfontsize + arg->i; 3159 larg.f = usedfontsize + arg->f;
3161 xzoomabs(&larg); 3160 xzoomabs(&larg);
3162} 3161}
3163 3162
3164void 3163void
3165xzoomabs(const Arg *arg) { 3164xzoomabs(const Arg *arg) {
3166 xunloadfonts(); 3165 xunloadfonts();
3167 xloadfonts(usedfont, arg->i); 3166 xloadfonts(usedfont, arg->f);
3168 cresize(0, 0); 3167 cresize(0, 0);
3169 redraw(); 3168 redraw();
3170 xhints(); 3169 xhints();
@@ -3175,7 +3174,7 @@ xzoomreset(const Arg *arg) {
3175 Arg larg; 3174 Arg larg;
3176 3175
3177 if(defaultfontsize > 0) { 3176 if(defaultfontsize > 0) {
3178 larg.i = defaultfontsize; 3177 larg.f = defaultfontsize;
3179 xzoomabs(&larg); 3178 xzoomabs(&larg);
3180 } 3179 }
3181} 3180}