NAP
Public Member Functions | Protected Member Functions | List of all members
RenderableGlyph Class Reference

#include <renderableglyph.h>

Public Member Functions

 RenderableGlyph (nap::Core &core)
 
virtual ~RenderableGlyph () override
 
const glm::ivec2 & getSize () const
 
const glm::ivec2 & getBearing () const
 
int getWidth () const
 
int getHeight () const
 
int getOffsetLeft () const
 
int getOffsetTop () const
 
const Texture2D & getTexture () const
 
Texture2D & getTexture ()
 
int getHorizontalAdvance () const
 
int getVerticalAdvance () const
 
bool empty () const
 
- Public Member Functions inherited from IGlyphRepresentation
virtual ~IGlyphRepresentation ()
 
 IGlyphRepresentation (nap::Core &core)
 
 IGlyphRepresentation (const IGlyphRepresentation &other)=delete
 
IGlyphRepresentation & operator= (const IGlyphRepresentation &)=delete
 
 IGlyphRepresentation (IGlyphRepresentation &&other)=delete
 
IGlyphRepresentation & operator= (IGlyphRepresentation &&other)=delete
 

Protected Member Functions

virtual bool setup (const Glyph &glyph, bool generateMipmaps, utility::ErrorState &errorCode)
 
- Protected Member Functions inherited from IGlyphRepresentation
bool init (const Glyph &glyph, utility::ErrorState &error)
 
virtual bool onInit (const Glyph &glyph, utility::ErrorState &error)=0
 

Additional Inherited Members

- Protected Attributes inherited from IGlyphRepresentation
nap::Core * mCore
 Handle to core instance. More...
 

Description

Represents a symbol (character) in a font that can be rendered. The glyph is rendered to a 2D texture that can be tied to a material. The glyph is converted to a bitmap on initialization and uploaded to the GPU. The bitmap is deleted after storage on the GPU.

Inheritance diagram for RenderableGlyph:
[legend]
Collaboration diagram for RenderableGlyph:
[legend]

Constructor & Destructor Documentation

◆ RenderableGlyph()

◆ ~RenderableGlyph()

virtual ~RenderableGlyph ( )
overridevirtual

Member Function Documentation

◆ empty()

bool empty ( ) const

If this render-able glyph has a texture.

Returns
if this glyph has a texture associated with it

◆ getBearing()

const glm::ivec2& getBearing ( ) const
Returns
offset from baseline to top / left of glyph in pixels

◆ getHeight()

int getHeight ( ) const
Returns
height of the glyph in pixels

◆ getHorizontalAdvance()

int getHorizontalAdvance ( ) const
Returns
horizontal glyph advance value in pixels

◆ getOffsetLeft()

int getOffsetLeft ( ) const
Returns
Offset from baseline to the left in pixels

◆ getOffsetTop()

int getOffsetTop ( ) const
Returns
Offset from baseline to the left in pixels

◆ getSize()

const glm::ivec2& getSize ( ) const
Returns
size of the glyph in pixels

◆ getTexture() [1/2]

Texture2D& getTexture ( )
Returns
the 2D Texture

◆ getTexture() [2/2]

const Texture2D& getTexture ( ) const
Returns
the 2D Texture

◆ getVerticalAdvance()

int getVerticalAdvance ( ) const
Returns
vertical glyph advance value in pixels

◆ getWidth()

int getWidth ( ) const
Returns
width of the glyph in pixels

◆ setup()

virtual bool setup ( const Glyph &  glyph,
bool  generateMipmaps,
utility::ErrorState &  errorCode 
)
protectedvirtual

Initializes the 2DTexture after construction of this glyph. First it converts the free-type glyph into a bitmap. This bitmap is uploaded to the GPU.

Returns
if the 2DTexture has been initialized correctly.