From 27dd9ee482f7f69651d44f8c7114a22ff761c013 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 28 Feb 2024 23:19:46 +0100 Subject: [PATCH 1/2] triage#86 Use Emoji font in LineEditor by default --- indra/llrender/llfontgl.cpp | 16 +++++++++++++++- indra/llrender/llfontgl.h | 6 ++++-- indra/llui/lllineeditor.cpp | 2 +- indra/llui/lltextbase.cpp | 2 +- indra/llui/lltexteditor.cpp | 2 +- indra/llui/lluictrl.cpp | 2 +- indra/newview/llfloateremojipicker.cpp | 6 +++--- .../skins/default/xui/en/widgets/line_editor.xml | 2 +- 8 files changed, 27 insertions(+), 11 deletions(-) diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 53661b6a63..5ae691f6fd 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -1030,7 +1030,21 @@ LLFontGL::VAlign LLFontGL::vAlignFromName(const std::string& name) } //static -LLFontGL* LLFontGL::getFontEmoji() +LLFontGL* LLFontGL::getFontEmojiSmall() +{ + static LLFontGL* fontp = getFont(LLFontDescriptor("Emoji", "Small", 0)); + return fontp;; +} + +//static +LLFontGL* LLFontGL::getFontEmojiMedium() +{ + static LLFontGL* fontp = getFont(LLFontDescriptor("Emoji", "Medium", 0)); + return fontp;; +} + +//static +LLFontGL* LLFontGL::getFontEmojiLarge() { static LLFontGL* fontp = getFont(LLFontDescriptor("Emoji", "Large", 0)); return fontp;; diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index f6ec416c8b..1ab38b3306 100644 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -193,8 +193,10 @@ public: static LLFontGL::VAlign vAlignFromName(const std::string& name); static void setFontDisplay(BOOL flag) { sDisplayFont = flag; } - - static LLFontGL* getFontEmoji(); + + static LLFontGL* getFontEmojiSmall(); + static LLFontGL* getFontEmojiMedium(); + static LLFontGL* getFontEmojiLarge(); static LLFontGL* getFontEmojiHuge(); static LLFontGL* getFontMonospace(); static LLFontGL* getFontSansSerifSmall(); diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 1928c0157e..0643680277 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -96,7 +96,7 @@ LLLineEditor::Params::Params() commit_on_focus_lost("commit_on_focus_lost", true), ignore_tab("ignore_tab", true), is_password("is_password", false), - allow_emoji("allow_emoji"), + allow_emoji("allow_emoji", true), cursor_color("cursor_color"), use_bg_color("use_bg_color", false), bg_color("bg_color"), diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 7ccf025a19..7b57c7e5b8 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -915,7 +915,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s if (!emoji_style) { emoji_style = new LLStyle(getStyleParams()); - emoji_style->setFont(LLFontGL::getFontEmoji()); + emoji_style->setFont(LLFontGL::getFontEmojiLarge()); } S32 new_seg_start = pos + text_kitty; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index a247e8700a..e9ddc6cf0b 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -685,7 +685,7 @@ void LLTextEditor::insertEmoji(llwchar emoji) { LL_INFOS() << "LLTextEditor::insertEmoji(" << wchar_utf8_preview(emoji) << ")" << LL_ENDL; auto styleParams = LLStyle::Params(); - styleParams.font = LLFontGL::getFontEmoji(); + styleParams.font = LLFontGL::getFontEmojiLarge(); auto segment = new LLEmojiTextSegment(new LLStyle(styleParams), mCursorPos, mCursorPos + 1, *this); insert(mCursorPos, LLWString(1, emoji), false, segment); setCursorPos(mCursorPos + 1); diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 7eb9ae69fb..c7fcbaec1c 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -80,7 +80,7 @@ LLUICtrl::Params::Params() mouseenter_callback("mouseenter_callback"), mouseleave_callback("mouseleave_callback"), control_name("control_name"), - font("font", LLFontGL::getFontSansSerif()), + font("font", LLFontGL::getFontEmojiMedium()), font_halign("halign"), font_valign("valign"), length("length"), // ignore LLXMLNode cruft diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index 1578caa39c..79d118bc8a 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -138,7 +138,7 @@ public: F32 x = getRect().getWidth() / 2; F32 y = getRect().getHeight() / 2; - LLFontGL::getFontEmoji()->render( + LLFontGL::getFontEmojiLarge()->render( mText, // wstr 0, // begin_offset x, // x @@ -229,7 +229,7 @@ protected: { F32 x0 = x; F32 x1 = max_pixels; - LLFontGL* font = LLFontGL::getFontEmoji(); + LLFontGL* font = LLFontGL::getFontEmojiLarge(); if (mBegin) { std::string text = mTitle.substr(0, mBegin); @@ -423,7 +423,7 @@ void LLFloaterEmojiPicker::fillGroups() mGroupButtons.clear(); LLButton::Params params; - params.font = LLFontGL::getFontEmoji(); + params.font = LLFontGL::getFontEmojiLarge(); LLRect rect; rect.mTop = mGroups->getRect().getHeight(); diff --git a/indra/newview/skins/default/xui/en/widgets/line_editor.xml b/indra/newview/skins/default/xui/en/widgets/line_editor.xml index f39e086196..229718adb3 100644 --- a/indra/newview/skins/default/xui/en/widgets/line_editor.xml +++ b/indra/newview/skins/default/xui/en/widgets/line_editor.xml @@ -15,5 +15,5 @@ preedit_bg_color="White" mouse_opaque="true" name="line_editor" - font="SansSerifSmall"> + font="EmojiSmall"> From a6e1f22a993fde79d0ecb76d60535fdc454a2acd Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Tue, 5 Mar 2024 14:14:01 +0100 Subject: [PATCH 2/2] jira#71179 Use Emoji font in ScrollList by default --- indra/llui/llscrolllistcell.h | 2 +- indra/llui/llscrolllistctrl.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index 2588da2331..117489fead 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -81,7 +81,7 @@ public: alt_value("alt_value", ""), label("label"), tool_tip("tool_tip", ""), - font("font", LLFontGL::getFontSansSerifSmall()), + font("font", LLFontGL::getFontEmojiSmall()), font_color("font_color", LLColor4::black), color("color", LLColor4::white), font_halign("halign", LLFontGL::LEFT) diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index f982dc99e8..2a6e33fff6 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1810,7 +1810,7 @@ BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask) // display tooltip exactly over original cell, in same font LLToolTipMgr::instance().show(LLToolTip::Params() .message(hit_cell->getToolTip()) - .font(LLFontGL::getFontSansSerifSmall()) + .font(LLFontGL::getFontEmojiSmall()) .pos(LLCoordGL(sticky_rect.mLeft - 5, sticky_rect.mTop + 6)) .delay_time(0.2f) .sticky_rect(sticky_rect)); @@ -3294,7 +3294,7 @@ LLScrollListItem* LLScrollListCtrl::addSimpleElement(const std::string& value, E item_params.value(entry_id); item_params.columns.add() .value(value) - .font(LLFontGL::getFontSansSerifSmall()); + .font(LLFontGL::getFontEmojiSmall()); return addRow(item_params, pos); }