Blob
- Date:
- Message:
- libdraw: redo default font construction to be hidpi-safe If $font is not set, the default font is constructed from font data linked into every libdraw binary. That process was different from the usual openfont code, and so it was not hidpi-aware, resulting in very tiny fonts out of the box on hidpi systems, until users set $font. Fix this by using openfont to construct the default font, by recognizing the name *default* when looking for font and subfont file contents. Then all the hidpi scaling applies automatically. As a side effect, the concept of a 'default subfont' is gone, as are display->defaultsubfont, getdefont, and memgetdefont.
- Actions:
- History | Blame | Raw File
1 typedef struct XFont XFont;2 XFont *xfont;3 int nxfont;5 enum {6 SubfontSize = 32,7 SubfontMask = (1<<16)/SubfontSize - 1,8 };10 struct XFont11 {12 char *name;13 int loaded;14 uchar range[(1<<16)/SubfontSize]; // range[i] == whether to have subfont i*SubfontSize to (i+1)*SubfontSize - 1.15 int nrange;16 int unit;17 double height;18 double originy;19 void (*loadheight)(XFont*, int, int*, int*);21 // fontconfig workarround, as FC_FULLNAME does not work for matching fonts.22 char *fontfile;23 int index;24 };26 void loadfonts(void);27 void load(XFont*);28 Memsubfont* mksubfont(XFont*, char*, int, int, int, int);30 extern XFont *xfont;31 extern int nxfont;32 void *emalloc9p(ulong);34 void drawpjw(Memimage*, Fontchar*, int, int, int, int);