vdr 2.6.6
Public Member Functions | Static Public Member Functions | Static Private Attributes | List of all members
cFont Class Referenceabstract

#include <font.h>

Public Member Functions

virtual ~cFont ()
 
virtual const char * FontName (void) const
 
virtual int Size (void) const
 
virtual int Width (void) const =0
 
virtual int Width (uint c) const =0
 
virtual int Width (const char *s) const =0
 
virtual int Height (void) const =0
 
int Height (const char *s) const
 
virtual void DrawText (cBitmap *Bitmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const =0
 
virtual void DrawText (cPixmap *Pixmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const
 

Static Public Member Functions

static void SetFont (eDvbFont Font, const char *Name, int CharHeight)
 
static const cFontGetFont (eDvbFont Font)
 
static cFontCreateFont (const char *Name, int CharHeight, int CharWidth=0)
 
static bool GetAvailableFontNames (cStringList *FontNames, bool Monospaced=false)
 
static cString GetFontFileName (const char *FontName)
 

Static Private Attributes

static cFontfonts [] = { NULL }
 

Detailed Description

Definition at line 37 of file font.h.

Constructor & Destructor Documentation

◆ ~cFont()

virtual cFont::~cFont ( )
inlinevirtual

Definition at line 41 of file font.h.

Member Function Documentation

◆ CreateFont()

cFont * cFont::CreateFont ( const char * Name,
int CharHeight,
int CharWidth = 0 )
static

Creates a new font object with the given Name and makes its characters CharHeight pixels high.

The actual height of the required drawing area might be higher than CharHeight if the font contains descenders. If CharWidth is given, it overwrites the font's default width. Name is of the form "Family:Style", for instance "Verdana:Bold Italic" or "Times New Roman". See GetAvailableFontNames() for how to get a list of all available font names. If the requested font can't be created, a dummy font is returned. The caller must delete the font when it is no longer needed.

Definition at line 429 of file font.c.

References GetFontFileName(), and Height().

Referenced by cTrueColorDemo::Action(), CreateTinyFont(), cSkinLCARSDisplayChannel::cSkinLCARSDisplayChannel(), cSkinLCARSDisplayMenu::cSkinLCARSDisplayMenu(), DrawEllipseAlignments(), cSubtitleObject::Render(), and SetFont().

◆ DrawText() [1/2]

virtual void cFont::DrawText ( cBitmap * Bitmap,
int x,
int y,
const char * s,
tColor ColorFg,
tColor ColorBg,
int Width ) const
pure virtual

Draws the given text into the Bitmap at position (x, y) with the given colors.

The text will not exceed the given Width (if > 0), and will end with a complete character.

Implemented in cFreetypeFont, cDummyFont, and cCursesFont.

◆ DrawText() [2/2]

virtual void cFont::DrawText ( cPixmap * Pixmap,
int x,
int y,
const char * s,
tColor ColorFg,
tColor ColorBg,
int Width ) const
inlinevirtual

Reimplemented in cFreetypeFont, cDummyFont, and cCursesFont.

Definition at line 64 of file font.h.

◆ FontName()

virtual const char * cFont::FontName ( void ) const
inlinevirtual

Returns the font name.

Reimplemented in cFreetypeFont.

Definition at line 42 of file font.h.

Referenced by cHdffOsd::DrawText(), and GetFontFileName().

◆ GetAvailableFontNames()

bool cFont::GetAvailableFontNames ( cStringList * FontNames,
bool Monospaced = false )
static

Queries the font configuration for a list of available font names, which is returned in FontNames.

If Monospaced is true, only monospaced fonts will be returned. The resulting font names are in a format that can be used with GetFontFileName() to get the name of the actual font file. Returns true if any font names were found.

Definition at line 440 of file font.c.

References cVector< T >::Append(), cVector< T >::Size(), cStringList::Sort(), and strreplace().

Referenced by cMenuSetupOSD::cMenuSetupOSD().

◆ GetFont()

const cFont * cFont::GetFont ( eDvbFont Font)
static

Gets the given Font, which was previously set by a call to SetFont().

If no SetFont() call has been made, the font as defined in the setup is returned. GetFont() is not thread-safe, and shall only be called from the main thread! A font returned by GetFont() must only be used locally inside the function it was retrieved from, and no long term pointer to it shall be kept, because the cFont object may become invalid at any time after the function that called GetFont() has returned.

Definition at line 412 of file font.c.

References esyslog, Font, cSetup::FontFix, fontFix, cSetup::FontFixSize, cSetup::FontOsd, fontOsd, cSetup::FontOsdSize, fonts, cSetup::FontSml, cSetup::FontSmlSize, min(), SetFont(), Setup, and cSetup::UseSmallFont.

Referenced by cSkinClassicDisplayChannel::cSkinClassicDisplayChannel(), cSkinClassicDisplayMenu::cSkinClassicDisplayMenu(), cSkinClassicDisplayMessage::cSkinClassicDisplayMessage(), cSkinClassicDisplayReplay::cSkinClassicDisplayReplay(), cSkinClassicDisplayTracks::cSkinClassicDisplayTracks(), cSkinClassicDisplayVolume::cSkinClassicDisplayVolume(), cSkinLCARSDisplayChannel::cSkinLCARSDisplayChannel(), cSkinLCARSDisplayMenu::cSkinLCARSDisplayMenu(), cSkinLCARSDisplayMessage::cSkinLCARSDisplayMessage(), cSkinLCARSDisplayReplay::cSkinLCARSDisplayReplay(), cSkinLCARSDisplayTracks::cSkinLCARSDisplayTracks(), cSkinLCARSDisplayVolume::cSkinLCARSDisplayVolume(), cSkinSTTNGDisplayChannel::cSkinSTTNGDisplayChannel(), cSkinSTTNGDisplayMenu::cSkinSTTNGDisplayMenu(), cSkinSTTNGDisplayMessage::cSkinSTTNGDisplayMessage(), cSkinSTTNGDisplayReplay::cSkinSTTNGDisplayReplay(), cSkinSTTNGDisplayTracks::cSkinSTTNGDisplayTracks(), cSkinSTTNGDisplayVolume::cSkinSTTNGDisplayVolume(), cPictureControl::DisplayCaption(), cSkinLCARSDisplayChannel::DrawDate(), cSkinLCARSDisplayMenu::DrawDate(), cSkinLCARSDisplayReplay::DrawDate(), DrawDeviceData(), cSkinLCARSDisplayMenu::DrawDisk(), cSkinLCARSDisplayMenu::DrawFrameDisplay(), cSkinLCARSDisplayMenu::DrawInfo(), cSkinLCARSDisplayMenu::DrawLive(), cSkinLCARSDisplayMenu::DrawLoad(), cSkinLCARSDisplayMenu::DrawMainFrameLower(), cSkinLCARSDisplayMenu::DrawPlay(), cSkinLCARSDisplayMenu::DrawStatusElbows(), cSkinLCARSDisplayMenu::DrawTimers(), cSkinClassicDisplayMenu::DrawTitle(), cSkinSTTNGDisplayMenu::DrawTitle(), cSkinLCARSDisplayChannel::DrawTrack(), cSkinLCARSDisplayReplay::DrawTrack(), cSkinClassicDisplayChannel::Flush(), cSkinClassicDisplayMenu::Flush(), cSkinSTTNGDisplayChannel::Flush(), cSkinSTTNGDisplayMenu::Flush(), cSkinClassicDisplayMenu::GetTextAreaFont(), cSkinLCARSDisplayMenu::GetTextAreaFont(), cSkinSTTNGDisplayMenu::GetTextAreaFont(), cMenuEditStrItem::Set(), cSkinClassicDisplayMenu::SetButtons(), cSkinLCARSDisplayMenu::SetButtons(), cSkinSTTNGDisplayMenu::SetButtons(), cSkinClassicDisplayChannel::SetChannel(), cSkinLCARSDisplayChannel::SetChannel(), cSkinSTTNGDisplayChannel::SetChannel(), cSkinClassicDisplayReplay::SetCurrent(), cSkinLCARSDisplayReplay::SetCurrent(), cSkinSTTNGDisplayReplay::SetCurrent(), cSkinClassicDisplayMenu::SetEvent(), cSkinLCARSDisplayMenu::SetEvent(), cSkinSTTNGDisplayMenu::SetEvent(), cSkinClassicDisplayChannel::SetEvents(), cSkinLCARSDisplayChannel::SetEvents(), cSkinSTTNGDisplayChannel::SetEvents(), cSkinClassicDisplayTracks::SetItem(), cSkinLCARSDisplayTracks::SetItem(), cSkinSTTNGDisplayTracks::SetItem(), cSkinClassicDisplayMenu::SetItem(), cSkinLCARSDisplayMenu::SetItem(), cSkinSTTNGDisplayMenu::SetItem(), cSkinClassicDisplayReplay::SetJump(), cSkinLCARSDisplayReplay::SetJump(), cSkinSTTNGDisplayReplay::SetJump(), cSkinClassicDisplayChannel::SetMessage(), cSkinClassicDisplayMenu::SetMessage(), cSkinClassicDisplayReplay::SetMessage(), cSkinClassicDisplayMessage::SetMessage(), cSkinLCARSDisplayChannel::SetMessage(), cSkinLCARSDisplayMenu::SetMessage(), cSkinLCARSDisplayReplay::SetMessage(), cSkinLCARSDisplayMessage::SetMessage(), cSkinSTTNGDisplayChannel::SetMessage(), cSkinSTTNGDisplayMenu::SetMessage(), cSkinSTTNGDisplayReplay::SetMessage(), cSkinSTTNGDisplayMessage::SetMessage(), cSkinClassicDisplayMenu::SetRecording(), cSkinLCARSDisplayMenu::SetRecording(), cSkinLCARSDisplayReplay::SetRecording(), cSkinSTTNGDisplayMenu::SetRecording(), cSkinClassicDisplayReplay::SetTitle(), cSkinLCARSDisplayMenu::SetTitle(), cSkinLCARSDisplayReplay::SetTitle(), cSkinSTTNGDisplayReplay::SetTitle(), cSkinClassicDisplayReplay::SetTotal(), cSkinLCARSDisplayReplay::SetTotal(), cSkinSTTNGDisplayReplay::SetTotal(), and cSkinClassicDisplayVolume::SetVolume().

◆ GetFontFileName()

cString cFont::GetFontFileName ( const char * FontName)
static

Returns the actual font file name for the given FontName.

Definition at line 482 of file font.c.

References esyslog, FontName(), and strreplace().

Referenced by CreateFont(), and main().

◆ Height() [1/2]

int cFont::Height ( const char * s) const
inline

Returns the height of this font in pixel (obsolete, just for backwards compatibility).

Definition at line 59 of file font.h.

References Height().

Referenced by Height().

◆ Height() [2/2]

virtual int cFont::Height ( void ) const
pure virtual

Returns the height of this font in pixel (all characters have the same height).

If the font contains descenders, its total height may be higher than the character height specified during creation.

Implemented in cFreetypeFont, cDummyFont, and cCursesFont.

Referenced by cTrueColorDemo::Action(), CreateFont(), cSkinClassicDisplayChannel::cSkinClassicDisplayChannel(), cSkinClassicDisplayMenu::cSkinClassicDisplayMenu(), cSkinClassicDisplayMessage::cSkinClassicDisplayMessage(), cSkinClassicDisplayReplay::cSkinClassicDisplayReplay(), cSkinClassicDisplayTracks::cSkinClassicDisplayTracks(), cSkinClassicDisplayVolume::cSkinClassicDisplayVolume(), cSkinLCARSDisplayChannel::cSkinLCARSDisplayChannel(), cSkinLCARSDisplayMenu::cSkinLCARSDisplayMenu(), cSkinLCARSDisplayMessage::cSkinLCARSDisplayMessage(), cSkinLCARSDisplayReplay::cSkinLCARSDisplayReplay(), cSkinLCARSDisplayTracks::cSkinLCARSDisplayTracks(), cSkinLCARSDisplayVolume::cSkinLCARSDisplayVolume(), cSkinSTTNGDisplayChannel::cSkinSTTNGDisplayChannel(), cSkinSTTNGDisplayMenu::cSkinSTTNGDisplayMenu(), cSkinSTTNGDisplayMessage::cSkinSTTNGDisplayMessage(), cSkinSTTNGDisplayReplay::cSkinSTTNGDisplayReplay(), cSkinSTTNGDisplayTracks::cSkinSTTNGDisplayTracks(), cSkinSTTNGDisplayVolume::cSkinSTTNGDisplayVolume(), DrawDeviceData(), cTextScroller::DrawText(), cSkinLCARSDisplayMenu::DrawTimer(), cSkinSTTNGDisplayChannel::Flush(), cSkinSTTNGDisplayMenu::Flush(), cSubtitleObject::Render(), cTextScroller::Set(), cSkinClassicDisplayMenu::SetEvent(), cSkinLCARSDisplayMenu::SetEvent(), cSkinSTTNGDisplayMenu::SetEvent(), cSkinClassicDisplayMenu::SetRecording(), cSkinLCARSDisplayMenu::SetRecording(), cSkinSTTNGDisplayMenu::SetRecording(), and Size().

◆ SetFont()

void cFont::SetFont ( eDvbFont Font,
const char * Name,
int CharHeight )
static

< Draws the given text into the Pixmap at position (x, y) with the given colors.

The text will not exceed the given Width (if > 0), and will end with a complete character. Sets the given Font to use the font data according to Name (see CreateFont()) and make its characters CharHeight pixels high.

Definition at line 406 of file font.c.

References constrain(), CreateFont(), Font, fonts, MAXFONTSIZE, and MINFONTSIZE.

Referenced by GetFont(), and cOsdProvider::UpdateOsdSize().

◆ Size()

virtual int cFont::Size ( void ) const
inlinevirtual

Returns the original size as requested when the font was created.

This may be smaller than the actual height, for instance if the font contains descenders.

Reimplemented in cFreetypeFont.

Definition at line 44 of file font.h.

References Height().

Referenced by cHdffOsd::DrawText().

◆ Width() [1/3]

virtual int cFont::Width ( const char * s) const
pure virtual

Returns the width of the given string in pixel.

Implemented in cFreetypeFont, cDummyFont, and cCursesFont.

◆ Width() [2/3]

virtual int cFont::Width ( uint c) const
pure virtual

Returns the width of the given character in pixel.

Implemented in cFreetypeFont, cDummyFont, and cCursesFont.

◆ Width() [3/3]

virtual int cFont::Width ( void ) const
pure virtual

Member Data Documentation

◆ fonts

cFont * cFont::fonts = { NULL }
staticprivate

Definition at line 404 of file font.h.

Referenced by GetFont(), and SetFont().


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