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>2019-05-01 18:22:32 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-01 19:05:01 +0300
commit374728293274530d324a8eee53e3cfcce13f7884 (patch)
tree803cf650a2ec3afd14a7bade57d2a1025d37a0be /source/blender/blenfont
parent0a80be40e3b1a513b18d2c1e7a95346de7bad7d2 (diff)
UI: use Mac key symbols in menus on macOS, instead of text like "Cmd"
On Windows "Cmd" is also replaced with "Win". Differential Revision: https://developer.blender.org/D4689
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/BLF_api.h3
-rw-r--r--source/blender/blenfont/intern/blf.c11
2 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index 60b27ead968..359ec9cc49e 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -53,6 +53,9 @@ int BLF_load_mem_unique(const char *name, const unsigned char *mem, int mem_size
void BLF_unload(const char *name) ATTR_NONNULL();
void BLF_unload_id(int fontid);
+/* Check if font supports a particular glyph */
+bool BLF_has_glyph(int fontid, const char *utf8);
+
/* Attach a file with metrics information from memory. */
void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size);
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index d16a4d7ed4d..17799aea14d 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -41,6 +41,7 @@
#include "DNA_vec_types.h"
#include "BLI_math.h"
+#include "BLI_string_utf8.h"
#include "BLI_threads.h"
#include "BLF_api.h"
@@ -188,6 +189,16 @@ int BLF_default(void)
return global_font_default;
}
+bool BLF_has_glyph(int fontid, const char *utf8)
+{
+ FontBLF *font = blf_get(fontid);
+ if (font) {
+ unsigned int unicode = BLI_str_utf8_as_unicode(utf8);
+ return FT_Get_Char_Index(font->face, unicode) != 0;
+ }
+ return false;
+}
+
int BLF_load(const char *name)
{
FontBLF *font;