ScummVM API documentation
Tetraedge::TeFont2 Class Reference

#include <te_font2.h>

Inheritance diagram for Tetraedge::TeFont2:
Tetraedge::TeIFont Graphics::Font Tetraedge::TeResource Tetraedge::TeObject Tetraedge::TeReferencesCounter

Classes

struct  GlyphData2
 

Public Member Functions

bool load (const Common::Path &path)
 
void unload ()
 
Graphics::FontgetAtSize (uint size) override
 
virtual int getFontHeight () const override
 
virtual int getMaxCharWidth () const override
 
virtual int getCharWidth (uint32 chr) const override
 
virtual void drawChar (Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override
 
virtual int getKerningOffset (uint32 left, uint32 right) const override
 
virtual Common::Rect getBBox (const Common::String &str, int fontSize) override
 
virtual Common::Rect getBoundingBox (uint32 chr) const override
 
virtual TeVector3f32 kerning (uint pxSize, uint isocode1, uint isocode2) override
 
virtual float height (uint pxSize) override
 
- Public Member Functions inherited from Tetraedge::TeIFont
virtual float ascender (uint pxSize)
 
virtual float descender (uint pxSize)
 
virtual void draw (TeImage &destImage, const Common::String &str, int fontSize, int yoff, const TeColor &col, AlignStyle alignMode)
 
virtual int getHeight (int fontSize)
 
virtual int wordWrapText (const Common::String &str, int fontSize, int maxWidth, Common::Array< Common::String > &lines)
 
virtual TeIFont::GlyphData glyph (uint pxSize, uint charcode)
 
- Public Member Functions inherited from Tetraedge::TeResource
void generateAccessName ()
 
const Common::PathgetAccessName () const
 
void setAccessName (const Common::Path &name)
 
- Public Member Functions inherited from Tetraedge::TeObject
void deleteLater ()
 
- Public Member Functions inherited from Tetraedge::TeReferencesCounter
bool decrementCounter ()
 
void incrementCounter ()
 
void resetCounter ()
 
- Public Member Functions inherited from Graphics::Font
virtual Common::String getFontName () const
 
virtual int getFontAscent () const
 
virtual int getFontDescent () const
 
virtual int getFontLeading () const
 
Common::Rect getBoundingBox (const Common::String &str, int x=0, int y=0, const int w=0, TextAlign align=kTextAlignLeft, int deltax=0, bool useEllipsis=false) const
 
Common::Rect getBoundingBox (const Common::U32String &str, int x=0, int _y=0, const int w=0, TextAlign align=kTextAlignLeft, int deltax=0, bool useEllipsis=false) const
 
virtual void drawChar (ManagedSurface *dst, uint32 chr, int x, int y, uint32 color) const
 
void drawString (Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align=kTextAlignLeft, int deltax=0, bool useEllipsis=false) const
 
void drawString (Surface *dst, const Common::U32String &str, int x, int y, int w, uint32 color, TextAlign align=kTextAlignLeft, int deltax=0, bool useEllipsis=false) const
 
void drawString (ManagedSurface *dst, const Common::String &str, int x, int _y, int w, uint32 color, TextAlign align=kTextAlignLeft, int deltax=0, bool useEllipsis=false) const
 
void drawString (ManagedSurface *dst, const Common::U32String &str, int x, int y, int w, uint32 color, TextAlign align=kTextAlignLeft, int deltax=0, bool useEllipsis=false) const
 
int getStringWidth (const Common::String &str) const
 
int getStringWidth (const Common::U32String &str) const
 
int wordWrapText (const Common::String &str, int maxWidth, Common::Array< Common::String > &lines, int initWidth=0, uint32 mode=kWordWrapOnExplicitNewLines) const
 
int wordWrapText (const Common::U32String &str, int maxWidth, Common::Array< Common::U32String > &lines, int initWidth=0, uint32 mode=kWordWrapOnExplicitNewLines) const
 
int wordWrapText (const Common::U32String &str, int maxWidth, Common::Array< Common::U32String > &lines, Common::Array< bool > &lineContinuation, int initWidth=0, uint32 mode=kWordWrapOnExplicitNewLines) const
 
void scaleSingleGlyph (Surface *scaleSurface, int *grayScaleMap, int grayScaleMapSize, int width, int height, int xOffset, int yOffset, int grayLevel, int chr, int srcheight, int srcwidth, float scale) const
 

Additional Inherited Members

- Public Types inherited from Tetraedge::TeIFont
enum  AlignStyle { AlignLeft, AlignRight, AlignJustify, AlignCenter }
 
- Static Public Member Functions inherited from Tetraedge::TeObject
static void deleteLaterStatic (TeObject *obj)
 
static void deleteNow ()
 
static void cleanup ()
 
- Protected Attributes inherited from Tetraedge::TeIFont
Common::CodePage _codePage
 

Detailed Description

A pre-rendered font format with positioning data used in Amerzone ('tef' format)

Member Function Documentation

◆ getFontHeight()

virtual int Tetraedge::TeFont2::getFontHeight ( ) const
overridevirtual

Return the height of the font.

Returns
Font height in pixels.

Implements Graphics::Font.

◆ getMaxCharWidth()

virtual int Tetraedge::TeFont2::getMaxCharWidth ( ) const
overridevirtual

Return the maximum width of the font.

Returns
Maximum font width in pixels.

Implements Graphics::Font.

◆ getCharWidth()

virtual int Tetraedge::TeFont2::getCharWidth ( uint32  chr) const
overridevirtual

Return the width of a specific character.

Parameters
chrThe character to query the width of.
Returns
The width of the character in pixels.

Implements Graphics::Font.

◆ drawChar()

virtual void Tetraedge::TeFont2::drawChar ( Graphics::Surface dst,
uint32  chr,
int  x,
int  y,
uint32  color 
) const
overridevirtual

Draw a character at a specific point on the surface.

Note that the point describes the top left edge point where to draw the character. This can be different from the top left edge point of the character's bounding box. For example, TTF fonts sometimes move characters like 't' by one (or more) pixels to the left to create better visual results. To query the actual bounding box of a character, use getBoundingBox.

See also
getBoundingBox

The Font implementation should take care of not drawing outside of the specified surface.

Parameters
dstThe surface to draw on.
chrThe character to draw.
xThe x coordinate where to draw the character.
yThe y coordinate where to draw the character.
colorThe color of the character.

Implements Graphics::Font.

◆ getKerningOffset()

virtual int Tetraedge::TeFont2::getKerningOffset ( uint32  left,
uint32  right 
) const
overridevirtual

Query the kerning offset between two characters.

Parameters
leftLeft character. Can be 0.
rightRight character. Can be 0.
Returns
The horizontal displacement.

Reimplemented from Graphics::Font.

◆ getBoundingBox()

virtual Common::Rect Tetraedge::TeFont2::getBoundingBox ( uint32  chr) const
overridevirtual

Calculate the bounding box of a character.

It is assumed that the character shall be drawn at position (0, 0).

The idea here is that the character might be drawn outside the rect (0, 0) to (getCharWidth(chr), getFontHeight()) for some fonts. This is common among TTF fonts.

The default implementation simply returns the rect with a width of getCharWidth(chr) and height of getFontHeight().

Parameters
chrThe character to draw.
Returns
The bounding box of the drawn glyph.

Reimplemented from Graphics::Font.


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