diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2022-09-24 03:36:49 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2022-09-24 03:36:49 +0300 |
commit | cd1631b17dd0e25a8a398fb00a982ca5f0633558 (patch) | |
tree | ee8d9cdb560c815ea86d952ef2f053c6435865c1 /source/blender/blenfont/intern/blf_internal.h | |
parent | 88a602bc64fc2a86411d67881439a04486f95030 (diff) |
BLF: Refactor of DPI
Correction of U.dpi to hold actual monitor DPI. Simplify font sizing by
omitting DPI as API argument, always using 72 internally.
See D15961 for more details.
Differential Revision: https://developer.blender.org/D15961
Reviewed by Campbell Barton
Diffstat (limited to 'source/blender/blenfont/intern/blf_internal.h')
-rw-r--r-- | source/blender/blenfont/intern/blf_internal.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index 39d3af22562..e1001cfc1ba 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -25,6 +25,13 @@ struct rcti; /* Maximum number of bytes to use for cached data nodes. 0 is default of 200,000. */ #define BLF_CACHE_BYTES 400000 +/* We assume square pixels at a fixed DPI of 72, scaling only the size. Therefore + * font size = points = pixels, i.e. a size of 20 will result in a 20-pixel EM square. + * Although we could use the actual monitor DPI instead, we would then have to scale + * the size to cancel that out. Other libraries like Skia use this same fixed value. + */ +#define BLF_DPI 72 + extern struct FontBLF *global_font[BLF_MAX_FONT]; void blf_batch_draw_begin(struct FontBLF *font); @@ -70,7 +77,7 @@ void blf_font_attach_from_mem(struct FontBLF *font, const unsigned char *mem, si /** * Change font's output size. Returns true if successful in changing the size. */ -bool blf_font_size(struct FontBLF *font, float size, unsigned int dpi); +bool blf_font_size(struct FontBLF *font, float size); void blf_font_draw(struct FontBLF *font, const char *str, |