support user selected b&w/colour in fallback rendering.+ emoji button

Allow emoji in button text on emoji picker (visually shows the mono/colour mode)
debug setting allows user to pic a custom label cos why not.
master
Beq 2024-03-10 02:57:50 +00:00
parent 425da225a6
commit 6b3339609e
20 changed files with 125 additions and 39 deletions

View File

@ -47,8 +47,35 @@ bool init_from_xml(LLFontRegistry* registry, LLXMLNodePtr node);
const std::string MACOSX_FONT_PATH_LIBRARY = "/Library/Fonts/";
const std::string MACOSX_FONT_SUPPLEMENTAL = "Supplemental/";
// <FS:Beq> font functors with UI control access
static bool isEmojiUseBW(llwchar wch)
{
static LLCachedControl<bool> emoji_use_bw(gSavedSettings, "FSUseEmojiBW", false);
if(emoji_use_bw)
{
return (LLStringOps::isEmoji(wch));
}
return false;
}
// static
static bool isEmojiUseColor(llwchar wch)
{
static LLCachedControl<bool> emoji_use_bw(gSavedSettings, "FSUseEmojiBW", false);
if(!emoji_use_bw)
{
return (LLStringOps::isEmoji(wch));
}
return false;
}
// </FS:Beq>
LLFontDescriptor::char_functor_map_t LLFontDescriptor::mCharFunctors({
{ "is_emoji", LLStringOps::isEmoji }
, { "is_emoji_use_color", isEmojiUseColor }
, { "is_emoji_use_bw", isEmojiUseBW }
});
LLFontDescriptor::LLFontDescriptor():

View File

@ -34,6 +34,10 @@ class LLFontGL;
typedef std::vector<std::string> string_vec_t;
// <FS:Beq> preference aware font functors
static bool isEmojiUseBW(llwchar wch);
static bool isEmojiUseColor(llwchar wch);
// </FS:Beq>
struct LLFontFileInfo
{
LLFontFileInfo(const std::string& file_name, const std::function<bool(llwchar)>& char_functor = nullptr)

View File

@ -26770,5 +26770,27 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>1</integer>
</map>
<key>FSUsePrettyEmojiButton</key>
<map>
<key>Comment</key>
<string>Use an emoji for the emoji button.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FSPrettyEmojiButtonCode</key>
<map>
<key>Comment</key>
<string>Decimal code for the emoji button. Try 128569 or 128571 for example</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>128578</integer>
</map>
</map>
</llsd>

View File

@ -3,7 +3,8 @@
<font name="default" comment="default font files (global fallbacks)">
<file>DejaVuSans.ttf</file>
<file functor="is_emoji">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_color">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_bw">NotoEmoji-Regular.ttf</file>
<os name="Windows">
<file>meiryo.TTC</file>
<file>YuGothR.ttc</file>

View File

@ -3,7 +3,8 @@
<font name="default" comment="default font files (global fallbacks)">
<file>CascadiaCode-Light.ttf</file>
<file functor="is_emoji">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_color">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_bw">NotoEmoji-Regular.ttf</file>
<os name="Windows">
<file>meiryo.TTC</file>
<file>YuGothR.ttc</file>
@ -83,15 +84,7 @@
</font>
<font name="EmojiBW"
comment="Name of emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>
<font name="EmojiBW"
comment="Name of emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>
<font name="EmojiBW"
comment="Name of B and W emoji font">
comment="Name of Black and White emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>

View File

@ -3,7 +3,8 @@
<font name="default" comment="default font files (global fallbacks)">
<file>CelestiaMediumRedux1.55.ttf</file>
<file functor="is_emoji">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_color">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_bw">NotoEmoji-Regular.ttf</file>
<os name="Windows">
<file>meiryo.TTC</file>
<file>YuGothR.ttc</file>

View File

@ -3,7 +3,8 @@
<font name="default" comment="default font files (global fallbacks)">
<file>DejaVuSansAllCaps.ttf</file>
<file functor="is_emoji">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_color">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_bw">NotoEmoji-Regular.ttf</file>
<os name="Windows">
<file>meiryo.TTC</file>
<file>YuGothR.ttc</file>

View File

@ -3,7 +3,8 @@
<font name="default" comment="default font files (global fallbacks)">
<file>DroidSans.ttf</file>
<file functor="is_emoji">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_color">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_bw">NotoEmoji-Regular.ttf</file>
<os name="Windows">
<file>meiryo.TTC</file>
<file>YuGothR.ttc</file>

View File

@ -3,7 +3,8 @@
<font name="default" comment="default font files (global fallbacks)">
<file>MobiSans.ttf</file>
<file functor="is_emoji">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_color">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_bw">NotoEmoji-Regular.ttf</file>
<os name="Windows">
<file>meiryo.TTC</file>
<file>YuGothR.ttc</file>

View File

@ -3,7 +3,8 @@
<font name="default" comment="default font files (global fallbacks)">
<file>LiberationSans-Regular.ttf</file>
<file functor="is_emoji">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_color">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_bw">NotoEmoji-Regular.ttf</file>
<os name="Windows">
<file>meiryo.TTC</file>
<file>YuGothR.ttc</file>

View File

@ -3,7 +3,8 @@
<font name="default" comment="default font files (global fallbacks)">
<file>MobiSans.ttf</file>
<file functor="is_emoji">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_color">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_bw">NotoEmoji-Regular.ttf</file>
<os name="Windows">
<file>meiryo.TTC</file>
<file>YuGothR.ttc</file>

View File

@ -3,7 +3,8 @@
<font name="default" comment="default font files (global fallbacks)">
<file>NotoSans.ttf</file>
<file functor="is_emoji">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_color">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_bw">NotoEmoji-Regular.ttf</file>
<os name="Windows">
<file>meiryo.TTC</file>
<file>YuGothR.ttc</file>

View File

@ -3,7 +3,8 @@
<font name="default" comment="default font files (global fallbacks)">
<file>DroidSans.ttf</file>
<file functor="is_emoji">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_color">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_bw">NotoEmoji-Regular.ttf</file>
<os name="Windows">
<file>meiryo.TTC</file>
<file>YuGothR.ttc</file>

View File

@ -3,7 +3,8 @@
<font name="default" comment="default font files (global fallbacks)">
<file>Ubuntu-R.ttf</file>
<file functor="is_emoji">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_color">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_bw">NotoEmoji-Regular.ttf</file>
<os name="Windows">
<file>meiryo.TTC</file>
<file>YuGothR.ttc</file>

View File

@ -972,7 +972,21 @@ BOOL FSFloaterIM::postBuild()
mEmojiRecentIconsCtrl->setCommitCallback([this](LLUICtrl*, const LLSD& value) { onRecentEmojiPicked(value); });
mEmojiRecentIconsCtrl->setVisible(false);
static bool usePrettyEmojiButton = gSavedSettings.getBOOL( "FSUsePrettyEmojiButton" );
static bool useBWEmojis = gSavedSettings.getBOOL( "FSUseBWEmojis" );
mEmojiPickerToggleBtn = getChild<LLButton>("emoji_picker_toggle_btn");
if (usePrettyEmojiButton)
{
static auto emoji_btn_char = gSavedSettings.getU32("FSPrettyEmojiButtonCode");
mEmojiPickerToggleBtn->setImageOverlay(LLUUID::null);
mEmojiPickerToggleBtn->setFont(LLFontGL::getFontEmoji(useBWEmojis));
mEmojiPickerToggleBtn->setLabel(LLUIString(LLWString(1, emoji_btn_char)));
}
else
{
mEmojiPickerToggleBtn->setLabel(LLUIString(""));
mEmojiPickerToggleBtn->setImageOverlay("Emoji_Picker_Icon");
}
mEmojiPickerToggleBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onEmojiPickerToggleBtnClicked(); });
mRecentEmojisUpdatedCallbackConnection = LLFloaterEmojiPicker::setRecentEmojisUpdatedCallback([this](const std::list<llwchar>& recent_emojis_list) { initEmojiRecentPanel(); });

View File

@ -161,7 +161,21 @@ BOOL FSFloaterNearbyChat::postBuild()
mEmojiRecentIconsCtrl->setCommitCallback([this](LLUICtrl*, const LLSD& value) { onRecentEmojiPicked(value); });
mEmojiRecentIconsCtrl->setVisible(false);
static bool usePrettyEmojiButton = gSavedSettings.getBOOL( "FSUsePrettyEmojiButton" );
static bool useBWEmojis = gSavedSettings.getBOOL( "FSUseBWEmojis" );
mEmojiPickerToggleBtn = getChild<LLButton>("emoji_picker_toggle_btn");
if (usePrettyEmojiButton)
{
static auto emoji_btn_char = gSavedSettings.getU32("FSPrettyEmojiButtonCode");
mEmojiPickerToggleBtn->setImageOverlay(LLUUID::null);
mEmojiPickerToggleBtn->setFont(LLFontGL::getFontEmoji(useBWEmojis));
mEmojiPickerToggleBtn->setLabel(LLUIString(LLWString(1, emoji_btn_char)));
}
else
{
mEmojiPickerToggleBtn->setLabel(LLUIString(""));
mEmojiPickerToggleBtn->setImageOverlay("Emoji_Picker_Icon");
}
mEmojiPickerToggleBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onEmojiPickerToggleBtnClicked(); });
mRecentEmojisUpdatedCallbackConnection = LLFloaterEmojiPicker::setRecentEmojisUpdatedCallback([this](const std::list<llwchar>& recent_emojis_list) { initEmojiRecentPanel(); });

View File

@ -655,27 +655,27 @@
auto_resize="false"
user_resize="false"
name="emoji_button_layout_panel"
width="35"
top="0"
bottom="-1">
width="37">
<button
follows="right|bottom"
bottom="23"
height="22"
bottom="-1"
height="24"
width="27"
font="EmojiBWLarge"
use_font_color="true"
font="EmojiLarge"
image_hover_unselected="Toolbar_Middle_Over"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
image_overlay="Emoji_Picker_Icon"
right="-11"
label=""
left="0"
name="emoji_picker_toggle_btn"
tool_tip="Show emoji panel"
width="24"/>
/>
<button
follows="right|bottom"
bottom="23"
height="22"
bottom="-1"
height="24"
use_font_color="true"
font="EmojiLarge"
image_hover_unselected="Toolbar_Middle_Over"

View File

@ -276,24 +276,26 @@
auto_resize="false"
user_resize="false"
name="emoji_button_layout_panel"
width="35">
width="37">
<button
follows="right|bottom"
bottom="-1"
height="22"
font="EmojiLarge"
height="24"
width ="27"
font="EmojiBWLarge"
image_hover_unselected="Toolbar_Middle_Over"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
image_overlay="Emoji_Picker_Icon"
right="-11"
label=""
left="0"
name="emoji_picker_toggle_btn"
tool_tip="Show emoji panel"
width="24"/>
/>
<button
follows="right|bottom"
bottom="-1"
height="22"
height="24"
use_font_color="true"
font="EmojiLarge"
image_hover_unselected="Toolbar_Middle_Over"

View File

@ -3,7 +3,8 @@
<font name="default" comment="default font files (global fallbacks)">
<file>DejaVuSans.ttf</file>
<file functor="is_emoji">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_color">TwemojiSVG.ttf</file>
<file functor="is_emoji_use_bw">NotoEmoji-Regular.ttf</file>
<os name="Windows">
<file>MSNeoGothic.ttf</file>
<file>meiryo.TTC</file>

View File

@ -1812,7 +1812,7 @@ Default 0. Larger values may not work well.
follows="left|top"
name="emoji_font_settings_label"
width="120">
Emoji Font Settings:
Emoji Font Settings: (restart required for full effect)
</text>
<check_box
control_name="FSUseBWEmojis"
@ -1907,4 +1907,3 @@ Default 0. Larger values may not work well.
</panel>
</tab_container>
</panel>