58 bool isValid()
const {
return mAtlasSize.isValid(); }
70 QRect rect(
const QString &grapheme )
const;
78 QRect rect(
const QString &grapheme )
const;
80 const QRect res = sipCpp->rect( *a0 );
83 PyErr_SetString( PyExc_KeyError, u
"No rectangle for character %1 exists."_s.arg( *a0 ).toUtf8().constData() );
88 return sipConvertFromNewType(
new QRect( res ), sipType_QRect, Py_None );
99 int graphemeCount(
const QString &
string )
const;
107 int totalWidth(
const QString &
string )
const;
115 QPoint pixelOffsetForGrapheme(
const QString &
string,
int graphemeIndex )
const;
123 QRect textureRectForGrapheme(
const QString &
string,
int graphemeIndex )
const;
128 QImage renderAtlasTexture()
const;
136 QImage renderDebugTexture()
const;
147 Returns the number of textures in the atlas.
150 sipRes = sipCpp->count();
156 struct GraphemeMetric
158 GraphemeMetric(
int horizontalAdvance = 0,
const QString &grapheme = QString() )
159 : horizontalAdvance( horizontalAdvance )
160 , grapheme( grapheme )
163 int horizontalAdvance = 0;
170 QVector< GraphemeMetric > graphemeMetrics;
173 QgsTextFormat mFormat;
174 std::vector< QgsCharTextureRect > mRects;
176 QHash< QString, int > mGraphemeIndices;
177 QMap< QString, StringMetrics > mStringMetrics;
178 int mTexturePaddingPixels = 0;
Generates texture atlases for a font by efficiently packing the characters required for a set of stri...
static QgsFontTextureAtlas create(const QgsTextFormat &format, const QStringList &strings)
Creates the texture atlas for a set of strings, using the specified text format.
Encapsulates a font texture atlas.
QSize atlasSize() const
Returns the total size required for the atlas, i.e.
friend class QgsFontTextureAtlasGenerator
bool isValid() const
Returns true if the atlas is valid.
QgsFontTextureAtlas(const QgsFontTextureAtlas &other)
QgsFontTextureAtlas & operator=(const QgsFontTextureAtlas &other)