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

An ABC/SBM font, as used by Jade Empire. More...

#include <abcfont.h>

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

Classes

struct  Char
 A font character. More...
 

Public Member Functions

 ABCFont (const Common::UString &name)
 
 ~ABCFont ()
 
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...
 
virtual void renderBind (const glm::mat4 &transform) const
 Bind the font for rendering. More...
 
virtual void render (uint32 c, float &x, float &y, float *rgba) const
 
virtual void renderUnbind () const
 
- 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...
 
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 (const Common::UString &name)
 
void readCharDesc (Char &c, Common::SeekableReadStream &abc)
 
void calcCharVertices (Char &c)
 
const CharfindChar (uint32 c) const
 

Private Attributes

TextureHandle _texture
 
Mesh::MeshFont_mesh
 
Shader::ShaderMaterial_material
 
Shader::ShaderRenderable_renderable
 
uint8 _base
 
Char _invalid
 
Char _ascii [128]
 
std::map< uint32, Char_extended
 

Detailed Description

An ABC/SBM font, as used by Jade Empire.

Definition at line 50 of file abcfont.h.

Constructor & Destructor Documentation

◆ ABCFont()

Graphics::Aurora::ABCFont::ABCFont ( const Common::UString name)

◆ ~ABCFont()

Graphics::Aurora::ABCFont::~ABCFont ( )

Definition at line 56 of file abcfont.cpp.

References _material, and _renderable.

Member Function Documentation

◆ calcCharVertices()

void Graphics::Aurora::ABCFont::calcCharVertices ( Char c)
private

◆ draw()

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

◆ findChar()

const ABCFont::Char & Graphics::Aurora::ABCFont::findChar ( uint32  c) const
private

Definition at line 233 of file abcfont.cpp.

References _ascii, _extended, _invalid, and Common::UString::isASCII().

Referenced by draw(), getWidth(), and render().

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

◆ getHeight()

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

Return the height of a character.

Implements Graphics::Font.

Definition at line 61 of file abcfont.cpp.

◆ getWidth()

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

Return the width of a character.

Implements Graphics::Font.

Definition at line 65 of file abcfont.cpp.

References findChar(), Graphics::Aurora::ABCFont::Char::spaceL, Graphics::Aurora::ABCFont::Char::spaceR, and Graphics::Aurora::ABCFont::Char::width.

Here is the call graph for this function:

◆ load()

void Graphics::Aurora::ABCFont::load ( const Common::UString name)
private

◆ readCharDesc()

void Graphics::Aurora::ABCFont::readCharDesc ( Char c,
Common::SeekableReadStream abc 
)
private

◆ render()

void Graphics::Aurora::ABCFont::render ( uint32  c,
float &  x,
float &  y,
float *  rgba 
) const
virtual

◆ renderBind()

void Graphics::Aurora::ABCFont::renderBind ( const glm::mat4 &  transform) const
virtual

Bind the font for rendering.

Must be performed before render is called.

Parameters
transformBase modelview transform. Under most circumstances this is expected to be the identity matrix.

Reimplemented from Graphics::Font.

Definition at line 88 of file abcfont.cpp.

References _material, _mesh, _renderable, Graphics::Shader::ShaderSurface::bindGLState(), Graphics::Shader::ShaderMaterial::bindGLState(), Graphics::Shader::ShaderSurface::bindProgram(), Graphics::Shader::ShaderMaterial::bindProgram(), Graphics::Shader::ShaderRenderable::getProgram(), Graphics::Shader::ShaderRenderable::getSurface(), Graphics::Shader::ShaderProgram::glid, and Graphics::Mesh::Mesh::renderBind().

Here is the call graph for this function:

◆ renderUnbind()

void Graphics::Aurora::ABCFont::renderUnbind ( ) const
virtual

Member Data Documentation

◆ _ascii

Char Graphics::Aurora::ABCFont::_ascii[128]
private

Definition at line 90 of file abcfont.h.

Referenced by findChar(), and load().

◆ _base

uint8 Graphics::Aurora::ABCFont::_base
private

Definition at line 87 of file abcfont.h.

Referenced by load().

◆ _extended

std::map<uint32, Char> Graphics::Aurora::ABCFont::_extended
private

Definition at line 91 of file abcfont.h.

Referenced by findChar(), and load().

◆ _invalid

Char Graphics::Aurora::ABCFont::_invalid
private

Definition at line 89 of file abcfont.h.

Referenced by findChar(), and load().

◆ _material

Shader::ShaderMaterial* Graphics::Aurora::ABCFont::_material
private

Definition at line 84 of file abcfont.h.

Referenced by ABCFont(), renderBind(), renderUnbind(), and ~ABCFont().

◆ _mesh

Mesh::MeshFont* Graphics::Aurora::ABCFont::_mesh
private

Definition at line 83 of file abcfont.h.

Referenced by ABCFont(), render(), renderBind(), and renderUnbind().

◆ _renderable

Shader::ShaderRenderable* Graphics::Aurora::ABCFont::_renderable
private

Definition at line 85 of file abcfont.h.

Referenced by ABCFont(), renderBind(), renderUnbind(), and ~ABCFont().

◆ _texture

TextureHandle Graphics::Aurora::ABCFont::_texture
private

Definition at line 82 of file abcfont.h.

Referenced by ABCFont(), calcCharVertices(), and draw().


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