1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added cFont::FontName() and cFont::Size()

This commit is contained in:
Klaus Schmidinger 2009-12-31 15:21:51 +01:00
parent 6a4d4607e4
commit a8260204c3
4 changed files with 16 additions and 3 deletions

View File

@ -1362,6 +1362,7 @@ Andreas Regel <andreas.regel@gmx.de>
groups groups
for adding some missing 'const' statements to cBitmap for adding some missing 'const' statements to cBitmap
for making cDevice::AddPid() store the stream type of the given pid for making cDevice::AddPid() store the stream type of the given pid
for adding cFont::FontName() and cFont::Size()
Thomas Bergwinkl <Thomas.Bergwinkl@vr-web.de> Thomas Bergwinkl <Thomas.Bergwinkl@vr-web.de>
for fixing the validity check for channel IDs, because some providers use TIDs for fixing the validity check for channel IDs, because some providers use TIDs

View File

@ -6197,7 +6197,7 @@ Video Disk Recorder Revision History
- Fixed the default value for "Pause key handling" in the MANUAL (reported by - Fixed the default value for "Pause key handling" in the MANUAL (reported by
Diego Pierotto). Diego Pierotto).
2009-12-25: Version 1.7.11 2009-12-31: Version 1.7.11
- Fixed resetting the file size when regenerating the index file. - Fixed resetting the file size when regenerating the index file.
- The new function cDevice::PatPmtParser() can be used in derived devices to access - The new function cDevice::PatPmtParser() can be used in derived devices to access
@ -6232,3 +6232,4 @@ Video Disk Recorder Revision History
that have some encrypted components that VDR doesn't use). that have some encrypted components that VDR doesn't use).
- cDevice::AddPid() now stores the stream type of the given pid (thanks to Andreas - cDevice::AddPid() now stores the stream type of the given pid (thanks to Andreas
Regel). Regel).
- Added cFont::FontName() and cFont::Size() (thanks to Andreas Regel).

8
font.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: font.c 2.3 2009/12/05 16:19:00 kls Exp $ * $Id: font.c 2.4 2009/12/31 14:49:59 kls Exp $
*/ */
#include "font.h" #include "font.h"
@ -93,6 +93,8 @@ void cGlyph::SetKerningCache(uint PrevSym, int Kerning)
class cFreetypeFont : public cFont { class cFreetypeFont : public cFont {
private: private:
cString fontName;
int size;
int height; int height;
int bottom; int bottom;
FT_Library library; ///< Handle to library FT_Library library; ///< Handle to library
@ -105,6 +107,8 @@ private:
public: public:
cFreetypeFont(const char *Name, int CharHeight, int CharWidth = 0); cFreetypeFont(const char *Name, int CharHeight, int CharWidth = 0);
virtual ~cFreetypeFont(); virtual ~cFreetypeFont();
virtual const char *FontName(void) const { return fontName; }
virtual int Size(void) const { return size; }
virtual int Width(uint c) const; virtual int Width(uint c) const;
virtual int Width(const char *s) const; virtual int Width(const char *s) const;
virtual int Height(void) const { return height; } virtual int Height(void) const { return height; }
@ -113,6 +117,8 @@ public:
cFreetypeFont::cFreetypeFont(const char *Name, int CharHeight, int CharWidth) cFreetypeFont::cFreetypeFont(const char *Name, int CharHeight, int CharWidth)
{ {
fontName = Name;
size = CharHeight;
height = 0; height = 0;
bottom = 0; bottom = 0;
int error = FT_Init_FreeType(&library); int error = FT_Init_FreeType(&library);

7
font.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: font.h 2.2 2009/05/23 10:10:40 kls Exp $ * $Id: font.h 2.3 2009/12/31 14:48:25 kls Exp $
*/ */
#ifndef __FONT_H #ifndef __FONT_H
@ -38,6 +38,11 @@ private:
static cFont *fonts[]; static cFont *fonts[];
public: public:
virtual ~cFont() {} virtual ~cFont() {}
virtual const char *FontName(void) const { return ""; }
///< Returns the font name.
virtual int Size(void) const { return Height(); }
///< Returns the original size as requested when the font was created.
///< This may be different than the actual height.
virtual int Width(uint c) const = 0; virtual int Width(uint c) const = 0;
///< Returns the width of the given character in pixel. ///< Returns the width of the given character in pixel.
virtual int Width(const char *s) const = 0; virtual int Width(const char *s) const = 0;