diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2021-07-28 21:16:04 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2021-07-28 21:16:04 +0300 |
commit | 8aa1c0a326a838528470e79abad3abec343d1c9f (patch) | |
tree | 2f3aeeffdadb80451074c5ccf2eae3aaa6a093b2 /source/blender/blenfont/intern/blf.c | |
parent | 073bf8bf52edbb6f53fb6bbbecc26f20b91e8c43 (diff) |
Fix T75028: Improved Font Names in File Manager
When viewing font files in the File Manager, this patch uses the font's
family and style names to show the same type of string shown to users
in operating system lists. For example "Book Antiqua Regular" instead
of "BKANT.ttf"
see D12020 for details and examples.
Differential Revision: https://developer.blender.org/D12020
Reviewed by Campbell Barton and Julian Eisel
Diffstat (limited to 'source/blender/blenfont/intern/blf.c')
-rw-r--r-- | source/blender/blenfont/intern/blf.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 7428798581d..9168e7aa19c 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -915,6 +915,17 @@ void BLF_draw_buffer(int fontid, const char *str, size_t len) BLF_draw_buffer_ex(fontid, str, len, NULL); } +char *BLF_display_name_from_file(const char *filename) +{ + FontBLF *font = blf_font_new("font_name", filename); + if (!font) { + return NULL; + } + char *name = blf_display_name(font); + blf_font_free(font); + return name; +} + #ifdef DEBUG void BLF_state_print(int fontid) { |