2024-08-25 04:08:24 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QChar>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QFont>
|
|
|
|
#include <QImage>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QList>
|
|
|
|
#include <QPainterPath>
|
|
|
|
#include <QPointF>
|
|
|
|
#include <QRawFont>
|
|
|
|
#include <QRectF>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
|
|
|
#include <QTransform>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qrawfont.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qrawfont.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
QRawFont* QRawFont_new() {
|
|
|
|
return new QRawFont();
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
QRawFont* QRawFont_new2(struct miqt_string* fileName, double pixelSize) {
|
|
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
2024-08-29 07:01:51 +00:00
|
|
|
return new QRawFont(fileName_QString, static_cast<qreal>(pixelSize));
|
|
|
|
}
|
|
|
|
|
|
|
|
QRawFont* QRawFont_new3(QByteArray* fontData, double pixelSize) {
|
|
|
|
return new QRawFont(*fontData, static_cast<qreal>(pixelSize));
|
|
|
|
}
|
|
|
|
|
|
|
|
QRawFont* QRawFont_new4(QRawFont* other) {
|
2024-08-25 04:08:24 +00:00
|
|
|
return new QRawFont(*other);
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
QRawFont* QRawFont_new5(struct miqt_string* fileName, double pixelSize, int hintingPreference) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
2024-08-29 07:01:51 +00:00
|
|
|
return new QRawFont(fileName_QString, static_cast<qreal>(pixelSize), static_cast<QFont::HintingPreference>(hintingPreference));
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
QRawFont* QRawFont_new6(QByteArray* fontData, double pixelSize, int hintingPreference) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return new QRawFont(*fontData, static_cast<qreal>(pixelSize), static_cast<QFont::HintingPreference>(hintingPreference));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QRawFont_OperatorAssign(QRawFont* self, QRawFont* other) {
|
|
|
|
self->operator=(*other);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QRawFont_Swap(QRawFont* self, QRawFont* other) {
|
|
|
|
self->swap(*other);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRawFont_IsValid(const QRawFont* self) {
|
|
|
|
return self->isValid();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRawFont_OperatorEqual(const QRawFont* self, QRawFont* other) {
|
|
|
|
return self->operator==(*other);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRawFont_OperatorNotEqual(const QRawFont* self, QRawFont* other) {
|
|
|
|
return self->operator!=(*other);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QRawFont_FamilyName(const QRawFont* self) {
|
|
|
|
QString _ret = self->familyName();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QRawFont_StyleName(const QRawFont* self) {
|
|
|
|
QString _ret = self->styleName();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
int QRawFont_Style(const QRawFont* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QFont::Style _ret = self->style();
|
2024-09-18 00:12:02 +00:00
|
|
|
return static_cast<int>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QRawFont_Weight(const QRawFont* self) {
|
|
|
|
return self->weight();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* QRawFont_GlyphIndexesForString(const QRawFont* self, struct miqt_string* text) {
|
|
|
|
QString text_QString = QString::fromUtf8(&text->data, text->len);
|
2024-09-18 00:12:02 +00:00
|
|
|
QVector<quint32> _ret = self->glyphIndexesForString(text_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
unsigned int* _arr = static_cast<unsigned int*>(malloc(sizeof(unsigned int) * _ret.length()));
|
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
_arr[i] = _ret[i];
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
|
|
_out->len = _ret.length();
|
|
|
|
_out->data = static_cast<void*>(_arr);
|
|
|
|
return _out;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* QRawFont_AdvancesForGlyphIndexes(const QRawFont* self, struct miqt_array* /* of unsigned int */ glyphIndexes) {
|
2024-10-16 05:07:56 +00:00
|
|
|
QVector<quint32> glyphIndexes_QList;
|
2024-09-14 22:29:05 +00:00
|
|
|
glyphIndexes_QList.reserve(glyphIndexes->len);
|
|
|
|
unsigned int* glyphIndexes_arr = static_cast<unsigned int*>(glyphIndexes->data);
|
|
|
|
for(size_t i = 0; i < glyphIndexes->len; ++i) {
|
2024-09-17 07:43:35 +00:00
|
|
|
glyphIndexes_QList.push_back(static_cast<unsigned int>(glyphIndexes_arr[i]));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
QVector<QPointF> _ret = self->advancesForGlyphIndexes(glyphIndexes_QList);
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
|
|
QPointF** _arr = static_cast<QPointF**>(malloc(sizeof(QPointF*) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
_arr[i] = new QPointF(_ret[i]);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
|
|
_out->len = _ret.length();
|
|
|
|
_out->data = static_cast<void*>(_arr);
|
|
|
|
return _out;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* QRawFont_AdvancesForGlyphIndexes2(const QRawFont* self, struct miqt_array* /* of unsigned int */ glyphIndexes, int layoutFlags) {
|
2024-10-16 05:07:56 +00:00
|
|
|
QVector<quint32> glyphIndexes_QList;
|
2024-09-14 22:29:05 +00:00
|
|
|
glyphIndexes_QList.reserve(glyphIndexes->len);
|
|
|
|
unsigned int* glyphIndexes_arr = static_cast<unsigned int*>(glyphIndexes->data);
|
|
|
|
for(size_t i = 0; i < glyphIndexes->len; ++i) {
|
2024-09-17 07:43:35 +00:00
|
|
|
glyphIndexes_QList.push_back(static_cast<unsigned int>(glyphIndexes_arr[i]));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
QVector<QPointF> _ret = self->advancesForGlyphIndexes(glyphIndexes_QList, static_cast<QRawFont::LayoutFlags>(layoutFlags));
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
|
|
QPointF** _arr = static_cast<QPointF**>(malloc(sizeof(QPointF*) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
_arr[i] = new QPointF(_ret[i]);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
|
|
_out->len = _ret.length();
|
|
|
|
_out->data = static_cast<void*>(_arr);
|
|
|
|
return _out;
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRawFont_GlyphIndexesForChars(const QRawFont* self, QChar* chars, int numChars, unsigned int* glyphIndexes, int* numGlyphs) {
|
|
|
|
return self->glyphIndexesForChars(chars, static_cast<int>(numChars), static_cast<quint32*>(glyphIndexes), static_cast<int*>(numGlyphs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRawFont_AdvancesForGlyphIndexes3(const QRawFont* self, const unsigned int* glyphIndexes, QPointF* advances, int numGlyphs) {
|
|
|
|
return self->advancesForGlyphIndexes(static_cast<const quint32*>(glyphIndexes), advances, static_cast<int>(numGlyphs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRawFont_AdvancesForGlyphIndexes4(const QRawFont* self, const unsigned int* glyphIndexes, QPointF* advances, int numGlyphs, int layoutFlags) {
|
|
|
|
return self->advancesForGlyphIndexes(static_cast<const quint32*>(glyphIndexes), advances, static_cast<int>(numGlyphs), static_cast<QRawFont::LayoutFlags>(layoutFlags));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QImage* QRawFont_AlphaMapForGlyph(const QRawFont* self, unsigned int glyphIndex) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QImage(self->alphaMapForGlyph(static_cast<quint32>(glyphIndex)));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QPainterPath* QRawFont_PathForGlyph(const QRawFont* self, unsigned int glyphIndex) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QPainterPath(self->pathForGlyph(static_cast<quint32>(glyphIndex)));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QRectF* QRawFont_BoundingRect(const QRawFont* self, unsigned int glyphIndex) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QRectF(self->boundingRect(static_cast<quint32>(glyphIndex)));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QRawFont_SetPixelSize(QRawFont* self, double pixelSize) {
|
|
|
|
self->setPixelSize(static_cast<qreal>(pixelSize));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QRawFont_PixelSize(const QRawFont* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qreal _ret = self->pixelSize();
|
|
|
|
return static_cast<double>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
int QRawFont_HintingPreference(const QRawFont* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QFont::HintingPreference _ret = self->hintingPreference();
|
2024-09-18 00:12:02 +00:00
|
|
|
return static_cast<int>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QRawFont_Ascent(const QRawFont* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qreal _ret = self->ascent();
|
|
|
|
return static_cast<double>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QRawFont_CapHeight(const QRawFont* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qreal _ret = self->capHeight();
|
|
|
|
return static_cast<double>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QRawFont_Descent(const QRawFont* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qreal _ret = self->descent();
|
|
|
|
return static_cast<double>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QRawFont_Leading(const QRawFont* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qreal _ret = self->leading();
|
|
|
|
return static_cast<double>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QRawFont_XHeight(const QRawFont* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qreal _ret = self->xHeight();
|
|
|
|
return static_cast<double>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QRawFont_AverageCharWidth(const QRawFont* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qreal _ret = self->averageCharWidth();
|
|
|
|
return static_cast<double>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QRawFont_MaxCharWidth(const QRawFont* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qreal _ret = self->maxCharWidth();
|
|
|
|
return static_cast<double>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QRawFont_LineThickness(const QRawFont* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qreal _ret = self->lineThickness();
|
|
|
|
return static_cast<double>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QRawFont_UnderlinePosition(const QRawFont* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qreal _ret = self->underlinePosition();
|
|
|
|
return static_cast<double>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QRawFont_UnitsPerEm(const QRawFont* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qreal _ret = self->unitsPerEm();
|
|
|
|
return static_cast<double>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
void QRawFont_LoadFromFile(QRawFont* self, struct miqt_string* fileName, double pixelSize, int hintingPreference) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
2024-08-29 07:01:51 +00:00
|
|
|
self->loadFromFile(fileName_QString, static_cast<qreal>(pixelSize), static_cast<QFont::HintingPreference>(hintingPreference));
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
void QRawFont_LoadFromData(QRawFont* self, QByteArray* fontData, double pixelSize, int hintingPreference) {
|
2024-08-29 07:01:51 +00:00
|
|
|
self->loadFromData(*fontData, static_cast<qreal>(pixelSize), static_cast<QFont::HintingPreference>(hintingPreference));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRawFont_SupportsCharacter(const QRawFont* self, unsigned int ucs4) {
|
|
|
|
return self->supportsCharacter(static_cast<uint>(ucs4));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRawFont_SupportsCharacterWithCharacter(const QRawFont* self, QChar* character) {
|
|
|
|
return self->supportsCharacter(*character);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* QRawFont_SupportedWritingSystems(const QRawFont* self) {
|
|
|
|
QList<QFontDatabase::WritingSystem> _ret = self->supportedWritingSystems();
|
2024-08-29 07:01:51 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-09-18 00:12:02 +00:00
|
|
|
int* _arr = static_cast<int*>(malloc(sizeof(int) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
2024-09-17 06:29:11 +00:00
|
|
|
QFontDatabase::WritingSystem _lv_ret = _ret[i];
|
2024-09-18 00:12:02 +00:00
|
|
|
_arr[i] = static_cast<int>(_lv_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
|
|
_out->len = _ret.length();
|
|
|
|
_out->data = static_cast<void*>(_arr);
|
|
|
|
return _out;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QByteArray* QRawFont_FontTable(const QRawFont* self, const char* tagName) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QByteArray(self->fontTable(tagName));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QRawFont* QRawFont_FromFont(QFont* font) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QRawFont(QRawFont::fromFont(*font));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
QImage* QRawFont_AlphaMapForGlyph2(const QRawFont* self, unsigned int glyphIndex, int antialiasingType) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QImage(self->alphaMapForGlyph(static_cast<quint32>(glyphIndex), static_cast<QRawFont::AntialiasingType>(antialiasingType)));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
QImage* QRawFont_AlphaMapForGlyph3(const QRawFont* self, unsigned int glyphIndex, int antialiasingType, QTransform* transform) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QImage(self->alphaMapForGlyph(static_cast<quint32>(glyphIndex), static_cast<QRawFont::AntialiasingType>(antialiasingType), *transform));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
QRawFont* QRawFont_FromFont2(QFont* font, int writingSystem) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QRawFont(QRawFont::fromFont(*font, static_cast<QFontDatabase::WritingSystem>(writingSystem)));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QRawFont_Delete(QRawFont* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|