#include #include #include #include #include #include #include #include #include #include #include #include #include #include "qrawfont.h" #include "gen_qrawfont.h" #include "_cgo_export.h" QRawFont* QRawFont_new() { return new QRawFont(); } QRawFont* QRawFont_new2(struct miqt_string* fileName, double pixelSize) { QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len); 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(struct miqt_string* fileName, double pixelSize, uintptr_t hintingPreference) { QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len); 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(const QRawFont* self) { return self->isValid(); } bool QRawFont_OperatorEqual(const QRawFont* self, QRawFont* other) { return self->operator==(*other); } bool QRawFont_OperatorNotEqual(const QRawFont* self, QRawFont* other) { return self->operator!=(*other); } struct miqt_string* QRawFont_FamilyName(const QRawFont* self) { QString _ret = self->familyName(); // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory QByteArray _b = _ret.toUtf8(); return miqt_strdup(_b.data(), _b.length()); } struct miqt_string* QRawFont_StyleName(const QRawFont* self) { QString _ret = self->styleName(); // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory QByteArray _b = _ret.toUtf8(); return miqt_strdup(_b.data(), _b.length()); } uintptr_t QRawFont_Style(const QRawFont* self) { QFont::Style _ret = self->style(); return static_cast(_ret); } int QRawFont_Weight(const QRawFont* self) { return self->weight(); } struct miqt_array* QRawFont_GlyphIndexesForString(const QRawFont* self, struct miqt_string* text) { QString text_QString = QString::fromUtf8(&text->data, text->len); QVector _ret = self->glyphIndexesForString(text_QString); // Convert QList<> from C++ memory to manually-managed C memory unsigned int* _arr = static_cast(malloc(sizeof(unsigned int) * _ret.length())); for (size_t i = 0, e = _ret.length(); i < e; ++i) { _arr[i] = _ret[i]; } struct miqt_array* _out = static_cast(malloc(sizeof(struct miqt_array))); _out->len = _ret.length(); _out->data = static_cast(_arr); return _out; } struct miqt_array* QRawFont_AdvancesForGlyphIndexes(const QRawFont* self, struct miqt_array* /* of unsigned int */ glyphIndexes) { QVector glyphIndexes_QList; glyphIndexes_QList.reserve(glyphIndexes->len); unsigned int* glyphIndexes_arr = static_cast(glyphIndexes->data); for(size_t i = 0; i < glyphIndexes->len; ++i) { glyphIndexes_QList.push_back(glyphIndexes_arr[i]); } QVector _ret = self->advancesForGlyphIndexes(glyphIndexes_QList); // Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers QPointF** _arr = static_cast(malloc(sizeof(QPointF**) * _ret.length())); for (size_t i = 0, e = _ret.length(); i < e; ++i) { _arr[i] = new QPointF(_ret[i]); } struct miqt_array* _out = static_cast(malloc(sizeof(struct miqt_array))); _out->len = _ret.length(); _out->data = static_cast(_arr); return _out; } struct miqt_array* QRawFont_AdvancesForGlyphIndexes2(const QRawFont* self, struct miqt_array* /* of unsigned int */ glyphIndexes, int layoutFlags) { QVector glyphIndexes_QList; glyphIndexes_QList.reserve(glyphIndexes->len); unsigned int* glyphIndexes_arr = static_cast(glyphIndexes->data); for(size_t i = 0; i < glyphIndexes->len; ++i) { glyphIndexes_QList.push_back(glyphIndexes_arr[i]); } QVector _ret = self->advancesForGlyphIndexes(glyphIndexes_QList, static_cast(layoutFlags)); // Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers QPointF** _arr = static_cast(malloc(sizeof(QPointF**) * _ret.length())); for (size_t i = 0, e = _ret.length(); i < e; ++i) { _arr[i] = new QPointF(_ret[i]); } struct miqt_array* _out = static_cast(malloc(sizeof(struct miqt_array))); _out->len = _ret.length(); _out->data = static_cast(_arr); return _out; } bool QRawFont_GlyphIndexesForChars(const QRawFont* self, QChar* chars, int numChars, unsigned int* glyphIndexes, int* numGlyphs) { return self->glyphIndexesForChars(chars, static_cast(numChars), static_cast(glyphIndexes), static_cast(numGlyphs)); } bool QRawFont_AdvancesForGlyphIndexes3(const QRawFont* self, const unsigned int* glyphIndexes, QPointF* advances, int numGlyphs) { return self->advancesForGlyphIndexes(static_cast(glyphIndexes), advances, static_cast(numGlyphs)); } bool QRawFont_AdvancesForGlyphIndexes4(const QRawFont* self, const unsigned int* glyphIndexes, QPointF* advances, int numGlyphs, int layoutFlags) { return self->advancesForGlyphIndexes(static_cast(glyphIndexes), advances, static_cast(numGlyphs), static_cast(layoutFlags)); } QImage* QRawFont_AlphaMapForGlyph(const QRawFont* self, unsigned int glyphIndex) { QImage _ret = self->alphaMapForGlyph(static_cast(glyphIndex)); // Copy-construct value returned type into heap-allocated copy return static_cast(new QImage(_ret)); } QPainterPath* QRawFont_PathForGlyph(const QRawFont* self, unsigned int glyphIndex) { QPainterPath _ret = self->pathForGlyph(static_cast(glyphIndex)); // Copy-construct value returned type into heap-allocated copy return static_cast(new QPainterPath(_ret)); } QRectF* QRawFont_BoundingRect(const QRawFont* self, unsigned int glyphIndex) { QRectF _ret = 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(const QRawFont* self) { return self->pixelSize(); } uintptr_t QRawFont_HintingPreference(const QRawFont* self) { QFont::HintingPreference _ret = self->hintingPreference(); return static_cast(_ret); } double QRawFont_Ascent(const QRawFont* self) { return self->ascent(); } double QRawFont_CapHeight(const QRawFont* self) { return self->capHeight(); } double QRawFont_Descent(const QRawFont* self) { return self->descent(); } double QRawFont_Leading(const QRawFont* self) { return self->leading(); } double QRawFont_XHeight(const QRawFont* self) { return self->xHeight(); } double QRawFont_AverageCharWidth(const QRawFont* self) { return self->averageCharWidth(); } double QRawFont_MaxCharWidth(const QRawFont* self) { return self->maxCharWidth(); } double QRawFont_LineThickness(const QRawFont* self) { return self->lineThickness(); } double QRawFont_UnderlinePosition(const QRawFont* self) { return self->underlinePosition(); } double QRawFont_UnitsPerEm(const QRawFont* self) { return self->unitsPerEm(); } void QRawFont_LoadFromFile(QRawFont* self, struct miqt_string* fileName, double pixelSize, uintptr_t hintingPreference) { QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len); 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(const QRawFont* self, unsigned int ucs4) { return self->supportsCharacter(static_cast(ucs4)); } bool QRawFont_SupportsCharacterWithCharacter(const QRawFont* self, QChar* character) { return self->supportsCharacter(*character); } struct miqt_array* QRawFont_SupportedWritingSystems(const QRawFont* self) { QList _ret = self->supportedWritingSystems(); // Convert QList<> from C++ memory to manually-managed C memory uintptr_t* _arr = static_cast(malloc(sizeof(uintptr_t) * _ret.length())); for (size_t i = 0, e = _ret.length(); i < e; ++i) { _arr[i] = _ret[i]; } struct miqt_array* _out = static_cast(malloc(sizeof(struct miqt_array))); _out->len = _ret.length(); _out->data = static_cast(_arr); return _out; } QByteArray* QRawFont_FontTable(const QRawFont* self, const char* tagName) { QByteArray _ret = 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(const QRawFont* self, unsigned int glyphIndex, uintptr_t antialiasingType) { QImage _ret = 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(const QRawFont* self, unsigned int glyphIndex, uintptr_t antialiasingType, QTransform* transform) { QImage _ret = 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; }