diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2021-11-03 00:27:29 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2021-11-03 00:28:25 +0300 |
commit | c4b73847d31add1a433acba8423982b288c8e7d9 (patch) | |
tree | 2190547443ddc336a87c561396e46d919eeef6a3 /source/blender/blenfont/intern/blf_glyph.c | |
parent | 8c58838f6aa98c540e630cc556910f7d465e6507 (diff) |
BLF: Remove Thread Locking For Font Metrics
This patch removes the need to lock the thread just to get to some
generic (not glyph-specific) font metrics.
See D12976 for more details.
Differential Revision: https://developer.blender.org/D12976
Reviewed by Campbell Barton
Diffstat (limited to 'source/blender/blenfont/intern/blf_glyph.c')
-rw-r--r-- | source/blender/blenfont/intern/blf_glyph.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 9170a1c0ac4..c4ffb3f87f1 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -86,27 +86,6 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font) memset(gc->glyph_ascii_table, 0, sizeof(gc->glyph_ascii_table)); memset(gc->bucket, 0, sizeof(gc->bucket)); - gc->ascender = ((float)font->face->size->metrics.ascender) / 64.0f; - gc->descender = ((float)font->face->size->metrics.descender) / 64.0f; - - if (FT_IS_SCALABLE(font->face)) { - gc->glyph_width_max = (int)((float)(font->face->bbox.xMax - font->face->bbox.xMin) * - (((float)font->face->size->metrics.x_ppem) / - ((float)font->face->units_per_EM))); - - gc->glyph_height_max = (int)((float)(font->face->bbox.yMax - font->face->bbox.yMin) * - (((float)font->face->size->metrics.y_ppem) / - ((float)font->face->units_per_EM))); - } - else { - gc->glyph_width_max = (int)(((float)font->face->size->metrics.max_advance) / 64.0f); - gc->glyph_height_max = (int)(((float)font->face->size->metrics.height) / 64.0f); - } - - /* can happen with size 1 fonts */ - CLAMP_MIN(gc->glyph_width_max, 1); - CLAMP_MIN(gc->glyph_height_max, 1); - BLI_addhead(&font->cache, gc); return gc; } @@ -159,7 +138,7 @@ void blf_glyph_cache_free(GlyphCacheBLF *gc) MEM_freeN(gc); } -GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c) +static GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c) { GlyphBLF *p; unsigned int key; |