1/* GCompris - GCSingletonFontLoader.qml
2 *
3 * SPDX-FileCopyrightText: 2014 Johnny Jazeix <jazeix@gmail.com>
4 *
5 * Authors:
6 *   Johnny Jazeix <jazeix@gmail.com>
7 *
8 *   SPDX-License-Identifier: GPL-3.0-or-later
9 */
10import QtQuick 2.9
11import GCompris 1.0
12
13//QTBUG-34418, singletons require explicit import to load qmldir file
14//https://qt-project.org/wiki/QmlStyling#6b81104b320e452a59cc3bf6857115ab
15import "."
16
17// FIXME: this triggers a doxygen error, why?
18pragma Singleton
19
20/**
21 * A QML singleton helper to load currently active font based on current font
22 * settings
23 * @ingroup infrastructure
24 *
25 * @inherit QtQuick.QtObject
26 * @sa ApplicationSettings.isEmbeddedFont, ApplicationSettings.font
27 */
28QtObject {
29    property QtObject fontLoader: ApplicationSettings.isEmbeddedFont ? sourceLoader : nameLoader
30
31    property QtObject fontSourceLoader: FontLoader {
32        id: sourceLoader
33        source: ApplicationSettings.isEmbeddedFont ? "resource/fonts/"+ApplicationSettings.font : ""
34    }
35
36    property QtObject fontNameLoader: FontLoader {
37        id: nameLoader
38        name: ApplicationSettings.font
39    }
40
41}
42