diff options
author | Quentin Rameau <quinq@quinq.eu.org> | 2015-05-31 12:26:11 +0200 |
---|---|---|
committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2015-06-19 11:49:13 +0200 |
commit | bdd649a10289ade364f3deab3bbf6ee3169d67ca (patch) | |
tree | 36b8019d0d2dc154d0fe646c7894ea32675c744e /st.c | |
parent | 71fa10f613a22b3e75e0e897ee1be6667be3f449 (diff) | |
download | st-bdd649a10289ade364f3deab3bbf6ee3169d67ca.tar.gz st-bdd649a10289ade364f3deab3bbf6ee3169d67ca.zip |
do not truncate font size when zooming
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -3061,7 +3061,6 @@ xloadfont(Font *f, FcPattern *pattern) { | |||
3061 | void | 3061 | void |
3062 | xloadfonts(char *fontstr, double fontsize) { | 3062 | xloadfonts(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 | |||
3157 | xzoom(const Arg *arg) { | 3156 | xzoom(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 | ||
3164 | void | 3163 | void |
3165 | xzoomabs(const Arg *arg) { | 3164 | xzoomabs(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 | } |