1 #pragma once 2 3 #include <ft2build.h> 4 #include FT_FREETYPE_H 5 #include FT_OUTLINE_H 6 #include FT_BBOX_H 7 #include FT_MULTIPLE_MASTERS_H 8 9 #include <QCoreApplication> 10 11 #include "glyph.h" 12 13 class FreeTypeFont 14 { 15 Q_DECLARE_TR_FUNCTIONS(FreeTypeFont) 16 17 public: 18 FreeTypeFont(); 19 ~FreeTypeFont(); 20 21 void open(const QString &path, const quint32 index = 0); 22 bool isOpen() const; 23 24 FontInfo fontInfo() const; 25 Glyph outline(const quint16 gid) const; 26 27 void setVariations(const QVector<Variation> &variations); 28 29 private: 30 FT_Library m_ftLibrary = nullptr; 31 FT_Face m_ftFace = nullptr; 32 }; 33