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:
authorHarley Acheson <harley.acheson@gmail.com>2020-06-06 01:39:17 +0300
committerHarley Acheson <harley.acheson@gmail.com>2020-06-06 01:39:17 +0300
commitb74cc23dc478f2c4260e2e4269c8450e3d5c450e (patch)
treee540058bab2816422cff19043ffb1766a804f6e8 /source/blender/blenfont/intern/blf_thumbs.c
parentfc672ce8e24e5fc62a42010dad790324f2b99a2d (diff)
UI: Ability to Print Bold and Italics
Adds the ability to print text in bold or italics style, synthesized from a single base UI font. Differential Revision: https://developer.blender.org/D7893 Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/blenfont/intern/blf_thumbs.c')
-rw-r--r--source/blender/blenfont/intern/blf_thumbs.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/blenfont/intern/blf_thumbs.c b/source/blender/blenfont/intern/blf_thumbs.c
index 37eed29f6fe..6aa39e3aa71 100644
--- a/source/blender/blenfont/intern/blf_thumbs.c
+++ b/source/blender/blenfont/intern/blf_thumbs.c
@@ -66,6 +66,7 @@ void BLF_thumb_preview(const char *filename,
int font_shrink = 4;
FontBLF *font;
+ GlyphCacheBLF *gc;
int i;
/* Create a new blender font obj and fill it with default values */
@@ -96,9 +97,9 @@ void BLF_thumb_preview(const char *filename,
int draw_str_i18n_nbr = 0;
blf_font_size(font, (unsigned int)MAX2(font_size_min, font_size_curr), dpi);
-
- /* font->glyph_cache remains NULL if blf_font_size() failed to set font size */
- if (!font->glyph_cache) {
+ gc = blf_glyph_cache_find(font, font->size, font->dpi);
+ /* There will be no matching glyph cache if blf_font_size() failed to set font size. */
+ if (!gc) {
break;
}
@@ -106,7 +107,7 @@ void BLF_thumb_preview(const char *filename,
font_size_curr -= (font_size_curr / font_shrink);
font_shrink += 1;
- font->pos[1] -= font->glyph_cache->ascender * 1.1f;
+ font->pos[1] -= gc->ascender * 1.1f;
/* We fallback to default english strings in case not enough chars are available in current
* font for given translated string (useful in non-latin i18n context, like Chinese,