diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2007-06-17 12:15:24 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2007-06-17 12:15:24 +0200 |
commit | d2b11bf712f2c13b0b465f83f9fb0653b7dd5525 (patch) | |
tree | d1a0fe23131776250a280bbae1cd0b2a1c5ea020 /font.c | |
parent | 5fec367e604e642727437067ecd0cad32728ae87 (diff) | |
download | vdr-d2b11bf712f2c13b0b465f83f9fb0653b7dd5525.tar.gz vdr-d2b11bf712f2c13b0b465f83f9fb0653b7dd5525.tar.bz2 |
Implemented cFont::CreateFont()
Diffstat (limited to 'font.c')
-rw-r--r-- | font.c | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -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()) { |