55 bool isValid()
const {
return mAtlasSize.isValid(); }
67 QRect rect(
const QString &grapheme )
const;
75 QRect rect(
const QString &grapheme )
const;
77 const QRect res = sipCpp->rect( *a0 );
80 PyErr_SetString( PyExc_KeyError, QStringLiteral(
"No rectangle for character %1 exists." ).arg( *a0 ).toUtf8().constData() );
85 return sipConvertFromNewType(
new QRect( res ), sipType_QRect, Py_None );
96 int graphemeCount(
const QString &
string )
const;
104 int totalWidth(
const QString &
string )
const;
112 QPoint pixelOffsetForGrapheme(
const QString &
string,
int graphemeIndex )
const;
120 QRect textureRectForGrapheme(
const QString &
string,
int graphemeIndex )
const;
125 QImage renderAtlasTexture()
const;
133 QImage renderDebugTexture()
const;
143 Returns the number of textures in the atlas.
152 struct GraphemeMetric
154 GraphemeMetric(
int horizontalAdvance = 0,
const QString &grapheme = QString() )
155 : horizontalAdvance( horizontalAdvance )
156 , grapheme( grapheme )
159 int horizontalAdvance = 0;
166 QVector< GraphemeMetric > graphemeMetrics;
169 QgsTextFormat mFormat;
170 std::vector< QgsCharTextureRect > mRects;
172 QHash< QString, int > mGraphemeIndices;
173 QMap< QString, StringMetrics > mStringMetrics;
174 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)