Class: QgsFontTextureAtlas¶
Encapsulates a font texture atlas.
QgsFontTextureAtlas contains the packed texture atlas for a
font, along with the associated text metrics for rendering.
See QgsFontTextureAtlasGenerator for a class which
automatically creates texture atlases.
Added in version 4.0.
Methods
Returns the total size required for the atlas, i.e. the total size for the texture. |
|
Returns the number of textures in the atlas. |
|
Returns the number of graphemes to render for a given string. |
|
Returns |
|
Returns the pixel offset at which the texture for the matching grapheme should be placed. |
|
Returns the packed rectangle for the texture for the specified grapheme. |
|
Renders the combined texture atlas, containing all required characters. |
|
Renders a debug texture. |
|
Returns the packed rectangle for the texture for the matching grapheme. |
|
Returns the total width (in pixels) required for a given string. |
- class qgis._3d.QgsFontTextureAtlas[source]¶
Bases:
object- atlasSize(self) QSize[source]¶
Returns the total size required for the atlas, i.e. the total size for the texture.
- Return type:
QSize
- graphemeCount(self, string: str | None) int[source]¶
Returns the number of graphemes to render for a given
string.The
stringmust match one of the strings passed toQgsFontTextureAtlasGeneratorwhen creating the texture atlas.- Parameters:
string (Optional[str])
- Return type:
int
- pixelOffsetForGrapheme(self, string: str | None, graphemeIndex: int) QPoint[source]¶
Returns the pixel offset at which the texture for the matching grapheme should be placed.
The
stringmust match one of the strings passed toQgsFontTextureAtlasGeneratorwhen creating the texture atlas.- Parameters:
string (Optional[str])
graphemeIndex (int)
- Return type:
QPoint
- rect(self, grapheme: str | None) QRect[source]¶
Returns the packed rectangle for the texture for the specified
grapheme.- Raises:
KeyError – if no texture for the specified grapheme exists.
- Parameters:
grapheme (Optional[str])
- Return type:
QRect
- renderAtlasTexture(self) QImage[source]¶
Renders the combined texture atlas, containing all required characters.
- Return type:
QImage
- renderDebugTexture(self) QImage[source]¶
Renders a debug texture.
The debug texture renders all packed character rectangles with a unique color, and can be used to visualize the solution.
- Return type:
QImage
- textureRectForGrapheme(self, string: str | None, graphemeIndex: int) QRect[source]¶
Returns the packed rectangle for the texture for the matching grapheme.
The
stringmust match one of the strings passed toQgsFontTextureAtlasGeneratorwhen creating the texture atlas.- Parameters:
string (Optional[str])
graphemeIndex (int)
- Return type:
QRect
- totalWidth(self, string: str | None) int[source]¶
Returns the total width (in pixels) required for a given
string.The
stringmust match one of the strings passed toQgsFontTextureAtlasGeneratorwhen creating the texture atlas.- Parameters:
string (Optional[str])
- Return type:
int