ScummVM API documentation
EEM::EEMFont Class Reference

#include <font.h>

Inheritance diagram for EEM::EEMFont:
Graphics::Font

Public Member Functions

bool load (const Common::Path &path)
 
bool loadMacResource (const Common::Path &path, uint16 resourceId, int size)
 
bool isLoaded () const
 
int getFontHeight () const override
 
int getMaxCharWidth () const override
 
int getCharWidth (uint32 chr) const override
 
void drawChar (Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override
 
int drawWordWrapped (Graphics::ManagedSurface *dst, int x, int y, int width, const Common::String &s, uint32 color) const
 
- Public Member Functions inherited from Graphics::Font
virtual Common::String getFontName () const
 
virtual int getFontAscent () const
 
virtual int getFontDescent () const
 
virtual int getFontLeading () const
 
virtual int getKerningOffset (uint32 left, uint32 right) const
 
virtual Common::Rect getBoundingBox (uint32 chr) 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, bool allowCharClipping=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, bool allowCharClipping=false) const
 
virtual void drawChar (ManagedSurface *dst, uint32 chr, int x, int y, uint32 color) const
 
virtual void drawAlphaChar (Surface *dst, uint32 chr, int x, int y, uint32 color) const
 
virtual void drawAlphaChar (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, bool allowCharClipping=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, bool allowCharClipping=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, bool allowCharClipping=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, bool allowCharClipping=false) const
 
void drawAlphaString (Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align=kTextAlignLeft, int deltax=0, bool useEllipsis=false, bool allowCharClipping=false) const
 
void drawAlphaString (Surface *dst, const Common::U32String &str, int x, int y, int w, uint32 color, TextAlign align=kTextAlignLeft, int deltax=0, bool useEllipsis=false, bool allowCharClipping=false) const
 
void drawAlphaString (ManagedSurface *dst, const Common::String &str, int x, int _y, int w, uint32 color, TextAlign align=kTextAlignLeft, int deltax=0, bool useEllipsis=false, bool allowCharClipping=false) const
 
void drawAlphaString (ManagedSurface *dst, const Common::U32String &str, int x, int y, int w, uint32 color, TextAlign align=kTextAlignLeft, int deltax=0, bool useEllipsis=false, bool allowCharClipping=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
 

Detailed Description

Loader for .FNT files (FONT.FNT, SYSTEM.FNT, TINY.FNT, 8PNTTHIN.FNT). _LoadFont @ 1b66:023c.

Layout: u16 numChars, then per char u8 height, u8 widthBits, u8 sizeBytes, bytes[sizeBytes] bitmap.

Char → glyph table extracted from CHR2FNT (29b6:0000).

Member Function Documentation

◆ getFontHeight()

int EEM::EEMFont::getFontHeight ( ) const
overridevirtual

Return the height of the font.

Returns
Font height in pixels.

Implements Graphics::Font.

◆ getMaxCharWidth()

int EEM::EEMFont::getMaxCharWidth ( ) const
overridevirtual

Return the maximum width of the font.

Returns
Maximum font width in pixels.

Implements Graphics::Font.

◆ getCharWidth()

int EEM::EEMFont::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()

void EEM::EEMFont::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.

◆ drawWordWrapped()

int EEM::EEMFont::drawWordWrapped ( Graphics::ManagedSurface dst,
int  x,
int  y,
int  width,
const Common::String s,
uint32  color 
) const

Wrap s to width via the inherited wordWrapText and draw each line at (x, y) downward. Returns total height drawn.


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