Set emoji font declaration global for all app

This commit is contained in:
Angela Mazzurco 2017-08-02 18:09:40 +02:00
parent 0a5b3508da
commit 54c8e26fee
2 changed files with 35 additions and 22 deletions

View file

@ -558,4 +558,37 @@ ApplicationWindow
onTriggered: linkCopiedPopup.close()
}
}
FontLoader { id: emojiFont; source: "/fonts/OpenSansEmoji.ttf" }
QtObject
{
id: theme
property var emojiFontName: emojiFont.name
property var supportedEmojiFonts: ["Android Emoji"]
property var rootFontName: emojiFont.name
// If native emoji font exists use it, else use RS emoji font
function selectFont ()
{
var fontFamilies = Qt.fontFamilies()
fontFamilies.some(function (f)
{
if (supportedEmojiFonts.indexOf(f) !== -1)
{
emojiFontName = f
return true
}
return false
})
}
Component.onCompleted:
{
selectFont()
}
}
}