summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanos Doukoudakis <thanos.doukoudakis@isode.com>2018-04-16 09:59:34 (GMT)
committerKevin Smith <kevin.smith@isode.com>2018-05-10 08:13:57 (GMT)
commit4663da31954d989f8535b94c4a78a0f4515542a4 (patch)
treeaa6cf7a359ed0e61e038f3f518581bc9351d52f9 /Swift/QtUI/QtEmojiCell.cpp
parent8fab33012e5ac7c03ab00ec30118dcb2c5218051 (diff)
downloadswift-4663da31954d989f8535b94c4a78a0f4515542a4.zip
swift-4663da31954d989f8535b94c4a78a0f4515542a4.tar.bz2
Enable Emojis on Windows and Linux
This patch enables emojis for Linux and Windows. In windows, currently the emojis are only black and white, due to some inconsistencies in the UI. For Linux the Noto Colour Emoji font (https://www.google.com/get/noto/) is used. The client must be build with Qt 5.6 or newer to support the emoji characters. Test-Information: Tested the changes with Qt 5.8 on Windows 10 and Linux Ubuntu 17.10. Built and tested the appimage on Ubuntu 17.10 and Ubuntu 16.04. Change-Id: I6d0f2842349eae789d773c33d1a93ad33304df3e
Diffstat (limited to 'Swift/QtUI/QtEmojiCell.cpp')
-rw-r--r--Swift/QtUI/QtEmojiCell.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/Swift/QtUI/QtEmojiCell.cpp b/Swift/QtUI/QtEmojiCell.cpp
index 865f1f6..106e968 100644
--- a/Swift/QtUI/QtEmojiCell.cpp
+++ b/Swift/QtUI/QtEmojiCell.cpp
@@ -1,11 +1,13 @@
/*
- * Copyright (c) 2016-2017 Isode Limited.
+ * Copyright (c) 2016-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swift/QtUI/QtEmojiCell.h>
+#include <Swiften/Base/Platform.h>
+
#include <QFont>
#include <QFontMetrics>
#include <QPushButton>
@@ -17,13 +19,20 @@ namespace Swift {
QtEmojiCell::QtEmojiCell(QString shortname, QString text, QWidget* parent) : QPushButton(parent) {
setText(text);
QFont font = this->font();
+#ifdef SWIFTEN_PLATFORM_WINDOWS
+ //Windows emoji font miscalculates the bounding rectangular that surrounds the emoji. We set a multiplier value to make it look consistent with linux & Mac
+ const float sizeMultiplier = 1.3;
+ font.setPointSize(18);
+#else
font.setPointSize(22);
+ const float sizeMultiplier = 1;
+#endif
font.setBold(true);
setFont(font);
const auto boundingRect = fontMetrics().boundingRect("\xF0\x9F\x98\x83");
- setFixedWidth(qMax(boundingRect.width(), boundingRect.height()));
- setFixedHeight(qMax(boundingRect.width(), boundingRect.height()));
+ setFixedWidth(qMax(sizeMultiplier*boundingRect.width(), sizeMultiplier*boundingRect.height()));
+ setFixedHeight(qMax(sizeMultiplier*boundingRect.width(), sizeMultiplier*boundingRect.height()));
setFlat(true);
setToolTip(shortname);