aboutsummaryrefslogtreecommitdiff
path: root/include/draw.h
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2015-02-17 12:16:20 -0500
committerRuss Cox <rsc@swtch.com>2015-02-17 20:51:23 +0000
commit213fc4f6fb26bb5781ea3e489bf4cc5c2aca591e (patch)
treef6a4f5bbb3244133a8b62b835176f09c9346cfe5 /include/draw.h
parent77f23268f7073b254e91748d4764768bab6d6f1f (diff)
downloadplan9port-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 'include/draw.h')
-rw-r--r--include/draw.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/draw.h b/include/draw.h
index ff760dd7..329108d9 100644
--- a/include/draw.h
+++ b/include/draw.h
@@ -206,6 +206,9 @@ struct Display
struct Mux *mux;
int srvfd;
int dpi;
+
+ Font *firstfont;
+ Font *lastfont;
};
struct Image
@@ -319,6 +322,15 @@ struct Font
Cachesubf *subf;
Cachefont **sub; /* as read from file */
Image *cacheimage;
+
+ /* doubly linked list of fonts known to display */
+ int ondisplaylist;
+ Font *next;
+ Font *prev;
+
+ /* on hi-dpi systems, one of these is set to f and the other is the other-dpi version of f */
+ Font *lodpi;
+ Font *hidpi;
};
#define Dx(r) ((r).max.x-(r).min.x)
@@ -460,6 +472,7 @@ extern void borderop(Image*, Rectangle, int, Image*, Point, Drawop);
* Font management
*/
extern Font* openfont(Display*, char*);
+extern int parsefontscale(char*, char**);
extern Font* buildfont(Display*, char*, char*);
extern void freefont(Font*);
extern Font* mkfont(Subfont*, Rune);
@@ -483,11 +496,13 @@ extern int runestringnwidth(Font*, Rune*, int);
extern Point strsubfontwidth(Subfont*, char*);
extern int loadchar(Font*, Rune, Cacheinfo*, int, int, char**);
extern char* subfontname(char*, char*, int);
-extern Subfont* _getsubfont(Display*, Font*, char*);
+extern Subfont* _getsubfont(Display*, char*);
extern Subfont* getdefont(Display*);
extern void lockdisplay(Display*);
extern void unlockdisplay(Display*);
extern int drawlsetrefresh(u32int, int, void*, void*);
+extern void loadhidpi(Font*);
+extern void swapfont(Font*, Font**, Font**);
/*
* Predefined