summaryrefslogtreecommitdiff
path: root/graphtft/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'graphtft/font.c')
-rw-r--r--graphtft/font.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/graphtft/font.c b/graphtft/font.c
index 9cfa812..d61a4b3 100644
--- a/graphtft/font.c
+++ b/graphtft/font.c
@@ -41,6 +41,7 @@ bool cGraphtftFont::Load(string Filename, string CacheName, int Size, int Langua
if ( _cache.find(CacheName) != _cache.end() )
return true;
+#if VDRVERSNUM < 10503
int error = FT_New_Face(_library, Filename.c_str(), format, &_face);
// every thing ok?
@@ -138,7 +139,7 @@ bool cGraphtftFont::Load(string Filename, string CacheName, int Size, int Langua
//Load the char
error = FT_Load_Glyph( _face, glyph_index, FT_LOAD_DEFAULT );
if ( error ) continue; /* ignore errors */
-
+
// now, convert to vdr font data
int width = (_slot->metrics.horiAdvance / 64) + 1;
int bearingX = (_slot->metrics.horiBearingX / 64) +1;
@@ -187,6 +188,17 @@ bool cGraphtftFont::Load(string Filename, string CacheName, int Size, int Langua
delete(font_data);
// Something went wrong!
return false;
+#else
+#if VDRVERSNUM < 10504
+ cFont* newFont = new cFreetypeFont(*AddDirectory(FONTDIR, Filename.c_str()), Size);
+#else
+ cFont* newFont = cFont::CreateFont(Filename.c_str(), Size);
+#endif
+ if ( newFont == NULL )
+ return false;
+ _cache[CacheName] = newFont;
+ return true;
+#endif
}
const cFont* cGraphtftFont::GetFont(string CacheName){
@@ -210,10 +222,12 @@ void cGraphtftFont::Clear()
delete((*it).second);
_cache.clear();
+#if VDRVERSNUM < 10503
del_map::iterator del_it = _del.begin();
for (; del_it != _del.end(); ++del_it)
delete((*del_it).second);
_del.clear();
+#endif
}
cGraphtftFont GraphtftFont;