From 524a9e3db8102c89abf3b80cddaea60c314d67ae Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Fri, 17 Jun 2022 10:30:34 -0700 Subject: BLF: Fallback Font Stack Allow use of multiple fonts acting together like a fallback stack, where if a glyph is not found in one it can be retrieved from another. See D12622 for much more detail Differential Revision: https://developer.blender.org/D12622 Reviewed by Brecht Van Lommel --- source/blender/blenlib/intern/string_utf8.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/blenlib/intern') diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index 94efb0dd9e7..0cbf62cce03 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -363,6 +363,10 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, int BLI_wcwidth(char32_t ucs) { + /* Treat private use areas (icon fonts), symbols, and emoticons as double-width. */ + if (ucs >= 0xf0000 || (ucs >= 0xe000 && ucs < 0xf8ff) || (ucs >= 0x1f300 && ucs < 0x1fbff)) { + return 2; + } return mk_wcwidth(ucs); } -- cgit v1.2.3