1 /**************************************************************************** 2 ** 3 ** DQt - D bindings for the Qt Toolkit 4 ** 5 ** GNU Lesser General Public License Usage 6 ** This file may be used under the terms of the GNU Lesser 7 ** General Public License version 3 as published by the Free Software 8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the 9 ** packaging of this file. Please review the following information to 10 ** ensure the GNU Lesser General Public License version 3 requirements 11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 12 ** 13 ****************************************************************************/ 14 module qt.gui.fontdatabase; 15 extern(C++): 16 17 import qt.config; 18 import qt.core.bytearray; 19 import qt.core.list; 20 import qt.core.objectdefs; 21 import qt.core.string; 22 import qt.core.stringlist; 23 import qt.gui.font; 24 import qt.gui.fontinfo; 25 import qt.helpers; 26 27 /+ class QStringList; 28 template <class T> class QList; +/ 29 struct QFontDef; 30 extern(C++, class) struct QFontEngine; 31 32 extern(C++, class) struct QFontDatabasePrivate; 33 34 extern(C++, class) struct /+ Q_GUI_EXPORT +/ QFontDatabase 35 { 36 mixin(Q_GADGET); 37 public: 38 // do not re-order or delete entries from this enum without updating the 39 // QPF2 format and makeqpf!! 40 enum WritingSystem { 41 Any, 42 43 Latin, 44 Greek, 45 Cyrillic, 46 Armenian, 47 Hebrew, 48 Arabic, 49 Syriac, 50 Thaana, 51 Devanagari, 52 Bengali, 53 Gurmukhi, 54 Gujarati, 55 Oriya, 56 Tamil, 57 Telugu, 58 Kannada, 59 Malayalam, 60 Sinhala, 61 Thai, 62 Lao, 63 Tibetan, 64 Myanmar, 65 Georgian, 66 Khmer, 67 SimplifiedChinese, 68 TraditionalChinese, 69 Japanese, 70 Korean, 71 Vietnamese, 72 73 Symbol, 74 Other = WritingSystem.Symbol, 75 76 Ogham, 77 Runic, 78 Nko, 79 80 WritingSystemsCount 81 } 82 /+ Q_ENUM(WritingSystem) +/ 83 84 enum SystemFont { 85 GeneralFont, 86 FixedFont, 87 TitleFont, 88 SmallestReadableFont 89 } 90 /+ Q_ENUM(SystemFont) +/ 91 92 static QList!(int) standardSizes(); 93 94 @disable this(); 95 pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this)))) 96 ref typeof(this) rawConstructor(); 97 static typeof(this) create() 98 { 99 typeof(this) r = typeof(this).init; 100 r.rawConstructor(); 101 return r; 102 } 103 104 105 QList!(WritingSystem) writingSystems() const; 106 QList!(WritingSystem) writingSystems(ref const(QString) family) const; 107 108 QStringList families(WritingSystem writingSystem = WritingSystem.Any) const; 109 QStringList styles(ref const(QString) family) const; 110 QList!(int) pointSizes(ref const(QString) family, ref const(QString) style = globalInitVar!QString); 111 QList!(int) smoothSizes(ref const(QString) family, ref const(QString) style); 112 QString styleString(ref const(QFont) font); 113 QString styleString(ref const(QFontInfo) fontInfo); 114 115 QFont font(ref const(QString) family, ref const(QString) style, int pointSize) const; 116 117 bool isBitmapScalable(ref const(QString) family, ref const(QString) style = globalInitVar!QString) const; 118 bool isSmoothlyScalable(ref const(QString) family, ref const(QString) style = globalInitVar!QString) const; 119 bool isScalable(ref const(QString) family, ref const(QString) style = globalInitVar!QString) const; 120 bool isFixedPitch(ref const(QString) family, ref const(QString) style = globalInitVar!QString) const; 121 122 bool italic(ref const(QString) family, ref const(QString) style) const; 123 bool bold(ref const(QString) family, ref const(QString) style) const; 124 int weight(ref const(QString) family, ref const(QString) style) const; 125 126 bool hasFamily(ref const(QString) family) const; 127 bool isPrivateFamily(ref const(QString) family) const; 128 129 static QString writingSystemName(WritingSystem writingSystem); 130 static QString writingSystemSample(WritingSystem writingSystem); 131 132 static int addApplicationFont(ref const(QString) fileName); 133 static int addApplicationFontFromData(ref const(QByteArray) fontData); 134 static QStringList applicationFontFamilies(int id); 135 static bool removeApplicationFont(int id); 136 static bool removeAllApplicationFonts(); 137 138 /+ #if QT_DEPRECATED_SINCE(5, 2) +/ 139 /+ QT_DEPRECATED +/ static bool supportsThreadedFontRendering(); 140 /+ #endif +/ 141 142 static QFont systemFont(SystemFont type); 143 144 private: 145 static void createDatabase(); 146 static void parseFontName(ref const(QString) name, ref QString foundry, ref QString family); 147 static QString resolveFontFamilyAlias(ref const(QString) family); 148 static QFontEngine* findFont(ref const(QFontDef) request, int script /* QChar::Script */); 149 static void load(const(QFontPrivate)* d, int script /* QChar::Script */); 150 151 /+ friend struct QFontDef; +/ 152 /+ friend class QFontPrivate; +/ 153 /+ friend class QFontDialog; +/ 154 /+ friend class QFontDialogPrivate; +/ 155 /+ friend class QFontEngineMulti; +/ 156 /+ friend class QRawFont; +/ 157 158 QFontDatabasePrivate* d; 159 } 160