Setting the contents of a QLabel to display colored emojis using emojione with HTML span attributes causes issues on linux with hidpi displays: emojis images are corrupted (only displaying a quarter of the full emoji) and the program quickly crashes with a segfault.
Disabling HiDpi scaling with `Qt::AA_DisableHighDpiScaling` prevents both the crash and the rendering issues. So does using system fonts instead of emojione (but thus emojis are displayed non-colored).
Small reproducing example:
#include <QApplication>
#include <QFontDatabase>
#include <QLabel>
int main(int argc, char *argv[])
{
//QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
QApplication a(argc, argv);
QFontDatabase::addApplicationFont("./emojione-android.ttf");
QLabel label;
label.setText("Hello world <span style=\"font-family: Noto Color Emoji;\">\U0001F609</span>");
label.show();
return a.exec();
}
(this example uses the emojione android font ("Noto Color Emoji") that can be downloaded here: https://github.com/emojione/emojione-assets/releases/download/3.1.2/emojione-android.ttf )
On the above example, uncommenting the first line of main prevents the crash.
- is duplicated by
-
QTBUG-59022 segfault displaying emoji in label
-
- Closed
-