vdr  2.4.1
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 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
 
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 428 of file font.c.

References GetFontFileName(), and Height().

Referenced by cTrueColorDemo::Action(), CreateTinyFont(), cSkinLCARSDisplayChannel::cSkinLCARSDisplayChannel(), cSkinLCARSDisplayMenu::cSkinLCARSDisplayMenu(), 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 cDummyFont, cFreetypeFont, 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 cDummyFont, cFreetypeFont, and cCursesFont.

Definition at line 64 of file font.h.

◆ 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 437 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 411 of file font.c.

References esyslog, Font, fontFix, cSetup::FontFix, cSetup::FontFixSize, fontOsd, cSetup::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(), cSkinSTTNGDisplayChannel::Flush(), cSkinClassicDisplayMenu::Flush(), cSkinSTTNGDisplayMenu::Flush(), cSkinClassicDisplayMenu::GetTextAreaFont(), cSkinSTTNGDisplayMenu::GetTextAreaFont(), cSkinLCARSDisplayMenu::GetTextAreaFont(), cMenuEditStrItem::Set(), cSkinClassicDisplayMenu::SetButtons(), cSkinSTTNGDisplayMenu::SetButtons(), cSkinLCARSDisplayMenu::SetButtons(), cSkinClassicDisplayChannel::SetChannel(), cSkinSTTNGDisplayChannel::SetChannel(), cSkinLCARSDisplayChannel::SetChannel(), cSkinClassicDisplayReplay::SetCurrent(), cSkinSTTNGDisplayReplay::SetCurrent(), cSkinLCARSDisplayReplay::SetCurrent(), cSkinClassicDisplayMenu::SetEvent(), cSkinSTTNGDisplayMenu::SetEvent(), cSkinLCARSDisplayMenu::SetEvent(), cSkinClassicDisplayChannel::SetEvents(), cSkinSTTNGDisplayChannel::SetEvents(), cSkinLCARSDisplayChannel::SetEvents(), cSkinClassicDisplayMenu::SetItem(), cSkinSTTNGDisplayMenu::SetItem(), cSkinClassicDisplayTracks::SetItem(), cSkinLCARSDisplayMenu::SetItem(), cSkinSTTNGDisplayTracks::SetItem(), cSkinLCARSDisplayTracks::SetItem(), cSkinClassicDisplayReplay::SetJump(), cSkinSTTNGDisplayReplay::SetJump(), cSkinLCARSDisplayReplay::SetJump(), cSkinClassicDisplayChannel::SetMessage(), cSkinSTTNGDisplayChannel::SetMessage(), cSkinClassicDisplayMenu::SetMessage(), cSkinLCARSDisplayChannel::SetMessage(), cSkinSTTNGDisplayMenu::SetMessage(), cSkinClassicDisplayReplay::SetMessage(), cSkinClassicDisplayMessage::SetMessage(), cSkinLCARSDisplayMenu::SetMessage(), cSkinSTTNGDisplayReplay::SetMessage(), cSkinSTTNGDisplayMessage::SetMessage(), cSkinLCARSDisplayReplay::SetMessage(), cSkinLCARSDisplayMessage::SetMessage(), cSkinClassicDisplayMenu::SetRecording(), cSkinSTTNGDisplayMenu::SetRecording(), cSkinLCARSDisplayMenu::SetRecording(), cSkinLCARSDisplayReplay::SetRecording(), cSkinClassicDisplayReplay::SetTitle(), cSkinLCARSDisplayMenu::SetTitle(), cSkinSTTNGDisplayReplay::SetTitle(), cSkinLCARSDisplayReplay::SetTitle(), cSkinClassicDisplayReplay::SetTotal(), cSkinSTTNGDisplayReplay::SetTotal(), cSkinLCARSDisplayReplay::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 479 of file font.c.

References esyslog, and strreplace().

Referenced by CreateFont(), and main().

◆ Height()

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 cDummyFont, cFreetypeFont, 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(), cSkinSTTNGDisplayMenu::SetEvent(), cSkinLCARSDisplayMenu::SetEvent(), cSkinClassicDisplayMenu::SetRecording(), cSkinSTTNGDisplayMenu::SetRecording(), and cSkinLCARSDisplayMenu::SetRecording().

◆ 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 405 of file font.c.

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

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

◆ Width() [1/3]

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

Returns the width of the given string in pixel.

Implemented in cDummyFont, cFreetypeFont, 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 cDummyFont, cFreetypeFont, 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 39 of file font.h.

Referenced by GetFont(), and SetFont().


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