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

#include <ttf.h>

Collaboration diagram for Graphics::TTFRenderer:
Collaboration graph
[legend]

Public Member Functions

 TTFRenderer (Common::SeekableReadStream &ttfFile, int height)
 Create a TTF renderer with this TTF in the specified line height in pixels. More...
 
 ~TTFRenderer ()
 
int getHeight () const
 Return the height of a character in pixels. More...
 
int getMaxWidth () const
 Return the max width of a character in pixels. More...
 
bool hasChar (uint32 ch) const
 Does the font have the specified character? More...
 
int getCharWidth (uint32 ch) const
 Return the width of a specific character in pixels. More...
 
void drawCharacter (uint32 ch, Surface &surface, int x, int y)
 Draw a specific character onto a BGRA surface. More...
 

Private Member Functions

void getFaceMetrics (int &advance, int &yOffset, int &xMin) const
 

Private Attributes

FT_Library _library
 
FT_Face _face
 
Common::ScopedArray< byte_fileBuffer
 
int _width
 
int _height
 
int _ascent
 
int _descent
 

Detailed Description

Definition at line 40 of file ttf.h.

Constructor & Destructor Documentation

◆ TTFRenderer()

Graphics::TTFRenderer::TTFRenderer ( Common::SeekableReadStream ttfFile,
int  height 
)

Create a TTF renderer with this TTF in the specified line height in pixels.

Definition at line 48 of file ttf.cpp.

References _ascent, _descent, _face, _fileBuffer, _height, _library, _width, Common::ScopedPtrBase< T, Deallocator >::get(), Common::kReadError, Common::ReadStream::read(), Common::ScopedPtrBase< T, Deallocator >::reset(), and Common::SeekableReadStream::size().

Here is the call graph for this function:

◆ ~TTFRenderer()

Graphics::TTFRenderer::~TTFRenderer ( )

Definition at line 94 of file ttf.cpp.

References _face, and _library.

Member Function Documentation

◆ drawCharacter()

void Graphics::TTFRenderer::drawCharacter ( uint32  ch,
Surface surface,
int  x,
int  y 
)

Draw a specific character onto a BGRA surface.

Definition at line 134 of file ttf.cpp.

References _face, error(), Graphics::Surface::getData(), getFaceMetrics(), Graphics::Surface::getHeight(), and Graphics::Surface::getWidth().

Here is the call graph for this function:

◆ getCharWidth()

int Graphics::TTFRenderer::getCharWidth ( uint32  ch) const

Return the width of a specific character in pixels.

Definition at line 119 of file ttf.cpp.

References _face, error(), and getFaceMetrics().

Here is the call graph for this function:

◆ getFaceMetrics()

void Graphics::TTFRenderer::getFaceMetrics ( int &  advance,
int &  yOffset,
int &  xMin 
) const
private

Definition at line 107 of file ttf.cpp.

References _ascent, and _face.

Referenced by drawCharacter(), and getCharWidth().

Here is the caller graph for this function:

◆ getHeight()

int Graphics::TTFRenderer::getHeight ( ) const

Return the height of a character in pixels.

Definition at line 99 of file ttf.cpp.

References _height.

◆ getMaxWidth()

int Graphics::TTFRenderer::getMaxWidth ( ) const

Return the max width of a character in pixels.

Definition at line 103 of file ttf.cpp.

References _width.

◆ hasChar()

bool Graphics::TTFRenderer::hasChar ( uint32  ch) const

Does the font have the specified character?

Definition at line 115 of file ttf.cpp.

References _face.

Member Data Documentation

◆ _ascent

int Graphics::TTFRenderer::_ascent
private

Definition at line 67 of file ttf.h.

Referenced by getFaceMetrics(), and TTFRenderer().

◆ _descent

int Graphics::TTFRenderer::_descent
private

Definition at line 67 of file ttf.h.

Referenced by TTFRenderer().

◆ _face

FT_Face Graphics::TTFRenderer::_face
private

Definition at line 62 of file ttf.h.

Referenced by drawCharacter(), getCharWidth(), getFaceMetrics(), hasChar(), TTFRenderer(), and ~TTFRenderer().

◆ _fileBuffer

Common::ScopedArray<byte> Graphics::TTFRenderer::_fileBuffer
private

Definition at line 64 of file ttf.h.

Referenced by TTFRenderer().

◆ _height

int Graphics::TTFRenderer::_height
private

Definition at line 66 of file ttf.h.

Referenced by getHeight(), and TTFRenderer().

◆ _library

FT_Library Graphics::TTFRenderer::_library
private

Definition at line 61 of file ttf.h.

Referenced by TTFRenderer(), and ~TTFRenderer().

◆ _width

int Graphics::TTFRenderer::_width
private

Definition at line 66 of file ttf.h.

Referenced by getMaxWidth(), and TTFRenderer().


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