Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.7.2
-
None
-
Kubuntu 22.04. Noto Sans 10pt as System font
Description
A string containing at least the two characters 🏡 and ☕ results in a bounding box with a far to small width. Other methods seem to provide the correct width.
Example QWidgets Program:
#include <QApplication> #include <QFontMetrics> #include <QPainter> #include <QWidget> class TestWidget : public QWidget { public: using QWidget::QWidget; protected: void paintEvent(QPaintEvent *event) { QString text = "🏡☕"; QPainter painter{ this }; QFontMetrics metric{ painter.font(), this }; QRect box = metric.boundingRect(text); painter.fillRect(100 + box.x(), 100 + box.y(), box.width(), box.height(), QColor{ "lightgreen" }); painter.drawText(100, 100, text); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); TestWidget widget; widget.show(); return a.exec(); }