feat: add stretch and capitalisation to builder
This commit is contained in:
parent
efa0fa2def
commit
79217c46ea
2 changed files with 12 additions and 0 deletions
|
|
@ -27,11 +27,21 @@ FontBuilder FontBuilder::italic(bool on) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FontBuilder FontBuilder::stretch(int stretch) {
|
||||||
|
m_font.setStretch(stretch);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
FontBuilder FontBuilder::letterSpacing(qreal spacing, bool absolute) {
|
FontBuilder FontBuilder::letterSpacing(qreal spacing, bool absolute) {
|
||||||
m_font.setLetterSpacing(absolute ? QFont::AbsoluteSpacing : QFont::PercentageSpacing, spacing);
|
m_font.setLetterSpacing(absolute ? QFont::AbsoluteSpacing : QFont::PercentageSpacing, spacing);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FontBuilder FontBuilder::capitalisation(QFont::Capitalization cap) {
|
||||||
|
m_font.setCapitalization(cap);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
FontBuilder FontBuilder::vaxis(QFont::Tag tag, float value) {
|
FontBuilder FontBuilder::vaxis(QFont::Tag tag, float value) {
|
||||||
m_font.setVariableAxis(tag, value);
|
m_font.setVariableAxis(tag, value);
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,9 @@ public:
|
||||||
[[nodiscard]] Q_INVOKABLE FontBuilder size(int pointSize);
|
[[nodiscard]] Q_INVOKABLE FontBuilder size(int pointSize);
|
||||||
[[nodiscard]] Q_INVOKABLE FontBuilder weight(QFont::Weight weight);
|
[[nodiscard]] Q_INVOKABLE FontBuilder weight(QFont::Weight weight);
|
||||||
[[nodiscard]] Q_INVOKABLE FontBuilder italic(bool on = true);
|
[[nodiscard]] Q_INVOKABLE FontBuilder italic(bool on = true);
|
||||||
|
[[nodiscard]] Q_INVOKABLE FontBuilder stretch(int stretch);
|
||||||
[[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 vaxis(QFont::Tag tag, float value);
|
[[nodiscard]] Q_INVOKABLE FontBuilder vaxis(QFont::Tag tag, float value);
|
||||||
[[nodiscard]] Q_INVOKABLE QFont build() const;
|
[[nodiscard]] Q_INVOKABLE QFont build() const;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue