From 41d45011c24740abfcaae9ecf0ea3f1906c6f29e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Mon, 13 Jul 2009 01:12:24 +0300
Subject: Replace internal freetype font handling with VDR's font facilities.

Skins that use fonts other than VDR's standard "Osd", "Fix", and "Sml"
need to be adapted to use font names as understood by VDR's
CreateFont() (Family:Style as of writing this) instead of filenames in
their font attributes' names, to use '@' instead of ':' as the
separator before sizes, and have fonts shipped with the skin installed
and configured in fontconfig.  Typically, install font files (if
necessary) to a dir somewhere, run fc-cache(1) on the dir, replace for
example font="SomeFont.ttf:22,85" with font="Some Font@22,85" or
font="SomeFontBold.ttf:22,85" with font="Some Font:Bold@22,85" in the
*.skin file.  Also, in case the shipped fonts are derivatives of some
existing ones, they may need to be properly renamed to something so
they will be used instead of the original if it happens to be
installed. (closes #36)
---
 font.h | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

(limited to 'font.h')

diff --git a/font.h b/font.h
index 99f1cec..090ac56 100644
--- a/font.h
+++ b/font.h
@@ -6,23 +6,40 @@
 #define VDR_TEXT2SKIN_FONT_H
 
 #include "common.h"
-#ifdef HAVE_FREETYPE
-#	include "graphtft/font.h"
-#endif
+#include <map>
+#include <string>
+#include <vdr/font.h>
+
+using std::map;
+using std::string;
+
+
+class cText2SkinFontCache
+{
+private:
+	typedef map<string,cFont*> cache_map;
+	
+public:
+	cText2SkinFontCache();
+	~cText2SkinFontCache();
+
+	bool Load(string Name, string CacheName, int Size);
+	const cFont* GetFont(string CacheName);
+	void Clear();
 
-class cText2SkinFont {
 private:
-#ifdef HAVE_FREETYPE
-	static cGraphtftFont mFontCache;
-#endif
+	cache_map 		_cache;
+};
 
+class cText2SkinFont {
+private:
+	static cText2SkinFontCache mFontCache;
 	// disallow direct construction
 	cText2SkinFont(void);
 	virtual ~cText2SkinFont();
 
 public:
-	static const cFont *Load(const std::string &Path, const std::string &Filename, int Size, 
-	                         int Width);
+	static const cFont *Load(const string &Name, int Size);
 };
 
 #endif // VDR_TEXT2SKIN_FONT_H
-- 
cgit v1.2.3