diff options
author | gotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2> | 2008-01-13 00:18:24 +0000 |
---|---|---|
committer | gotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2> | 2008-01-13 00:18:24 +0000 |
commit | 2d9004765dacb68faeafe7025fdf6f58925c4978 (patch) | |
tree | da16ef07d60534ffeab3de92e6cc0a340ff546df /draw.c | |
parent | a6f270275e0e8826f43b55ab515bb4ebc617bbfe (diff) | |
download | dzen-2d9004765dacb68faeafe7025fdf6f58925c4978.tar.gz dzen-2d9004765dacb68faeafe7025fdf6f58925c4978.zip |
added ^fn() command to dynamically switch fonts
git-svn-id: http://dzen.googlecode.com/svn/trunk@198 f2baff5b-bf2c-0410-a398-912abdc3d8b2
Diffstat (limited to 'draw.c')
-rw-r--r-- | draw.c | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -18,7 +18,7 @@ int otx; /* command types for the in-text parser */ -enum ctype {bg, fg, icon, rect, recto, circle, circleo, pos, abspos, titlewin, ibg, sa}; +enum ctype {bg, fg, icon, rect, recto, circle, circleo, pos, abspos, titlewin, ibg, fn, sa}; int get_tokval(const char* line, char **retdata); int get_token(const char* line, int * t, char **tval); @@ -194,6 +194,12 @@ get_token(const char *line, int * t, char **tval) { next_pos = get_tokval(line+off, &tokval); *t = circleo; } + /* ^fn(fontname) change font, type: fn */ + else if((*line == 'f') && (*(line+1) == 'n') && (*(line+2) == '(')) { + off = 3; + next_pos = get_tokval(line+off, &tokval); + *t = fn; + } /* ^sa(string) sensitive areas, type: sa */ else if((*line == 's') && (*(line+1) == 'a') && (*(line+2) == '(')) { off = 3; @@ -522,6 +528,12 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) { lastfg = tval[0] ? (unsigned)getcolor(tval) : dzen.norm[ColFG]; XSetForeground(dzen.dpy, dzen.tgc, lastfg); break; + case fn: + if(tval[0]) + setfont(tval); + else + setfont(dzen.fnt); + break; /* case sa: if(tval[0]) { @@ -702,6 +714,13 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) { lastfg = tval[0] ? (unsigned)getcolor(tval) : dzen.norm[ColFG]; XSetForeground(dzen.dpy, dzen.tgc, lastfg); break; + + case fn: + if(tval[0]) + setfont(tval); + else + setfont(dzen.fnt); + break; /* case sa: if(tval[0]) { |