summaryrefslogtreecommitdiff
path: root/indra/llcommon/llstring.cpp
diff options
context:
space:
mode:
authorHenri Beauchamp <sldev@free.fr>2024-03-13 13:57:39 +0100
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-03-14 01:47:14 +0200
commit2f452d06e6964b0edf26b0b3f6eaa156e3fa2d48 (patch)
tree18019a0f11af858e2f76ca19908bc7fc27bb8741 /indra/llcommon/llstring.cpp
parent6ed3a1670cc976975942c1c7e57fb30298669ab7 (diff)
Proposal #2 to restore how UI/dialogs used to render by prioritizing fallback fonts.
With the emojis support, a new font was added, which not only provides emojis but also fancy colorful replacements for UTF-8 characters that used to be supported by our fallback (monochrome) fonts: this causes discrepancies and unwanted/undesired changes in scripted objects menus (e.g. an empty circle or square may render as a black, full one, a heart may render red instead of white), not to mention the larger font size used by the emoji characters... This patch restores the aspect of such menus/dialogs/UI elements with UTF-8 characters that *are* supported by the usual fallback fonts (fonts which may also vary from one viewer to another, and from one OS to another), so that everything keeps working/rendering as it always did so far, while not impairing the use of new colorful emojis. This second proposal ensures that: - "genuine" emojis (in the 0x1f000-0x1ffff range), will *always* be rendered using the new emojis font (this solves, for example, the monochrome "yellow faces" issue seen with some characters in my first proposal). - Special UTF-8 characters (in the 0x2000-0x32FF range) which have been used by scripters so far, will render as they used to, using the monochrome fallback fonts (this repairs scripted dialogs menus). - Remaining special characters, that do not have a corresponding glyph in the monochrome font, but do have one in the emojis font, will use the latter font to render. It also got the nice side-effect of removing the dependency on the ICU4C library. Note however that the recent commit: https://github.com/secondlife/viewer/commit/326055ba82c22fedde186c6a56bafd4fe87e613a will need to be reverted to allow this patch to actually fix scripted dialogs. Also, some cleanup might be needed in skins/default/xui/*/emoji_characters.xml to remove from it the special UTF-8 characters that will no longer be rendered with fanciful colors, but instead with the monochrome font glyphs.
Diffstat (limited to 'indra/llcommon/llstring.cpp')
-rw-r--r--indra/llcommon/llstring.cpp41
1 files changed, 9 insertions, 32 deletions
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index 4aa54bb12d..28c2ec5b39 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -30,7 +30,6 @@
#include "llerror.h"
#include "llfasttimer.h"
#include "llsd.h"
-#include <unicode/uchar.h>
#include <vector>
#if LL_WINDOWS
@@ -1008,40 +1007,18 @@ std::string LLStringOps::sAM;
std::string LLStringOps::sPM;
// static
-bool LLStringOps::isEmoji(llwchar wch)
-{
- int ublock = ublock_getCode(wch);
- switch (ublock)
- {
- case UBLOCK_GENERAL_PUNCTUATION:
- case UBLOCK_LETTERLIKE_SYMBOLS:
- case UBLOCK_ARROWS:
- case UBLOCK_MISCELLANEOUS_TECHNICAL:
- case UBLOCK_ENCLOSED_ALPHANUMERICS:
- case UBLOCK_GEOMETRIC_SHAPES:
- case UBLOCK_MISCELLANEOUS_SYMBOLS:
- case UBLOCK_DINGBATS:
- case UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION:
- case UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS:
- case UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS:
- case UBLOCK_EMOTICONS:
- case UBLOCK_TRANSPORT_AND_MAP_SYMBOLS:
-#if U_ICU_VERSION_MAJOR_NUM > 56
- // Boost uses ICU so we can't update it independently
- case UBLOCK_SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS:
-#endif // U_ICU_VERSION_MAJOR_NUM > 56
- return true;
- default:
-#if U_ICU_VERSION_MAJOR_NUM > 56
- return false;
+bool LLStringOps::isEmoji(llwchar a)
+{
+#if 0 // Do not consider special characters that might have a corresponding
+ // glyph in the monochorme fallback fonts as a "genuine" emoji. HB
+ return a == 0xa9 || a == 0xae || (a >= 0x2000 && a < 0x3300) ||
+ (a >= 0x1f000 && a < 0x20000);
#else
- // See https://en.wikipedia.org/wiki/Supplemental_Symbols_and_Pictographs
- return wch >= 0x1F900 && wch <= 0x1F9FF;
-#endif // U_ICU_VERSION_MAJOR_NUM > 56
- }
+ // These are indeed "genuine" emojis, we *do want* rendered as such. HB
+ return a >= 0x1f000 && a < 0x20000;
+#endif
}
-
S32 LLStringOps::collate(const llwchar* a, const llwchar* b)
{
#if LL_WINDOWS