summaryrefslogtreecommitdiff
path: root/font.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-06-17 12:15:24 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2007-06-17 12:15:24 +0200
commitd2b11bf712f2c13b0b465f83f9fb0653b7dd5525 (patch)
treed1a0fe23131776250a280bbae1cd0b2a1c5ea020 /font.c
parent5fec367e604e642727437067ecd0cad32728ae87 (diff)
downloadvdr-d2b11bf712f2c13b0b465f83f9fb0653b7dd5525.tar.gz
vdr-d2b11bf712f2c13b0b465f83f9fb0653b7dd5525.tar.bz2
Implemented cFont::CreateFont()
Diffstat (limited to 'font.c')
-rw-r--r--font.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/font.c b/font.c
index b037fb11..7e47e7ac 100644
--- a/font.c
+++ b/font.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: font.c 1.18 2007/06/17 11:54:10 kls Exp $
+ * $Id: font.c 1.19 2007/06/17 12:13:49 kls Exp $
*/
#include "font.h"
@@ -309,15 +309,11 @@ cFont *cFont::fonts[eDvbFontSize] = { NULL };
void cFont::SetFont(eDvbFont Font, const char *Name, int CharHeight)
{
- cString fn = GetFontFileName(Name);
- if (*fn) {
- delete fonts[Font];
- fonts[Font] = new cFreetypeFont(fn, CharHeight);
- }
- if (!fonts[Font] || !fonts[Font]->Height()) {
- delete fonts[Font];
- fonts[Font] = new cDummyFont;
- }
+ cFont *f = CreateFont(Name, CharHeight);
+ if (!f || !f->Height())
+ f = new cDummyFont;
+ delete fonts[Font];
+ fonts[Font] = f;
}
const cFont *cFont::GetFont(eDvbFont Font)
@@ -336,6 +332,14 @@ const cFont *cFont::GetFont(eDvbFont Font)
return fonts[Font];
}
+cFont *cFont::CreateFont(const char *Name, int CharHeight)
+{
+ cString fn = GetFontFileName(Name);
+ if (*fn)
+ return new cFreetypeFont(fn, CharHeight);
+ return NULL;
+}
+
bool cFont::GetAvailableFontNames(cStringList *FontNames, bool Monospaced)
{
if (!FontNames->Size()) {