SASC
DVBSoftCAM

font.h

Go to the documentation of this file.
00001 /*
00002  * font.h: Font handling for the DVB On Screen Display
00003  *
00004  * See the main source file 'vdr.c' for copyright information and
00005  * how to reach the author.
00006  *
00007  * $Id: font.h 1.20 2007/06/23 10:09:14 kls Exp $
00008  */
00009 
00010 #ifndef __FONT_H
00011 #define __FONT_H
00012 
00013 #include <stdint.h>
00014 #include <stdlib.h>
00015 #include "tools.h"
00016 
00017 #define MAXFONTNAME 64
00018 #define MAXFONTSIZE 64
00019 
00020 enum eDvbFont {
00021   fontOsd,
00022   fontFix,
00023   fontSml
00024 #define eDvbFontSize (fontSml + 1)
00025   };
00026 
00027 class cBitmap;
00028 typedef uint32_t tColor; // see also osd.h
00029 typedef uint8_t tIndex;
00030 
00031 extern const char *DefaultFontOsd;
00032 extern const char *DefaultFontSml;
00033 extern const char *DefaultFontFix;
00034 
00035 class cFont {
00036 private:
00037   static cFont *fonts[];
00038 public:
00039   virtual ~cFont() {}
00040   virtual int Width(uint c) const = 0;
00042   virtual int Width(const char *s) const = 0;
00044   virtual int Height(void) const = 0;
00046   int Height(const char *s) const { return Height(); }
00048   virtual void DrawText(cBitmap *Bitmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const = 0;
00051   static void SetFont(eDvbFont Font, const char *Name, int CharHeight);
00054   static const cFont *GetFont(eDvbFont Font);
00060   static cFont *CreateFont(const char *Name, int CharHeight, int CharWidth = 0);
00068   static bool GetAvailableFontNames(cStringList *FontNames, bool Monospaced = false);
00075   static cString GetFontFileName(const char *FontName);
00077   };
00078 
00079 class cTextWrapper {
00080 private:
00081   char *text;
00082   char *eol;
00083   int lines;
00084   int lastLine;
00085 public:
00086   cTextWrapper(void);
00087   cTextWrapper(const char *Text, const cFont *Font, int Width);
00088   ~cTextWrapper();
00089   void Set(const char *Text, const cFont *Font, int Width);
00094   const char *Text(void);
00096   int Lines(void) { return lines; }
00098   const char *GetLine(int Line);
00100   };
00101 
00102 #endif //__FONT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines