xoreos  0.0.5
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Graphics::Aurora::NFTRFont Class Reference

#include <nftrfont.h>

Inheritance diagram for Graphics::Aurora::NFTRFont:
Inheritance graph
[legend]
Collaboration diagram for Graphics::Aurora::NFTRFont:
Collaboration graph
[legend]

Classes

struct  Char
 A font character. More...
 
struct  Glyph
 
struct  Header
 

Public Member Functions

 NFTRFont (Common::SeekableReadStream *nftr, bool invertPalette=false)
 
 NFTRFont (const Common::UString &name, bool invertPalette=false)
 
 ~NFTRFont ()
 
float getWidth (uint32 c) const
 Return the width of a character. More...
 
float getHeight () const
 Return the height of a character. More...
 
void draw (uint32 c) const
 Draw this character. More...
 
- Public Member Functions inherited from Graphics::Font
 Font ()
 
virtual ~Font ()
 
virtual float getLineSpacing () const
 Return the size of space between lines. More...
 
size_t getLineCount (const Common::UString &text, float maxWidth=0.0f, float maxHeight=0.0f) const
 Return the number of lines this text spans. More...
 
float getWidth (const Common::UString &text, float maxWidth=0.0f) const
 Return the width this string would take. More...
 
float getHeight (const Common::UString &text, float maxWidth=0.0f, float maxHeight=0.0f) const
 Return the height this string would take. More...
 
float getLineWidth (const Common::UString &text) const
 Return the width of this string. More...
 
virtual void buildChars (const Common::UString &str)
 Build all necessary characters to display this string. More...
 
virtual void renderBind (const glm::mat4 &transform) const
 
virtual void render (uint32 c, float &x, float &y, float *rgba) const
 
virtual void renderUnbind () const
 
float split (const Common::UString &line, std::vector< Common::UString > &lines, float maxWidth=0.0f, float maxHeight=0.0f, bool trim=true) const
 
float split (Common::UString &line, float maxWidth, float maxHeight=0.0f, bool trim=true) const
 
float split (const Common::UString &line, Common::UString &lines, float maxWidth, float maxHeight=0.0f, bool trim=true) const
 

Private Member Functions

void load (Common::SeekableSubReadStreamEndian &nftr)
 
void readHeader (Common::SeekableSubReadStreamEndian &nftr, Header &header)
 
void readInfo (Common::SeekableSubReadStreamEndian &nftr, Header &header)
 
void readGlyphs (Common::SeekableSubReadStreamEndian &nftr, Header &header, std::vector< Glyph > &glyphs)
 
void readWidths (Common::SeekableSubReadStreamEndian &nftr, Header &header, std::vector< Glyph > &glyphs)
 
void readCharMaps (Common::SeekableSubReadStreamEndian &nftr, Header &header, std::vector< Glyph > &glyphs)
 
void drawGlyphs (const std::vector< Glyph > &glyphs)
 
void drawGlyph (const Glyph &glyph, Surface &surface, uint32 x, uint32 y)
 
void drawMissing () const
 

Static Private Member Functions

static uint32 convertToUTF32 (uint16 codePoint, uint8 encoding)
 

Private Attributes

bool _invertPalette
 
Surface_surface
 
TextureHandle _texture
 
std::map< uint32, Char_chars
 
float _missingWidth
 
uint32 _height
 

Additional Inherited Members

- Static Protected Member Functions inherited from Aurora::NitroFile
static Common::SeekableSubReadStreamEndianopen (Common::SeekableReadStream &stream)
 Treat this stream as a Nitro file and return an endian'd stream according to its BOM. More...
 
static Common::SeekableSubReadStreamEndianopen (Common::SeekableReadStream *stream)
 Treat this stream as a Nitro file, take it over and return an endian'd stream according to its BOM. More...
 

Detailed Description

Definition at line 45 of file nftrfont.h.

Constructor & Destructor Documentation

◆ NFTRFont() [1/2]

Graphics::Aurora::NFTRFont::NFTRFont ( Common::SeekableReadStream nftr,
bool  invertPalette = false 
)

Definition at line 89 of file nftrfont.cpp.

References load(), and Aurora::NitroFile::open().

Here is the call graph for this function:

◆ NFTRFont() [2/2]

Graphics::Aurora::NFTRFont::NFTRFont ( const Common::UString name,
bool  invertPalette = false 
)

Definition at line 99 of file nftrfont.cpp.

References Common::UString::c_str(), Aurora::kFileTypeNFTR, load(), Aurora::NitroFile::open(), and ResMan.

Here is the call graph for this function:

◆ ~NFTRFont()

Graphics::Aurora::NFTRFont::~NFTRFont ( )

Definition at line 111 of file nftrfont.cpp.

Member Function Documentation

◆ convertToUTF32()

uint32 Graphics::Aurora::NFTRFont::convertToUTF32 ( uint16  codePoint,
uint8  encoding 
)
staticprivate

Definition at line 521 of file nftrfont.cpp.

References Common::UString::begin(), Common::UString::empty(), Common::kEncodingCP1252, Common::kEncodingInvalid, Common::kEncodingUTF16LE, and Common::readString().

Referenced by readCharMaps().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw()

void Graphics::Aurora::NFTRFont::draw ( uint32  c) const
virtual

Draw this character.

Implements Graphics::Font.

Definition at line 391 of file nftrfont.cpp.

References _chars, _texture, drawMissing(), and TextureMan.

Here is the call graph for this function:

◆ drawGlyph()

void Graphics::Aurora::NFTRFont::drawGlyph ( const Glyph glyph,
Surface surface,
uint32  x,
uint32  y 
)
private

◆ drawGlyphs()

void Graphics::Aurora::NFTRFont::drawGlyphs ( const std::vector< Glyph > &  glyphs)
private

◆ drawMissing()

void Graphics::Aurora::NFTRFont::drawMissing ( ) const
private

Definition at line 376 of file nftrfont.cpp.

References _height, _missingWidth, and TextureMan.

Referenced by draw().

Here is the caller graph for this function:

◆ getHeight()

float Graphics::Aurora::NFTRFont::getHeight ( ) const
virtual

Return the height of a character.

Implements Graphics::Font.

Definition at line 372 of file nftrfont.cpp.

References _height.

◆ getWidth()

float Graphics::Aurora::NFTRFont::getWidth ( uint32  c) const
virtual

Return the width of a character.

Implements Graphics::Font.

Definition at line 364 of file nftrfont.cpp.

References _chars, and _missingWidth.

◆ load()

void Graphics::Aurora::NFTRFont::load ( Common::SeekableSubReadStreamEndian nftr)
private

Definition at line 114 of file nftrfont.cpp.

References _chars, _height, _missingWidth, drawGlyphs(), Graphics::Aurora::NFTRFont::Header::height, readCharMaps(), readGlyphs(), readHeader(), and readWidths().

Referenced by NFTRFont().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readCharMaps()

void Graphics::Aurora::NFTRFont::readCharMaps ( Common::SeekableSubReadStreamEndian nftr,
Header header,
std::vector< Glyph > &  glyphs 
)
private

◆ readGlyphs()

void Graphics::Aurora::NFTRFont::readGlyphs ( Common::SeekableSubReadStreamEndian nftr,
Header header,
std::vector< Glyph > &  glyphs 
)
private

◆ readHeader()

void Graphics::Aurora::NFTRFont::readHeader ( Common::SeekableSubReadStreamEndian nftr,
Header header 
)
private

◆ readInfo()

void Graphics::Aurora::NFTRFont::readInfo ( Common::SeekableSubReadStreamEndian nftr,
Header header 
)
private

◆ readWidths()

void Graphics::Aurora::NFTRFont::readWidths ( Common::SeekableSubReadStreamEndian nftr,
Header header,
std::vector< Glyph > &  glyphs 
)
private

Member Data Documentation

◆ _chars

std::map<uint32, Char> Graphics::Aurora::NFTRFont::_chars
private

Definition at line 100 of file nftrfont.h.

Referenced by draw(), drawGlyphs(), getWidth(), and load().

◆ _height

uint32 Graphics::Aurora::NFTRFont::_height
private

Definition at line 104 of file nftrfont.h.

Referenced by drawMissing(), getHeight(), and load().

◆ _invertPalette

bool Graphics::Aurora::NFTRFont::_invertPalette
private

Definition at line 95 of file nftrfont.h.

Referenced by drawGlyph().

◆ _missingWidth

float Graphics::Aurora::NFTRFont::_missingWidth
private

Definition at line 102 of file nftrfont.h.

Referenced by drawMissing(), getWidth(), and load().

◆ _surface

Surface* Graphics::Aurora::NFTRFont::_surface
private

Definition at line 97 of file nftrfont.h.

Referenced by drawGlyphs().

◆ _texture

TextureHandle Graphics::Aurora::NFTRFont::_texture
private

Definition at line 98 of file nftrfont.h.

Referenced by draw(), and drawGlyphs().


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