mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +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 int AvatarSize = 36;
|
||||||
const float TimestampFontRatio = 0.8;
|
const float TimestampFontRatio = 0.8;
|
||||||
|
const float EmojiFontRatio = 1.4;
|
||||||
|
|
||||||
|
float EmojiSize = 13;
|
||||||
|
|
||||||
Avatar *userAvatar_;
|
Avatar *userAvatar_;
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ void TimelineItem::init()
|
||||||
const int baseWidth = fm.width('A');
|
const int baseWidth = fm.width('A');
|
||||||
MessageMargin = baseWidth * 1.5;
|
MessageMargin = baseWidth * 1.5;
|
||||||
|
|
||||||
|
EmojiSize = this->font().pointSize() * EmojiFontRatio;
|
||||||
|
|
||||||
topLayout_ = new QHBoxLayout(this);
|
topLayout_ = new QHBoxLayout(this);
|
||||||
sideLayout_ = new QVBoxLayout();
|
sideLayout_ = new QVBoxLayout();
|
||||||
mainLayout_ = new QVBoxLayout();
|
mainLayout_ = new QVBoxLayout();
|
||||||
|
@ -289,7 +291,9 @@ QString TimelineItem::replaceEmoji(const QString &body)
|
||||||
|
|
||||||
// TODO: Be more precise here.
|
// TODO: Be more precise here.
|
||||||
if (code > 9000)
|
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
|
else
|
||||||
fmtBody += c;
|
fmtBody += c;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue