#include #include #include #include #include #include #include #include #include #include #include #include #include #include "qrawfont.h" #include "gen_qrawfont.h" extern "C" { extern void miqt_exec_callback(void* cb, int argc, void* argv); } QRawFont* QRawFont_new() { return new QRawFont(); } QRawFont* QRawFont_new2(const char* fileName, size_t fileName_Strlen, double pixelSize) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); return new QRawFont(fileName_QString, static_cast(pixelSize)); } QRawFont* QRawFont_new3(QByteArray* fontData, double pixelSize) { return new QRawFont(*fontData, static_cast(pixelSize)); } QRawFont* QRawFont_new4(QRawFont* other) { return new QRawFont(*other); } QRawFont* QRawFont_new5(const char* fileName, size_t fileName_Strlen, double pixelSize, uintptr_t hintingPreference) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); return new QRawFont(fileName_QString, static_cast(pixelSize), static_cast(hintingPreference)); } QRawFont* QRawFont_new6(QByteArray* fontData, double pixelSize, uintptr_t hintingPreference) { return new QRawFont(*fontData, static_cast(pixelSize), static_cast(hintingPreference)); } void QRawFont_OperatorAssign(QRawFont* self, QRawFont* other) { self->operator=(*other); } void QRawFont_Swap(QRawFont* self, QRawFont* other) { self->swap(*other); } bool QRawFont_IsValid(QRawFont* self) { return const_cast(self)->isValid(); } bool QRawFont_OperatorEqual(QRawFont* self, QRawFont* other) { return const_cast(self)->operator==(*other); } bool QRawFont_OperatorNotEqual(QRawFont* self, QRawFont* other) { return const_cast(self)->operator!=(*other); } void QRawFont_FamilyName(QRawFont* self, char** _out, int* _out_Strlen) { QString ret = const_cast(self)->familyName(); // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory QByteArray b = ret.toUtf8(); *_out = static_cast(malloc(b.length())); memcpy(*_out, b.data(), b.length()); *_out_Strlen = b.length(); } void QRawFont_StyleName(QRawFont* self, char** _out, int* _out_Strlen) { QString ret = const_cast(self)->styleName(); // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory QByteArray b = ret.toUtf8(); *_out = static_cast(malloc(b.length())); memcpy(*_out, b.data(), b.length()); *_out_Strlen = b.length(); } uintptr_t QRawFont_Style(QRawFont* self) { QFont::Style ret = const_cast(self)->style(); return static_cast(ret); } int QRawFont_Weight(QRawFont* self) { return const_cast(self)->weight(); } void QRawFont_GlyphIndexesForString(QRawFont* self, const char* text, size_t text_Strlen, unsigned int** _out, size_t* _out_len) { QString text_QString = QString::fromUtf8(text, text_Strlen); QVector ret = const_cast(self)->glyphIndexesForString(text_QString); // Convert QList<> from C++ memory to manually-managed C memory unsigned int* __out = static_cast(malloc(sizeof(unsigned int) * ret.length())); for (size_t i = 0, e = ret.length(); i < e; ++i) { __out[i] = ret[i]; } *_out = __out; *_out_len = ret.length(); } void QRawFont_AdvancesForGlyphIndexes(QRawFont* self, unsigned int* glyphIndexes, size_t glyphIndexes_len, QPointF*** _out, size_t* _out_len) { QVector glyphIndexes_QList; glyphIndexes_QList.reserve(glyphIndexes_len); for(size_t i = 0; i < glyphIndexes_len; ++i) { glyphIndexes_QList.push_back(glyphIndexes[i]); } QVector ret = const_cast(self)->advancesForGlyphIndexes(glyphIndexes_QList); // Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers QPointF** __out = static_cast(malloc(sizeof(QPointF**) * ret.length())); for (size_t i = 0, e = ret.length(); i < e; ++i) { __out[i] = new QPointF(ret[i]); } *_out = __out; *_out_len = ret.length(); } void QRawFont_AdvancesForGlyphIndexes2(QRawFont* self, unsigned int* glyphIndexes, size_t glyphIndexes_len, int layoutFlags, QPointF*** _out, size_t* _out_len) { QVector glyphIndexes_QList; glyphIndexes_QList.reserve(glyphIndexes_len); for(size_t i = 0; i < glyphIndexes_len; ++i) { glyphIndexes_QList.push_back(glyphIndexes[i]); } QVector ret = const_cast(self)->advancesForGlyphIndexes(glyphIndexes_QList, static_cast(layoutFlags)); // Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers QPointF** __out = static_cast(malloc(sizeof(QPointF**) * ret.length())); for (size_t i = 0, e = ret.length(); i < e; ++i) { __out[i] = new QPointF(ret[i]); } *_out = __out; *_out_len = ret.length(); } bool QRawFont_GlyphIndexesForChars(QRawFont* self, QChar* chars, int numChars, unsigned int* glyphIndexes, int* numGlyphs) { return const_cast(self)->glyphIndexesForChars(chars, static_cast(numChars), static_cast(glyphIndexes), static_cast(numGlyphs)); } bool QRawFont_AdvancesForGlyphIndexes3(QRawFont* self, const unsigned int* glyphIndexes, QPointF* advances, int numGlyphs) { return const_cast(self)->advancesForGlyphIndexes(static_cast(glyphIndexes), advances, static_cast(numGlyphs)); } bool QRawFont_AdvancesForGlyphIndexes4(QRawFont* self, const unsigned int* glyphIndexes, QPointF* advances, int numGlyphs, int layoutFlags) { return const_cast(self)->advancesForGlyphIndexes(static_cast(glyphIndexes), advances, static_cast(numGlyphs), static_cast(layoutFlags)); } QImage* QRawFont_AlphaMapForGlyph(QRawFont* self, unsigned int glyphIndex) { QImage ret = const_cast(self)->alphaMapForGlyph(static_cast(glyphIndex)); // Copy-construct value returned type into heap-allocated copy return static_cast(new QImage(ret)); } QPainterPath* QRawFont_PathForGlyph(QRawFont* self, unsigned int glyphIndex) { QPainterPath ret = const_cast(self)->pathForGlyph(static_cast(glyphIndex)); // Copy-construct value returned type into heap-allocated copy return static_cast(new QPainterPath(ret)); } QRectF* QRawFont_BoundingRect(QRawFont* self, unsigned int glyphIndex) { QRectF ret = const_cast(self)->boundingRect(static_cast(glyphIndex)); // Copy-construct value returned type into heap-allocated copy return static_cast(new QRectF(ret)); } void QRawFont_SetPixelSize(QRawFont* self, double pixelSize) { self->setPixelSize(static_cast(pixelSize)); } double QRawFont_PixelSize(QRawFont* self) { return const_cast(self)->pixelSize(); } uintptr_t QRawFont_HintingPreference(QRawFont* self) { QFont::HintingPreference ret = const_cast(self)->hintingPreference(); return static_cast(ret); } double QRawFont_Ascent(QRawFont* self) { return const_cast(self)->ascent(); } double QRawFont_CapHeight(QRawFont* self) { return const_cast(self)->capHeight(); } double QRawFont_Descent(QRawFont* self) { return const_cast(self)->descent(); } double QRawFont_Leading(QRawFont* self) { return const_cast(self)->leading(); } double QRawFont_XHeight(QRawFont* self) { return const_cast(self)->xHeight(); } double QRawFont_AverageCharWidth(QRawFont* self) { return const_cast(self)->averageCharWidth(); } double QRawFont_MaxCharWidth(QRawFont* self) { return const_cast(self)->maxCharWidth(); } double QRawFont_LineThickness(QRawFont* self) { return const_cast(self)->lineThickness(); } double QRawFont_UnderlinePosition(QRawFont* self) { return const_cast(self)->underlinePosition(); } double QRawFont_UnitsPerEm(QRawFont* self) { return const_cast(self)->unitsPerEm(); } void QRawFont_LoadFromFile(QRawFont* self, const char* fileName, size_t fileName_Strlen, double pixelSize, uintptr_t hintingPreference) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); self->loadFromFile(fileName_QString, static_cast(pixelSize), static_cast(hintingPreference)); } void QRawFont_LoadFromData(QRawFont* self, QByteArray* fontData, double pixelSize, uintptr_t hintingPreference) { self->loadFromData(*fontData, static_cast(pixelSize), static_cast(hintingPreference)); } bool QRawFont_SupportsCharacter(QRawFont* self, unsigned int ucs4) { return const_cast(self)->supportsCharacter(static_cast(ucs4)); } bool QRawFont_SupportsCharacterWithCharacter(QRawFont* self, QChar* character) { return const_cast(self)->supportsCharacter(*character); } void QRawFont_SupportedWritingSystems(QRawFont* self, uintptr_t** _out, size_t* _out_len) { QList ret = const_cast(self)->supportedWritingSystems(); // Convert QList<> from C++ memory to manually-managed C memory uintptr_t* __out = static_cast(malloc(sizeof(uintptr_t) * ret.length())); for (size_t i = 0, e = ret.length(); i < e; ++i) { __out[i] = ret[i]; } *_out = __out; *_out_len = ret.length(); } QByteArray* QRawFont_FontTable(QRawFont* self, const char* tagName) { QByteArray ret = const_cast(self)->fontTable(tagName); // Copy-construct value returned type into heap-allocated copy return static_cast(new QByteArray(ret)); } QRawFont* QRawFont_FromFont(QFont* font) { QRawFont ret = QRawFont::fromFont(*font); // Copy-construct value returned type into heap-allocated copy return static_cast(new QRawFont(ret)); } QImage* QRawFont_AlphaMapForGlyph2(QRawFont* self, unsigned int glyphIndex, uintptr_t antialiasingType) { QImage ret = const_cast(self)->alphaMapForGlyph(static_cast(glyphIndex), static_cast(antialiasingType)); // Copy-construct value returned type into heap-allocated copy return static_cast(new QImage(ret)); } QImage* QRawFont_AlphaMapForGlyph3(QRawFont* self, unsigned int glyphIndex, uintptr_t antialiasingType, QTransform* transform) { QImage ret = const_cast(self)->alphaMapForGlyph(static_cast(glyphIndex), static_cast(antialiasingType), *transform); // Copy-construct value returned type into heap-allocated copy return static_cast(new QImage(ret)); } QRawFont* QRawFont_FromFont2(QFont* font, uintptr_t writingSystem) { QRawFont ret = QRawFont::fromFont(*font, static_cast(writingSystem)); // Copy-construct value returned type into heap-allocated copy return static_cast(new QRawFont(ret)); } void QRawFont_Delete(QRawFont* self) { delete self; }