xoreos
0.0.5
|
#include <nftrfont.h>
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::SeekableSubReadStreamEndian * | open (Common::SeekableReadStream &stream) |
Treat this stream as a Nitro file and return an endian'd stream according to its BOM. More... | |
static Common::SeekableSubReadStreamEndian * | open (Common::SeekableReadStream *stream) |
Treat this stream as a Nitro file, take it over and return an endian'd stream according to its BOM. More... | |
Definition at line 45 of file nftrfont.h.
Graphics::Aurora::NFTRFont::NFTRFont | ( | Common::SeekableReadStream * | nftr, |
bool | invertPalette = false |
||
) |
Definition at line 89 of file nftrfont.cpp.
References load(), and Aurora::NitroFile::open().
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.
Graphics::Aurora::NFTRFont::~NFTRFont | ( | ) |
Definition at line 111 of file nftrfont.cpp.
|
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().
|
virtual |
Draw this character.
Implements Graphics::Font.
Definition at line 391 of file nftrfont.cpp.
References _chars, _texture, drawMissing(), and TextureMan.
|
private |
Definition at line 471 of file nftrfont.cpp.
References _invertPalette, Graphics::Aurora::NFTRFont::Glyph::data, Graphics::Aurora::NFTRFont::Glyph::depth, Graphics::Surface::getData(), Graphics::Surface::getWidth(), Graphics::Aurora::NFTRFont::Glyph::height, Graphics::Aurora::NFTRFont::Glyph::palMode, Common::ReadStream::readByte(), Common::SeekableReadStream::seek(), and Graphics::Aurora::NFTRFont::Glyph::width.
Referenced by drawGlyphs().
|
private |
Definition at line 410 of file nftrfont.cpp.
References _chars, _surface, _texture, Graphics::Aurora::Texture::create(), drawGlyph(), Graphics::Aurora::TextureHandle::getTexture(), NEXTPOWER2(), Graphics::GLContainer::rebuild(), TextureMan, Graphics::Aurora::NFTRFont::Char::tX, Graphics::Aurora::NFTRFont::Char::tY, Graphics::Aurora::NFTRFont::Char::vX, Graphics::Aurora::NFTRFont::Char::vY, and Graphics::Aurora::NFTRFont::Char::width.
Referenced by load().
|
private |
Definition at line 376 of file nftrfont.cpp.
References _height, _missingWidth, and TextureMan.
Referenced by draw().
|
virtual |
Return the height of a character.
Implements Graphics::Font.
Definition at line 372 of file nftrfont.cpp.
References _height.
|
virtual |
Return the width of a character.
Implements Graphics::Font.
Definition at line 364 of file nftrfont.cpp.
References _chars, and _missingWidth.
|
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().
|
private |
Definition at line 276 of file nftrfont.cpp.
References convertToUTF32(), Common::debugTag(), Graphics::Aurora::NFTRFont::Header::encoding, kCMAPID, Graphics::Aurora::NFTRFont::Header::offsetCMAP, Common::SeekableSubReadStreamEndian::readUint16(), Common::SeekableSubReadStreamEndian::readUint32(), Common::SeekableSubReadStream::seek(), and Common::SeekableSubReadStream::size().
Referenced by load().
|
private |
Definition at line 187 of file nftrfont.cpp.
References Common::debugTag(), kCGLPID, Graphics::Aurora::NFTRFont::Header::offsetCGLP, Graphics::Aurora::NFTRFont::Header::palMode, Common::SeekableSubReadStream::pos(), Common::ReadStream::readByte(), Common::SeekableSubReadStreamEndian::readUint16(), Common::SeekableSubReadStreamEndian::readUint32(), Common::SeekableSubReadStream::seek(), Common::SeekableReadStream::skip(), and Graphics::Aurora::NFTRFont::Header::width.
Referenced by load().
|
private |
Definition at line 132 of file nftrfont.cpp.
References Common::debugTag(), kNFTRID, Graphics::Aurora::NFTRFont::Header::palMode, Common::ReadStream::readByte(), readInfo(), Common::SeekableSubReadStreamEndian::readUint16(), Common::SeekableSubReadStreamEndian::readUint32(), Common::SeekableSubReadStream::size(), and Common::SeekableReadStream::skip().
Referenced by load().
|
private |
Definition at line 157 of file nftrfont.cpp.
References Common::debugTag(), Graphics::Aurora::NFTRFont::Header::encoding, Graphics::Aurora::NFTRFont::Header::height, kFINFID, Graphics::Aurora::NFTRFont::Header::offsetCGLP, Graphics::Aurora::NFTRFont::Header::offsetCMAP, Graphics::Aurora::NFTRFont::Header::offsetCWDH, Common::ReadStream::readByte(), Common::SeekableSubReadStreamEndian::readUint32(), Common::SeekableReadStream::skip(), and Graphics::Aurora::NFTRFont::Header::width.
Referenced by readHeader().
|
private |
Definition at line 239 of file nftrfont.cpp.
References Common::debugTag(), kCWDHID, Graphics::Aurora::NFTRFont::Header::offsetCWDH, Common::ReadStream::readByte(), Common::SeekableSubReadStreamEndian::readUint16(), Common::SeekableSubReadStreamEndian::readUint32(), Common::SeekableSubReadStream::seek(), and Common::SeekableReadStream::skip().
Referenced by load().
Definition at line 100 of file nftrfont.h.
Referenced by draw(), drawGlyphs(), getWidth(), and load().
|
private |
Definition at line 104 of file nftrfont.h.
Referenced by drawMissing(), getHeight(), and load().
|
private |
Definition at line 95 of file nftrfont.h.
Referenced by drawGlyph().
|
private |
Definition at line 102 of file nftrfont.h.
Referenced by drawMissing(), getWidth(), and load().
|
private |
Definition at line 97 of file nftrfont.h.
Referenced by drawGlyphs().
|
private |
Definition at line 98 of file nftrfont.h.
Referenced by draw(), and drawGlyphs().