1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00
vdr/font.c

48 lines
865 B
C
Raw Permalink Normal View History

2000-10-03 10:34:48 +02:00
/*
* 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.
*
2000-11-18 15:46:00 +01:00
* $Id: font.c 1.2 2000/11/18 15:16:08 kls Exp $
2000-10-03 10:34:48 +02:00
*/
#include "font.h"
#include "tools.h"
2000-11-18 15:46:00 +01:00
#include "fontfix.c"
2000-10-03 10:34:48 +02:00
#include "fontosd.c"
2000-11-18 15:46:00 +01:00
cFont::cFont(eDvbFont Font)
2000-10-03 10:34:48 +02:00
{
2000-11-18 15:46:00 +01:00
#define FONTINDEX(Name)\
case font##Name: for (int i = 0; i < NUMCHARS; i++)\
data[i] = (tCharData *)&Font##Name[i < 32 ? 0 : i - 32];\
break;
2000-10-03 10:34:48 +02:00
switch (Font) {
default:
2000-11-18 15:46:00 +01:00
FONTINDEX(Osd);
FONTINDEX(Fix);
2000-10-03 10:34:48 +02:00
// 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;
}