Skip to content

Commit

Permalink
Remove unnecessary private Qt API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-fedin authored and john-preston committed May 15, 2023
1 parent be0067a commit 8c58ebc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
7 changes: 0 additions & 7 deletions ui/style/style_core_font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <QtGui/QFontInfo>
#include <QtGui/QFontDatabase>
#include <QtWidgets/QApplication>
#include <private/qfontengine_p.h>

void style_InitFontsResource() {
#ifdef Q_OS_MAC // Use resources from the .app bundle on macOS.
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions ui/style/style_core_font.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 8c58ebc

Please sign in to comment.