Set emoji size relative to the default font

This commit is contained in:
Konstantinos Sideris 2017-07-01 14:03:00 +03:00
parent 730a56f58e
commit 0ed2350664
2 changed files with 8 additions and 1 deletions

View File

@ -73,6 +73,9 @@ private:
const int AvatarSize = 36;
const float TimestampFontRatio = 0.8;
const float EmojiFontRatio = 1.4;
float EmojiSize = 13;
Avatar *userAvatar_;

View File

@ -44,6 +44,8 @@ void TimelineItem::init()
const int baseWidth = fm.width('A');
MessageMargin = baseWidth * 1.5;
EmojiSize = this->font().pointSize() * EmojiFontRatio;
topLayout_ = new QHBoxLayout(this);
sideLayout_ = new QVBoxLayout();
mainLayout_ = new QVBoxLayout();
@ -289,7 +291,9 @@ QString TimelineItem::replaceEmoji(const QString &body)
// TODO: Be more precise here.
if (code > 9000)
fmtBody += "<span style=\"font-family: Emoji One; font-size: 14px\">" + QString(c) + "</span>";
fmtBody += QString("<span style=\"font-family: Emoji One; font-size: %1px\">").arg(EmojiSize) +
QString(c) +
"</span>";
else
fmtBody += c;
}