diff --git a/ui/style/style_core_font.cpp b/ui/style/style_core_font.cpp index 55fb7cc..4ca722c 100644 --- a/ui/style/style_core_font.cpp +++ b/ui/style/style_core_font.cpp @@ -17,7 +17,6 @@ #include #include #include -#include void style_InitFontsResource() { #ifdef Q_OS_MAC // Use resources from the .app bundle on macOS. @@ -293,12 +292,6 @@ int registerFontFamily(const QString &family) { return result; } -int CeilTextWidth(const QFont &font, const QString &text) { - return text.isEmpty() - ? 0 - : QStackTextEngine(text, font).width(0, text.size()).ceil().toInt(); -} - FontData::FontData(int size, uint32 flags, int family, Font *other) : f(ResolveFont(family ? fontFamilies[family] : QString(), flags, size)) , _m(f) diff --git a/ui/style/style_core_font.h b/ui/style/style_core_font.h index 152357b..898fd75 100644 --- a/ui/style/style_core_font.h +++ b/ui/style/style_core_font.h @@ -68,12 +68,10 @@ enum FontFlags { FontDifferentFlags = 0x40, }; -[[nodiscard]] int CeilTextWidth(const QFont &font, const QString &text); - class FontData { public: [[nodiscard]] int width(const QString &text) const { - return CeilTextWidth(f, text); + return int(std::ceil(_m.horizontalAdvance(text))); } [[nodiscard]] int width(const QString &text, int from, int to) const { return width(text.mid(from, to));