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:
-rw-r--r--source/blender/blenfont/intern/blf_font.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 038e73cc928..07d19f307a2 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -1356,13 +1356,24 @@ FontBLF *blf_font_new_from_mem(const char *name, const unsigned char *mem, int m
return NULL;
}
+ font->name = BLI_strdup(name);
+ font->filepath = NULL;
+ blf_font_fill(font);
+
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);
+ if (FT_HAS_KERNING(font->face)) {
+ /* Create kerning cache table and fill with value indicating "unset". */
+ font->kerning_cache = MEM_mallocN(sizeof(KerningCacheBLF), __func__);
+ for (uint i = 0; i < KERNING_CACHE_TABLE_SIZE; i++) {
+ for (uint j = 0; j < KERNING_CACHE_TABLE_SIZE; j++) {
+ font->kerning_cache->ascii_table[i][j] = KERNING_ENTRY_UNSET;
+ }
+ }
+ }
+
return font;
}