feat: fontbuilder to streamline font styling
C++ / fmt (pull_request) Failing after 4s
C++ / build (pull_request) Failing after 9s
C++ / clang-tidy (pull_request) Failing after 9s
JS/TS / fmt (pull_request) Successful in 10s
JS/TS / lint (pull_request) Successful in 9s
Python / static (pull_request) Successful in 34s
Rust / build (pull_request) Successful in 1m10s
Python / verify (pull_request) Successful in 1m53s
Rust / fmt (pull_request) Successful in 34s
Rust / clippy (pull_request) Successful in 57s

This commit is contained in:
2026-09-21 15:37:45 +02:00
parent 84d5abcaab
commit 25bee293b0
134 changed files with 1813 additions and 1011 deletions
+41
View File
@@ -0,0 +1,41 @@
#pragma once
#include <qfont.h>
#include <qqmlintegration.h>
#include <qvariant.h>
namespace ZShell::config {
class FontBuilder {
Q_GADGET
QML_ANONYMOUS
public:
FontBuilder() = default;
explicit FontBuilder(const QFont& font);
[[nodiscard]] Q_INVOKABLE FontBuilder family(const QString& family);
[[nodiscard]] Q_INVOKABLE FontBuilder size(int pointSize);
[[nodiscard]] Q_INVOKABLE FontBuilder pixelSize(int pixelSize);
[[nodiscard]] Q_INVOKABLE FontBuilder weight(QFont::Weight weight);
[[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
capitalisation(QFont::Capitalization cap);
[[nodiscard]] Q_INVOKABLE FontBuilder vaxis(const QString& tag, float value);
[[nodiscard]] Q_INVOKABLE FontBuilder vaxes(const QVariantMap& axes);
[[nodiscard]] Q_INVOKABLE QFont build() const;
[[nodiscard]] Q_INVOKABLE FontBuilder fill(float value);
[[nodiscard]] Q_INVOKABLE FontBuilder grade(float value);
[[nodiscard]] Q_INVOKABLE FontBuilder width(float value);
[[nodiscard]] Q_INVOKABLE FontBuilder scale(qreal factor);
private:
QFont m_font;
};
} // namespace ZShell::config