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:
Diffstat (limited to 'source/blender/blenfont/intern/blf_font.c')
-rw-r--r--source/blender/blenfont/intern/blf_font.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 3e2927d581e..038e73cc928 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -18,7 +18,8 @@
#include FT_FREETYPE_H
#include FT_GLYPH_H
-#include FT_TRUETYPE_TABLES_H /* For TT_OS2 */
+#include FT_TRUETYPE_TABLES_H /* For TT_OS2 */
+#include FT_MULTIPLE_MASTERS_H /* Variable font support. */
#include "MEM_guardedalloc.h"
@@ -1285,6 +1286,10 @@ FontBLF *blf_font_new(const char *name, const char *filepath)
MEM_freeN(mfile);
}
+ if (FT_HAS_MULTIPLE_MASTERS(font->face)) {
+ FT_Get_MM_Var(font->face, &(font->variations));
+ }
+
font->name = BLI_strdup(name);
font->filepath = BLI_strdup(filepath);
blf_font_fill(font);
@@ -1351,6 +1356,10 @@ FontBLF *blf_font_new_from_mem(const char *name, const unsigned char *mem, int m
return NULL;
}
+ if (FT_HAS_MULTIPLE_MASTERS(font->face)) {
+ FT_Get_MM_Var(font->face, &(font->variations));
+ }
+
font->name = BLI_strdup(name);
font->filepath = NULL;
blf_font_fill(font);
@@ -1365,6 +1374,10 @@ void blf_font_free(FontBLF *font)
MEM_freeN(font->kerning_cache);
}
+ if (font->variations) {
+ FT_Done_MM_Var(ft_lib, font->variations);
+ }
+
FT_Done_Face(font->face);
if (font->filepath) {
MEM_freeN(font->filepath);