summaryrefslogtreecommitdiff
path: root/font.h
blob: 9c363160472d861ee374e9099fba25fdd780e57b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * font.h: Font handling for the DVB On Screen Display
 *
 * See the main source file 'vdr.c' for copyright information and
 * how to reach the author.
 *
 * $Id: font.h 1.5 2004/01/16 13:18:28 kls Exp $
 */

#ifndef __FONT_H
#define __FONT_H

#include <stdlib.h>

enum eDvbFont {
  fontOsd,
  fontFix,
  fontSml
#define eDvbFontSize (fontSml + 1)
  };

enum eDvbCode {
  code_iso8859_1,
  code_iso8859_5,
  code_iso8859_7,
#define eDvbCodeSize (code_iso8859_7 + 1)
  };

class cFont {
public:
  enum { NUMCHARS = 256 };
  typedef unsigned long tPixelData;
  struct tCharData {
    tPixelData width, height;
    tPixelData lines[1];
    };
private:
  static eDvbCode code;
  static cFont *fonts[];
  const tCharData *data[NUMCHARS];
public:
  cFont(void *Data);
  void SetData(void *Data);
  int Width(unsigned char c) const { return data[c]->width; }
  int Width(const char *s) const;
  int Height(unsigned char c) const { return data[c]->height; }
  int Height(const char *s) const;
  const tCharData *CharData(unsigned char c) const { return data[c]; }
  static bool SetCode(const char *Code);
  static void SetCode(eDvbCode Code);
  static void SetFont(eDvbFont Font, void *Data = NULL);
  static const cFont *GetFont(eDvbFont Font);
  };

#endif //__FONT_H