QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
QgsFontTextureAtlas Class Reference

Encapsulates a font texture atlas. More...

#include <qgsfonttextureatlasgenerator.h>

Public Member Functions

 QgsFontTextureAtlas ()
 QgsFontTextureAtlas (const QgsFontTextureAtlas &other)
 ~QgsFontTextureAtlas ()
QSize atlasSize () const
 Returns the total size required for the atlas, i.e.
int count () const
 Returns the number of textures in the atlas.
int graphemeCount (const QString &string) const
 Returns the number of graphemes to render for a given string.
bool isValid () const
 Returns true if the atlas is valid.
QgsFontTextureAtlasoperator= (const QgsFontTextureAtlas &other)
QPoint pixelOffsetForGrapheme (const QString &string, int graphemeIndex) const
 Returns the pixel offset at which the texture for the matching grapheme should be placed.
QRect rect (const QString &grapheme) const
 Returns the packed rectangle for the texture for the specified grapheme.
QImage renderAtlasTexture () const
 Renders the combined texture atlas, containing all required characters.
QImage renderDebugTexture () const
 Renders a debug texture.
QRect textureRectForGrapheme (const QString &string, int graphemeIndex) const
 Returns the packed rectangle for the texture for the matching grapheme.
int totalWidth (const QString &string) const
 Returns the total width (in pixels) required for a given string.

Friends

class QgsFontTextureAtlasGenerator

Detailed Description

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.

Since
QGIS 4.0

Definition at line 43 of file qgsfonttextureatlasgenerator.h.

Constructor & Destructor Documentation

◆ QgsFontTextureAtlas() [1/2]

QgsFontTextureAtlas::QgsFontTextureAtlas ( )
default

◆ ~QgsFontTextureAtlas()

QgsFontTextureAtlas::~QgsFontTextureAtlas ( )
default

◆ QgsFontTextureAtlas() [2/2]

QgsFontTextureAtlas::QgsFontTextureAtlas ( const QgsFontTextureAtlas & other)
default

Member Function Documentation

◆ atlasSize()

QSize QgsFontTextureAtlas::atlasSize ( ) const
inline

Returns the total size required for the atlas, i.e.

the total size for the texture.

Definition at line 61 of file qgsfonttextureatlasgenerator.h.

◆ count()

int QgsFontTextureAtlas::count ( ) const

Returns the number of textures in the atlas.

Definition at line 76 of file qgsfonttextureatlasgenerator.cpp.

◆ graphemeCount()

int QgsFontTextureAtlas::graphemeCount ( const QString & string) const

Returns the number of graphemes to render for a given string.

The string must match one of the strings passed to QgsFontTextureAtlasGenerator when creating the texture atlas.

Definition at line 90 of file qgsfonttextureatlasgenerator.cpp.

◆ isValid()

bool QgsFontTextureAtlas::isValid ( ) const
inline

Returns true if the atlas is valid.

Definition at line 55 of file qgsfonttextureatlasgenerator.h.

◆ operator=()

QgsFontTextureAtlas & QgsFontTextureAtlas::operator= ( const QgsFontTextureAtlas & other)
default

◆ pixelOffsetForGrapheme()

QPoint QgsFontTextureAtlas::pixelOffsetForGrapheme ( const QString & string,
int graphemeIndex ) const

Returns the pixel offset at which the texture for the matching grapheme should be placed.

The string must match one of the strings passed to QgsFontTextureAtlasGenerator when creating the texture atlas.

Definition at line 108 of file qgsfonttextureatlasgenerator.cpp.

◆ rect()

QRect QgsFontTextureAtlas::rect ( const QString & grapheme) const

Returns the packed rectangle for the texture for the specified grapheme.

Definition at line 81 of file qgsfonttextureatlasgenerator.cpp.

◆ renderAtlasTexture()

QImage QgsFontTextureAtlas::renderAtlasTexture ( ) const

Renders the combined texture atlas, containing all required characters.

Definition at line 136 of file qgsfonttextureatlasgenerator.cpp.

◆ renderDebugTexture()

QImage QgsFontTextureAtlas::renderDebugTexture ( ) const

Renders a debug texture.

The debug texture renders all packed character rectangles with a unique color, and can be used to visualize the solution.

Definition at line 155 of file qgsfonttextureatlasgenerator.cpp.

◆ textureRectForGrapheme()

QRect QgsFontTextureAtlas::textureRectForGrapheme ( const QString & string,
int graphemeIndex ) const

Returns the packed rectangle for the texture for the matching grapheme.

The string must match one of the strings passed to QgsFontTextureAtlasGenerator when creating the texture atlas.

Definition at line 122 of file qgsfonttextureatlasgenerator.cpp.

◆ totalWidth()

int QgsFontTextureAtlas::totalWidth ( const QString & string) const

Returns the total width (in pixels) required for a given string.

The string must match one of the strings passed to QgsFontTextureAtlasGenerator when creating the texture atlas.

Definition at line 99 of file qgsfonttextureatlasgenerator.cpp.

◆ QgsFontTextureAtlasGenerator

friend class QgsFontTextureAtlasGenerator
friend

Definition at line 176 of file qgsfonttextureatlasgenerator.h.


The documentation for this class was generated from the following files: