feat: add vaxes shorthand
For setting multiple vaxes at the same time
This commit is contained in:
parent
f69abecfa2
commit
198a6eecf2
2 changed files with 9 additions and 0 deletions
|
|
@ -47,6 +47,14 @@ FontBuilder FontBuilder::vaxis(QFont::Tag tag, float value) {
|
|||
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 {
|
||||
return m_font;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public:
|
|||
[[nodiscard]] Q_INVOKABLE FontBuilder letterSpacing(qreal spacing, bool absolute = true);
|
||||
[[nodiscard]] Q_INVOKABLE FontBuilder capitalisation(QFont::Capitalization cap);
|
||||
[[nodiscard]] Q_INVOKABLE FontBuilder vaxis(QFont::Tag tag, float value);
|
||||
[[nodiscard]] Q_INVOKABLE FontBuilder vaxes(QVariantMap axes);
|
||||
[[nodiscard]] Q_INVOKABLE QFont build() const;
|
||||
|
||||
// Common vaxes
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue