mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Set emoji size relative to the default font
This commit is contained in:
parent
730a56f58e
commit
0ed2350664
2 changed files with 8 additions and 1 deletions
|
@ -73,6 +73,9 @@ private:
|
|||
|
||||
const int AvatarSize = 36;
|
||||
const float TimestampFontRatio = 0.8;
|
||||
const float EmojiFontRatio = 1.4;
|
||||
|
||||
float EmojiSize = 13;
|
||||
|
||||
Avatar *userAvatar_;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue