Skip to content

Commit

Permalink
Merge branch 'FirestormViewer:master' into do-not-pull-request
Browse files Browse the repository at this point in the history
  • Loading branch information
AiraYumi authored Mar 10, 2024
2 parents 7e85ec9 + dcde02f commit 7eed189
Show file tree
Hide file tree
Showing 27 changed files with 632 additions and 513 deletions.
838 changes: 367 additions & 471 deletions autobuild.xml

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions indra/llrender/llfontgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1090,16 +1090,30 @@ LLFontGL::VAlign LLFontGL::vAlignFromName(const std::string& name)
}

//static
LLFontGL* LLFontGL::getFontEmoji()
LLFontGL* LLFontGL::getFontEmoji( bool useBW ) // <FS:Beq/> Add B&W emoji font support
{
static LLFontGL* fontp = getFont(LLFontDescriptor("Emoji", "Large", 0));
// <FS:Beq> Add B&W emoji font support
static LLFontGL* fontp_bw = getFont(LLFontDescriptor("EmojiBW", "Large", 0));
if( useBW )
{
return fontp_bw;
}
// </FS:Beq>
return fontp;;
}

//static
LLFontGL* LLFontGL::getFontEmojiHuge()
LLFontGL* LLFontGL::getFontEmojiHuge( bool useBW ) // <FS:Beq/> Add B&W emoji font support
{
static LLFontGL* fontp = getFont(LLFontDescriptor("Emoji", "Huge", 0));
// <FS:Beq> Add B&W emoji font support
static LLFontGL* fontp_bw = getFont(LLFontDescriptor("EmojiBW", "Huge", 0));
if( useBW )
{
return fontp_bw;
}
// </FS:Beq>
return fontp;;
}

Expand Down
4 changes: 2 additions & 2 deletions indra/llrender/llfontgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ class LLFontGL

static void setFontDisplay(BOOL flag) { sDisplayFont = flag; }

static LLFontGL* getFontEmoji();
static LLFontGL* getFontEmojiHuge();
static LLFontGL* getFontEmoji( bool useBW = false ); // <FS:Beq/> Add B&W emoji font support
static LLFontGL* getFontEmojiHuge( bool useBW = false ); // <FS:Beq/> Add B&W emoji font support
static LLFontGL* getFontMonospace();
static LLFontGL* getFontSansSerifSmall();
static LLFontGL* getFontSansSerifSmallBold();
Expand Down
27 changes: 27 additions & 0 deletions indra/llrender/llfontregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
4 changes: 4 additions & 0 deletions indra/llrender/llfontregistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion indra/llui/lltextbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s

// Insert special segments where necessary (insertSegment takes care of splitting normal text segments around them for us)
{
static LLUICachedControl<bool> useBWEmojis("FSUseBWEmojis", false); // <FS:Beq/> Add B&W emoji font support
LLStyleSP emoji_style;
LLEmojiDictionary* ed = LLEmojiDictionary::instanceExists() ? LLEmojiDictionary::getInstance() : NULL;
for (S32 text_kitty = 0, text_len = wstr.size(); text_kitty < text_len; text_kitty++)
Expand All @@ -1064,7 +1065,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::getFontEmoji( useBWEmojis )); // <FS:Beq/> Add B&W emoji font support
}

S32 new_seg_start = pos + text_kitty;
Expand Down
5 changes: 3 additions & 2 deletions indra/llui/lltexteditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,10 @@ void LLTextEditor::selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_p

void LLTextEditor::insertEmoji(llwchar emoji)
{
LL_INFOS() << "LLTextEditor::insertEmoji(" << wchar_utf8_preview(emoji) << ")" << LL_ENDL;
static LLUICachedControl<bool> useBWEmojis( "FSUseBWEmojis", false); // <FS:Beq/> Add B&W emoji font support
LL_DEBUGS("Emoji") << "LLTextEditor::insertEmoji(" << wchar_utf8_preview(emoji) << ")" << LL_ENDL; // <FS:Beq/> reduce Emoji log spam
auto styleParams = LLStyle::Params();
styleParams.font = LLFontGL::getFontEmoji();
styleParams.font = LLFontGL::getFontEmoji( useBWEmojis ); // <FS:Beq/> Add B&W emoji font support
auto segment = new LLEmojiTextSegment(new LLStyle(styleParams), mCursorPos, mCursorPos + 1, *this);
insert(mCursorPos, LLWString(1, emoji), false, segment);
setCursorPos(mCursorPos + 1);
Expand Down
33 changes: 33 additions & 0 deletions indra/newview/app_settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26759,5 +26759,38 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>1</integer>
</map>
<key>FSUseBWEmojis</key>
<map>
<key>Comment</key>
<string>Use Black and White Emojis.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<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>
8 changes: 7 additions & 1 deletion indra/newview/fonts/fonts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -82,6 +83,11 @@
<file>TwemojiSVG.ttf</file>
</font>

<font name="EmojiBW"
comment="Name of emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>

<font name="Monospace"
comment="Name of monospace font">
<file>DejaVuSansMono.ttf</file>
Expand Down
8 changes: 7 additions & 1 deletion indra/newview/fonts/fonts_cascadia_code.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -82,6 +83,11 @@
<file>TwemojiSVG.ttf</file>
</font>

<font name="EmojiBW"
comment="Name of Black and White emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>

<font name="Monospace"
comment="Name of monospace font">
<file>CascadiaCode-Light.ttf</file>
Expand Down
8 changes: 7 additions & 1 deletion indra/newview/fonts/fonts_celestia_medium_redux.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -82,6 +83,11 @@
<file>TwemojiSVG.ttf</file>
</font>

<font name="EmojiBW"
comment="Name of emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>

<font name="Monospace"
comment="Name of monospace font">
<file>DejaVuSansMono.ttf</file>
Expand Down
8 changes: 7 additions & 1 deletion indra/newview/fonts/fonts_deja_vu_all_caps.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -80,6 +81,11 @@
<file>TwemojiSVG.ttf</file>
</font>

<font name="EmojiBW"
comment="Name of emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>

<font name="Monospace"
comment="Name of monospace font">
<file>DejaVuSansAllCapsMono.ttf</file>
Expand Down
8 changes: 7 additions & 1 deletion indra/newview/fonts/fonts_droid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -82,6 +83,11 @@
<file>TwemojiSVG.ttf</file>
</font>

<font name="EmojiBW"
comment="Name of black and white emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>

<font name="Monospace"
comment="Name of monospace font">
<file>DroidSansMono.ttf</file>
Expand Down
8 changes: 7 additions & 1 deletion indra/newview/fonts/fonts_dyslexia.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -82,6 +83,11 @@
<file>TwemojiSVG.ttf</file>
</font>

<font name="EmojiBW"
comment="Name of emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>

<font name="Monospace"
comment="Name of monospace font">
<file>SourceCodePro-Regular.ttf</file>
Expand Down
8 changes: 7 additions & 1 deletion indra/newview/fonts/fonts_liberation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -82,6 +83,11 @@
<file>TwemojiSVG.ttf</file>
</font>

<font name="EmojiBW"
comment="Name of emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>

<font name="Monospace"
comment="Name of monospace font">
<file>LiberationMono-Regular.ttf</file>
Expand Down
8 changes: 7 additions & 1 deletion indra/newview/fonts/fonts_mobi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -82,6 +83,11 @@
<file>TwemojiSVG.ttf</file>
</font>

<font name="EmojiBW"
comment="Name of emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>

<font name="Monospace"
comment="Name of monospace font">
<file>MobiSansMono.ttf</file>
Expand Down
8 changes: 7 additions & 1 deletion indra/newview/fonts/fonts_noto.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -82,6 +83,11 @@
<file>TwemojiSVG.ttf</file>
</font>

<font name="EmojiBW"
comment="Name of emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>

<font name="Monospace"
comment="Name of monospace font">
<file>NotoMono-Regular.ttf</file>
Expand Down
8 changes: 7 additions & 1 deletion indra/newview/fonts/fonts_roboto.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -82,6 +83,11 @@
<file>TwemojiSVG.ttf</file>
</font>

<font name="EmojiBW"
comment="Name of emoji font">
<file>NotoEmoji-Regular.ttf</file>
</font>

<font name="Monospace"
comment="Name of monospace font">
<file>MobiSansMono.ttf</file>
Expand Down
Loading

0 comments on commit 7eed189

Please sign in to comment.