aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/st.c b/st.c
index 83293f4..2b4d52c 100644
--- a/st.c
+++ b/st.c
@@ -317,6 +317,8 @@ static void clippaste(const Arg *);
317static void numlock(const Arg *); 317static void numlock(const Arg *);
318static void selpaste(const Arg *); 318static void selpaste(const Arg *);
319static void xzoom(const Arg *); 319static void xzoom(const Arg *);
320static void xzoomabs(const Arg *);
321static void xzoomreset(const Arg *);
320static void printsel(const Arg *); 322static void printsel(const Arg *);
321static void printscreen(const Arg *) ; 323static void printscreen(const Arg *) ;
322static void toggleprinter(const Arg *); 324static void toggleprinter(const Arg *);
@@ -503,6 +505,7 @@ static int oldbutton = 3; /* button event on startup: 3 = release */
503 505
504static char *usedfont = NULL; 506static char *usedfont = NULL;
505static double usedfontsize = 0; 507static double usedfontsize = 0;
508static double defaultfontsize = 0;
506 509
507static uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; 510static uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0};
508static uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; 511static uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
@@ -2993,6 +2996,7 @@ xloadfonts(char *fontstr, double fontsize) {
2993 FcPatternAddDouble(pattern, FC_PIXEL_SIZE, 12); 2996 FcPatternAddDouble(pattern, FC_PIXEL_SIZE, 12);
2994 usedfontsize = 12; 2997 usedfontsize = 12;
2995 } 2998 }
2999 defaultfontsize = usedfontsize;
2996 } 3000 }
2997 3001
2998 FcConfigSubstitute(0, pattern, FcMatchPattern); 3002 FcConfigSubstitute(0, pattern, FcMatchPattern);
@@ -3005,6 +3009,8 @@ xloadfonts(char *fontstr, double fontsize) {
3005 FcPatternGetDouble(dc.font.match->pattern, 3009 FcPatternGetDouble(dc.font.match->pattern,
3006 FC_PIXEL_SIZE, 0, &fontval); 3010 FC_PIXEL_SIZE, 0, &fontval);
3007 usedfontsize = fontval; 3011 usedfontsize = fontval;
3012 if(fontsize == 0)
3013 defaultfontsize = fontval;
3008 } 3014 }
3009 3015
3010 /* Setting character width and height. */ 3016 /* Setting character width and height. */
@@ -3058,16 +3064,33 @@ xunloadfonts(void) {
3058 xunloadfont(&dc.ibfont); 3064 xunloadfont(&dc.ibfont);
3059} 3065}
3060 3066
3067
3061void 3068void
3062xzoom(const Arg *arg) { 3069xzoom(const Arg *arg) {
3070 Arg larg;
3071 larg.i = usedfontsize + arg->i;
3072 xzoomabs(&larg);
3073}
3074
3075void
3076xzoomabs(const Arg *arg) {
3063 xunloadfonts(); 3077 xunloadfonts();
3064 xloadfonts(usedfont, usedfontsize + arg->i); 3078 xloadfonts(usedfont, arg->i);
3065 cresize(0, 0); 3079 cresize(0, 0);
3066 redraw(0); 3080 redraw(0);
3067 xhints(); 3081 xhints();
3068} 3082}
3069 3083
3070void 3084void
3085xzoomreset(const Arg *arg) {
3086 Arg larg;
3087 if(defaultfontsize > 0) {
3088 larg.i = defaultfontsize;
3089 xzoomabs(&larg);
3090 }
3091}
3092
3093void
3071xinit(void) { 3094xinit(void) {
3072 XGCValues gcvalues; 3095 XGCValues gcvalues;
3073 Cursor cursor; 3096 Cursor cursor;