1 /****************************************************************************
3 ** Copyright (C) 2012 Takumi Asaki
4 ** All rights reserved.
5 ** Contact: Takumi Asaki (takumi.asaki@gmail.com)
7 ** This file is part of the fontmanager application.
9 ** You may use this file under the terms of the BSD license as follows:
11 ** "Redistribution and use in source and binary forms, with or without
12 ** modification, are permitted provided that the following conditions are
14 ** * Redistributions of source code must retain the above copyright
15 ** notice, this list of conditions and the following disclaimer.
16 ** * Redistributions in binary form must reproduce the above copyright
17 ** notice, this list of conditions and the following disclaimer in
18 ** the documentation and/or other materials provided with the
20 ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
21 ** the names of its contributors may be used to endorse or promote
22 ** products derived from this software without specific prior written
25 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
37 ****************************************************************************/
39 #ifndef INSTALLEDFONTINFO_H
40 #define INSTALLEDFONTINFO_H
43 #include <QStringList>
45 class FontsConfigProperties;
47 class InstalledFontInfo : public QObject
50 Q_PROPERTY(QStringList family READ family NOTIFY detailsChanged)
51 Q_PROPERTY(QStringList familylang READ familylang NOTIFY detailsChanged)
52 Q_PROPERTY(QStringList style READ style NOTIFY detailsChanged)
53 Q_PROPERTY(QStringList stylelang READ stylelang NOTIFY detailsChanged)
54 Q_PROPERTY(QStringList fullname READ fullname NOTIFY detailsChanged)
55 Q_PROPERTY(QStringList fullnamelang READ fullnamelang NOTIFY detailsChanged)
57 Q_PROPERTY(QString localefamily READ localefamily NOTIFY detailsChanged)
58 Q_PROPERTY(QString localestyle READ localestyle NOTIFY detailsChanged)
59 Q_PROPERTY(QString localefullname READ localefullname NOTIFY detailsChanged)
61 Q_PROPERTY(QString enfamily READ enfamily NOTIFY detailsChanged)
62 Q_PROPERTY(QString enstyle READ enstyle NOTIFY detailsChanged)
63 Q_PROPERTY(QString enfullname READ enfullname NOTIFY detailsChanged)
65 Q_PROPERTY(QString foundry READ foundry NOTIFY detailsChanged)
66 Q_PROPERTY(QString file READ file NOTIFY detailsChanged)
67 Q_PROPERTY(QStringList lang READ lang NOTIFY detailsChanged)
68 Q_PROPERTY(bool outline READ outline NOTIFY detailsChanged)
69 Q_PROPERTY(bool scalable READ scalable NOTIFY detailsChanged)
70 Q_PROPERTY(int slant READ slant NOTIFY detailsChanged)
71 Q_PROPERTY(int weight READ weight NOTIFY detailsChanged)
72 Q_PROPERTY(int width READ width NOTIFY detailsChanged)
74 Q_PROPERTY(bool systemFont READ systemFont NOTIFY detailsChanged)
77 explicit InstalledFontInfo(const QByteArray buf, const QString &localFontPath, QObject *parent = 0);
81 QStringList family() const;
82 QStringList familylang() const;
83 QStringList style() const;
84 QStringList stylelang() const;
85 QStringList fullname() const;
86 QStringList fullnamelang() const;
87 QString foundry() const;
89 QStringList lang() const;
91 bool scalable() const;
96 QString localefamily() const;
97 QString localestyle() const;
98 QString localefullname() const;
100 QString enfamily() const;
101 QString enstyle() const;
102 QString enfullname() const;
104 QString locale() const;
105 void setLocale(const QString &loc);
107 bool systemFont() const;
109 QString localeString(const QStringList &strlist, const QStringList &langlist, const QString &lang) const;
111 Q_INVOKABLE FontsConfigProperties *fontProperty() const;
112 void setFontProperty(FontsConfigProperties *prop);
114 static bool compare(const InstalledFontInfo *info1, InstalledFontInfo *info2);
117 void detailsChanged();
122 bool analyze(const QByteArray &buf, const QString &localFontPath);
124 static QString toString(const QString &value);
125 static QStringList toStringList(const QString &value);
126 static int toInt(const QString &value);
127 static bool toBool(const QString &value);
133 QStringList mFamilylang;
135 QStringList mStylelang;
136 QStringList mFullname;
137 QStringList mFullnamelang;
151 FontsConfigProperties *mFontProperty;
154 #endif // INSTALLEDFONTINFO_H