diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-26 15:56:00 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-26 15:56:00 +0300 |
commit | 21aca14e43326ea9af45f1e848ebca52808f8470 (patch) | |
tree | 25c5838a8b40ecb5996c7f1ccdfc1a90f69bd23b /source/blender/blenfont | |
parent | 13f80a152a3a84286330b1bc6d9818279b976e91 (diff) | |
parent | 3c45fdd171fa6ebd65f19f9fac9b204865e13136 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 4 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf.c | 11 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_glyph.c | 4 |
3 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 22559edad22..cd3a15f1c88 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -33,6 +33,7 @@ #define __BLF_API_H__ #include "BLI_compiler_attrs.h" +#include "BLI_sys_types.h" /* enable this only if needed (unused circa 2016) */ #define BLF_BLUR_ENABLE 0 @@ -47,6 +48,9 @@ void BLF_default_dpi(int dpi); void BLF_default_set(int fontid); int BLF_default(void); /* get default font ID so we can pass it to other functions */ +void BLF_antialias_set(bool enabled); +bool BLF_antialias_get(void); + void BLF_cache_clear(void); int BLF_load(const char *name) ATTR_NONNULL(); diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 0cca1852c91..8e705616c41 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -85,6 +85,7 @@ static FontBLF *global_font[BLF_MAX_FONT] = {NULL}; static int global_font_default = -1; static int global_font_points = 11; static int global_font_dpi = 72; +static bool global_use_antialias = true; /* XXX, should these be made into global_font_'s too? */ int blf_mono_font = -1; @@ -182,6 +183,16 @@ int BLF_default(void) return global_font_default; } +void BLF_antialias_set(bool enabled) +{ + global_use_antialias = enabled; +} + +bool BLF_antialias_get(void) +{ + return global_use_antialias; +} + int BLF_load(const char *name) { FontBLF *font; diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 5a8691c9b4f..1f31a2dbd0a 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -56,7 +56,7 @@ #include "BLF_api.h" #ifndef BLF_STANDALONE -#include "GPU_immediate.h" +# include "GPU_immediate.h" #endif #include "blf_internal_types.h" @@ -207,7 +207,7 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c) GlyphBLF *g; FT_Error err; FT_Bitmap bitmap, tempbitmap; - const bool is_sharp = (U.text_render & USER_TEXT_DISABLE_AA) != 0; + const bool is_sharp = !BLF_antialias_get(); int flags = FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP; FT_BBox bbox; unsigned int key; |