Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
FontFaces.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3#pragma once
4
5#include <PhosphorTheme/phosphortheme_export.h>
6
7#include <QObject>
8#include <QString>
9#include <QStringList>
10#include <QtQmlIntegration/qqmlintegration.h>
11
12namespace PhosphorTheme {
13
29class PHOSPHORTHEME_EXPORT FontFaces : public QObject
30{
31 Q_OBJECT
32 QML_ELEMENT
33 QML_SINGLETON
34
36 Q_PROPERTY(QString ui READ ui NOTIFY facesChanged)
38 Q_PROPERTY(QString mono READ mono NOTIFY facesChanged)
40 Q_PROPERTY(bool uiPreferred READ uiPreferred NOTIFY facesChanged)
41 Q_PROPERTY(bool monoPreferred READ monoPreferred NOTIFY facesChanged)
42
43public:
44 explicit FontFaces(QObject* parent = nullptr);
45
46 [[nodiscard]] QString ui() const;
47 [[nodiscard]] QString mono() const;
48 [[nodiscard]] bool uiPreferred() const;
49 [[nodiscard]] bool monoPreferred() const;
50
52 [[nodiscard]] static QStringList uiCandidates();
53 [[nodiscard]] static QStringList monoCandidates();
54
56 [[nodiscard]] static QString resolve(const QStringList& candidates, const QString& fallback);
57
59 Q_INVOKABLE void refresh();
60
61Q_SIGNALS:
63
64private:
65 QString m_ui;
66 QString m_mono;
67 bool m_uiPreferred = false;
68 bool m_monoPreferred = false;
69};
70
71} // namespace PhosphorTheme
bool monoPreferred() const
void refresh()
Re-read the font database (a font installed while the shell runs).
static QString resolve(const QStringList &candidates, const QString &fallback)
First installed family from candidates, else fallback.
static QStringList uiCandidates()
The preference lists, first entry the identity's face.
QString mono() const
FontFaces(QObject *parent=nullptr)
The display and UI family.
static QStringList monoCandidates()
Definition AppearanceLibrary.h:10