diff options
author | Russ Cox <rsc@swtch.com> | 2015-02-17 12:16:20 -0500 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2015-02-17 20:51:23 +0000 |
commit | 213fc4f6fb26bb5781ea3e489bf4cc5c2aca591e (patch) | |
tree | f6a4f5bbb3244133a8b62b835176f09c9346cfe5 /src/libdraw/getsubfont.c | |
parent | 77f23268f7073b254e91748d4764768bab6d6f1f (diff) | |
download | plan9port-213fc4f6fb26bb5781ea3e489bf4cc5c2aca591e.tar.gz plan9port-213fc4f6fb26bb5781ea3e489bf4cc5c2aca591e.tar.bz2 plan9port-213fc4f6fb26bb5781ea3e489bf4cc5c2aca591e.zip |
libdraw: autoscale fonts when moving between low and high dpi screens
Change-Id: I6093955b222db89dfe437fb723593b173d888d01
Reviewed-on: https://plan9port-review.googlesource.com/1170
Reviewed-by: Russ Cox <rsc@swtch.com>
Diffstat (limited to 'src/libdraw/getsubfont.c')
-rw-r--r-- | src/libdraw/getsubfont.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/libdraw/getsubfont.c b/src/libdraw/getsubfont.c index 3f3b6954..1a5006b4 100644 --- a/src/libdraw/getsubfont.c +++ b/src/libdraw/getsubfont.c @@ -11,17 +11,20 @@ int _fontpipe(char*); static void scalesubfont(Subfont*, int); Subfont* -_getsubfont(Display *d, Font *ff, char *name) +_getsubfont(Display *d, char *name) { int fd; Subfont *f; - - fd = open(name, OREAD); - if(fd < 0 && strncmp(name, "/mnt/font/", 10) == 0) - fd = _fontpipe(name+10); + int scale; + char *fname; + + scale = parsefontscale(name, &fname); + fd = open(fname, OREAD); + if(fd < 0 && strncmp(fname, "/mnt/font/", 10) == 0) + fd = _fontpipe(fname+10); if(fd < 0){ - fprint(2, "getsubfont: can't open %s: %r\n", name); + fprint(2, "getsubfont: can't open %s: %r\n", fname); return 0; } /* @@ -38,8 +41,8 @@ _getsubfont(Display *d, Font *ff, char *name) if(f == 0) fprint(2, "getsubfont: can't read %s: %r\n", name); close(fd); - if(ff->scale != 1 && ff->scale != 0) - scalesubfont(f, ff->scale); + if(scale > 1) + scalesubfont(f, scale); return f; } |