Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-08-14 18:53:27 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-08-21 20:07:04 +0300
commit34029fc71a3cc7e69f977462d4b3f09eb10ccca2 (patch)
treee92af5b985e31177bba8621e5696e8243b8a2b46 /source/blender/blenfont
parentabc4beb245c123f570072e642287c44b7c8f2b86 (diff)
UI: disable new text hinting from D3201 by default for now.
This changes the text hinting setting to be an enum with options Auto / None / Slight / Full. The default is Auto which currently disables hinting. The hinting was tested with a new FreeType version, but this is not what is used on the buildbots an official release environment, and the fonts look quite bad because of that. Once FreeType has been upgraded we can change the default. Even then the results are not ideal, perhaps due to missing subpixel positioning and linear color blending support in BLF.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/BLF_api.h8
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c21
2 files changed, 22 insertions, 7 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index 9bb3dd39aa6..0a4212ff233 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -218,9 +218,11 @@ void BLF_state_print(int fontid);
#define BLF_KERNING_DEFAULT (1 << 3)
#define BLF_MATRIX (1 << 4)
#define BLF_ASPECT (1 << 5)
-#define BLF_HINTING (1 << 6)
-#define BLF_WORD_WRAP (1 << 7)
-#define BLF_MONOCHROME (1 << 8) /* no-AA */
+#define BLF_WORD_WRAP (1 << 6)
+#define BLF_MONOCHROME (1 << 7) /* no-AA */
+#define BLF_HINTING_NONE (1 << 8)
+#define BLF_HINTING_SLIGHT (1 << 9)
+#define BLF_HINTING_FULL (1 << 10)
#define BLF_DRAW_STR_DUMMY_MAX 1024
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index f1301d38ab6..c19c8528232 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -221,7 +221,6 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
GlyphBLF *g;
FT_Error err;
FT_Bitmap bitmap, tempbitmap;
- int flags = FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP;
FT_BBox bbox;
unsigned int key;
@@ -242,13 +241,27 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
return g;
}
- if (font->flags & BLF_HINTING)
- flags &= ~FT_LOAD_NO_HINTING;
-
if (font->flags & BLF_MONOCHROME) {
err = FT_Load_Glyph(font->face, (FT_UInt)index, FT_LOAD_TARGET_MONO);
}
else {
+ int flags = FT_LOAD_NO_BITMAP;
+
+ if (font->flags & BLF_HINTING_NONE) {
+ flags |= FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING;
+ }
+ else if (font->flags & BLF_HINTING_SLIGHT) {
+ flags |= FT_LOAD_TARGET_LIGHT;
+ }
+ else if (font->flags & BLF_HINTING_FULL) {
+ flags |= FT_LOAD_TARGET_NORMAL;
+ }
+ else {
+ /* Default, hinting disabled until FreeType has been upgraded
+ * to give good results on all platforms. */
+ flags |= FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING;
+ }
+
err = FT_Load_Glyph(font->face, (FT_UInt)index, flags);
}