vdr/font.h
Klaus Schmidinger 287cd613a1 Version 1.4.4-1
- Some improvements to the man pages (thanks to Ville Skyttä).
- Fixed a possible segfault in cSkins::Message() (thanks to Udo Richter).
- Made the getskyepg.pl script of the 'sky' plugin send a user agent message to
  the server, according to the rules at http://bleb.org/tv/data/listings.
  If your version of 'wget' doesn't support the -U option to set the user agent,
  use the new option -U of getskyepg.pl to have the information added to the URL
  as a query string.
- The getskyepg.pl script now replaces "&" with "&".
- Fixed a possible crash in remux.c on 64-bit machines (thanks to Reinhard Nissl).
- Fixed a typo in the change to the "Use small font" setup option in version 1.3.47
  in the HISTORY and CONTRIBUTORS file (reported by Andreas Brugger).
- Added a missing 'const' to cRecordingInfo::ChannelID() (reported by Andreas
  Brugger). This required the APIVERSION to be increased, so plugins will have to
  be recompiled.
- Now calling cPluginManager::Active() only if VDR is really trying to shut down,
  and waiting for 5 minutes before calling it again (thanks to Jörg Wendel for
  reporting that cPlugin::Active() was called too often, and to Udo Richter for
  some hints on how to improve this).
- Replaced 'unsigned long' with 'uint32_t' and 'uint64' with 'uint64_t' to
  avoid problems on 64-bit machines.
2006-12-03 18:00:00 +01:00

90 lines
2.5 KiB
C++

/*
* 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.13 2006/12/02 11:11:48 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_2,
code_iso8859_5,
code_iso8859_7,
code_iso8859_13,
code_iso8859_15,
#define eDvbCodeSize (code_iso8859_15 + 1)
};
class cFont {
public:
enum { NUMCHARS = 256 };
typedef uint32_t tPixelData;
struct tCharData {
tPixelData width, height;
tPixelData lines[1];
};
private:
static eDvbCode code;
static cFont *fonts[];
const tCharData *data[NUMCHARS];
int height;
public:
cFont(const void *Data);
virtual ~cFont() {}
void SetData(const void *Data);
virtual int Width(unsigned char c) const { return data[c]->width; }
///< Returns the width of the given character.
virtual int Width(const char *s) const;
///< Returns the width of the given string.
virtual int Height(unsigned char c) const { return data[c]->height; }
///< Returns the height of the given character.
virtual int Height(const char *s) const;
///< Returns the height of the given string.
virtual int Height(void) const { return height; }
///< Returns the height of this font (all characters have the same height).
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, const void *Data = NULL);
static const cFont *GetFont(eDvbFont Font);
};
class cTextWrapper {
private:
char *text;
char *eol;
int lines;
int lastLine;
public:
cTextWrapper(void);
cTextWrapper(const char *Text, const cFont *Font, int Width);
~cTextWrapper();
void Set(const char *Text, const cFont *Font, int Width);
///< Wraps the Text to make it fit into the area defined by the given Width
///< when displayed with the given Font.
///< Wrapping is done by inserting the necessary number of newline
///< characters into the string.
const char *Text(void);
///< Returns the full wrapped text.
int Lines(void) { return lines; }
///< Returns the actual number of lines needed to display the full wrapped text.
const char *GetLine(int Line);
///< Returns the given Line. The first line is numbered 0.
};
#endif //__FONT_H