feat: add vaxes shorthand

For setting multiple vaxes at the same time
This commit is contained in:
2 * r + 2 * t 2026-04-21 01:49:26 +10:00
parent f69abecfa2
commit 198a6eecf2
2 changed files with 9 additions and 0 deletions

View file

@ -47,6 +47,14 @@ FontBuilder FontBuilder::vaxis(QFont::Tag tag, float value) {
return *this; return *this;
} }
FontBuilder FontBuilder::vaxes(QVariantMap axes) {
for (auto it = axes.constBegin(); it != axes.constEnd(); ++it) {
if (auto tag = QFont::Tag::fromString(it.key()))
m_font.setVariableAxis(*tag, it.value().toFloat());
}
return *this;
}
QFont FontBuilder::build() const { QFont FontBuilder::build() const {
return m_font; return m_font;
} }

View file

@ -21,6 +21,7 @@ public:
[[nodiscard]] Q_INVOKABLE FontBuilder letterSpacing(qreal spacing, bool absolute = true); [[nodiscard]] Q_INVOKABLE FontBuilder letterSpacing(qreal spacing, bool absolute = true);
[[nodiscard]] Q_INVOKABLE FontBuilder capitalisation(QFont::Capitalization cap); [[nodiscard]] Q_INVOKABLE FontBuilder capitalisation(QFont::Capitalization cap);
[[nodiscard]] Q_INVOKABLE FontBuilder vaxis(QFont::Tag tag, float value); [[nodiscard]] Q_INVOKABLE FontBuilder vaxis(QFont::Tag tag, float value);
[[nodiscard]] Q_INVOKABLE FontBuilder vaxes(QVariantMap axes);
[[nodiscard]] Q_INVOKABLE QFont build() const; [[nodiscard]] Q_INVOKABLE QFont build() const;
// Common vaxes // Common vaxes