1 /* 2 * DQt - D bindings for the Qt Toolkit 3 * 4 * GNU Lesser General Public License Usage 5 * This file may be used under the terms of the GNU Lesser 6 * General Public License version 3 as published by the Free Software 7 * Foundation and appearing in the file LICENSE.LGPL3 included in the 8 * packaging of this file. Please review the following information to 9 * ensure the GNU Lesser General Public License version 3 requirements 10 * will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 11 */ 12 module qt.gui.fontdatabase; 13 extern(C++): 14 15 import qt.config; 16 import qt.core.bytearray; 17 import qt.core.list; 18 import qt.core.metamacros; 19 import qt.core.string; 20 import qt.core.stringlist; 21 import qt.gui.font; 22 import qt.gui.fontinfo; 23 import qt.helpers; 24 25 struct QFontDef; 26 extern(C++, class) struct QFontEngine; 27 28 /// Binding for C++ class [QFontDatabase](https://doc.qt.io/qt-6/qfontdatabase.html). 29 extern(C++, class) struct /+ Q_GUI_EXPORT +/ QFontDatabase 30 { 31 mixin(Q_GADGET); 32 public: 33 enum WritingSystem { 34 Any, 35 36 Latin, 37 Greek, 38 Cyrillic, 39 Armenian, 40 Hebrew, 41 Arabic, 42 Syriac, 43 Thaana, 44 Devanagari, 45 Bengali, 46 Gurmukhi, 47 Gujarati, 48 Oriya, 49 Tamil, 50 Telugu, 51 Kannada, 52 Malayalam, 53 Sinhala, 54 Thai, 55 Lao, 56 Tibetan, 57 Myanmar, 58 Georgian, 59 Khmer, 60 SimplifiedChinese, 61 TraditionalChinese, 62 Japanese, 63 Korean, 64 Vietnamese, 65 66 Symbol, 67 Other = WritingSystem.Symbol, 68 69 Ogham, 70 Runic, 71 Nko, 72 73 WritingSystemsCount 74 } 75 /+ Q_ENUM(WritingSystem) +/ 76 77 enum SystemFont { 78 GeneralFont, 79 FixedFont, 80 TitleFont, 81 SmallestReadableFont 82 } 83 /+ Q_ENUM(SystemFont) +/ 84 85 static QList!(int) standardSizes(); 86 87 /+ #if QT_DEPRECATED_SINCE(6, 0) +/ 88 /+ QT_DEPRECATED_VERSION_X_6_0("Call the static functions instead") explicit QFontDatabase() = default; +/ 89 /+ #else 90 QFontDatabase() = delete; 91 #endif +/ 92 93 static QList!(WritingSystem) writingSystems(); 94 static QList!(WritingSystem) writingSystems(ref const(QString) family); 95 96 static QStringList families(WritingSystem writingSystem = WritingSystem.Any); 97 static QStringList styles(ref const(QString) family); 98 static QList!(int) pointSizes(ref const(QString) family, ref const(QString) style = globalInitVar!QString); 99 static QList!(int) smoothSizes(ref const(QString) family, ref const(QString) style); 100 static QString styleString(ref const(QFont) font); 101 static QString styleString(ref const(QFontInfo) fontInfo); 102 103 static QFont font(ref const(QString) family, ref const(QString) style, int pointSize); 104 105 static bool isBitmapScalable(ref const(QString) family, ref const(QString) style = globalInitVar!QString); 106 static bool isSmoothlyScalable(ref const(QString) family, ref const(QString) style = globalInitVar!QString); 107 static bool isScalable(ref const(QString) family, ref const(QString) style = globalInitVar!QString); 108 static bool isFixedPitch(ref const(QString) family, ref const(QString) style = globalInitVar!QString); 109 110 static bool italic(ref const(QString) family, ref const(QString) style); 111 static bool bold(ref const(QString) family, ref const(QString) style); 112 static int weight(ref const(QString) family, ref const(QString) style); 113 114 static bool hasFamily(ref const(QString) family); 115 static bool isPrivateFamily(ref const(QString) family); 116 117 static QString writingSystemName(WritingSystem writingSystem); 118 static QString writingSystemSample(WritingSystem writingSystem); 119 120 static int addApplicationFont(ref const(QString) fileName); 121 static int addApplicationFontFromData(ref const(QByteArray) fontData); 122 static QStringList applicationFontFamilies(int id); 123 static bool removeApplicationFont(int id); 124 static bool removeAllApplicationFonts(); 125 126 static QFont systemFont(SystemFont type); 127 mixin(CREATE_CONVENIENCE_WRAPPERS); 128 } 129