summaryrefslogtreecommitdiff
path: root/font.c
blob: 3ef40835bbbd9324864dbf40fee2708f8d3bddb0 (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
/*
 * font.c: 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.c 1.1 2000/10/01 15:01:49 kls Exp $
 */

#include "font.h"
#include "tools.h"

#include "fontosd.c"

cFont::cFont(eDvbFont Font)//XXX
{
  switch (Font) {
    default:
    case fontOsd: for (int i = 0; i < NUMCHARS; i++)
                      data[i] = (tCharData *)&FontOsd[i < 32 ? 0 : i - 32];
                  break;
    // TODO others...
    }
}

int cFont::Width(const char *s)
{
  int w = 0;
  while (s && *s)
        w += Width(*s++);
  return w;
}

int cFont::Height(const char *s)
{
  int h = 0;
  if (s && *s)
     h = Height(*s); // all characters have the same height!
  return h;
}