diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2016-12-22 12:53:09 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2016-12-22 12:53:09 +0100 |
commit | b6080634cc57b02f53d427deb45a2dcc297c94be (patch) | |
tree | c9fd545d6212ac6814cf811f01d34a1da6f5e63f | |
parent | f91468ff9bca7bbf07ff854909cd5564dbb59f23 (diff) | |
download | vdr-b6080634cc57b02f53d427deb45a2dcc297c94be.tar.gz vdr-b6080634cc57b02f53d427deb45a2dcc297c94be.tar.bz2 |
Added cFont::Width(void) to get the default character width and allow stretched font drawing in high level OSDs
-rw-r--r-- | CONTRIBUTORS | 2 | ||||
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | PLUGINS/src/skincurses/HISTORY | 5 | ||||
-rw-r--r-- | PLUGINS/src/skincurses/skincurses.c | 5 | ||||
-rw-r--r-- | font.c | 15 | ||||
-rw-r--r-- | font.h | 5 |
6 files changed, 26 insertions, 8 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index cb2c516a..833eecf0 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3332,6 +3332,8 @@ Thomas Reufer <thomas@reufer.ch> replay of recordings with B-frames for fixing replaying recordings to their very end, if they don't end with an I-frame for implementing a frame parser for H.265 (HEVC) recordings + for adding cFont::Width(void) to get the default character width and allow stretched + font drawing in high level OSDs Eike Sauer <EikeSauer@t-online.de> for reporting a problem with channels that need more than 5 TS packets for detecting @@ -8862,3 +8862,5 @@ Video Disk Recorder Revision History - Fixed replaying recordings to their very end, if they don't end with an I-frame (thanks to Thomas Reufer). - Implemented a frame parser for H.265 (HEVC) recordings (thanks to Thomas Reufer). +- Added cFont::Width(void) to get the default character width and allow stretched + font drawing in high level OSDs (thanks to Thomas Reufer). diff --git a/PLUGINS/src/skincurses/HISTORY b/PLUGINS/src/skincurses/HISTORY index f24e6766..d4673f26 100644 --- a/PLUGINS/src/skincurses/HISTORY +++ b/PLUGINS/src/skincurses/HISTORY @@ -130,3 +130,8 @@ VDR Plugin 'skincurses' Revision History 2015-02-19: Version 2.2.0 - Official release. + +2016-12-22: Version 2.3.2 + +- Added cFont::Width(void) to get the default character width and allow stretched + font drawing in high level OSDs (dummy for skincurses). diff --git a/PLUGINS/src/skincurses/skincurses.c b/PLUGINS/src/skincurses/skincurses.c index 2d92a574..2d98f5b9 100644 --- a/PLUGINS/src/skincurses/skincurses.c +++ b/PLUGINS/src/skincurses/skincurses.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: skincurses.c 3.3 2015/02/17 13:13:17 kls Exp $ + * $Id: skincurses.c 4.1 2016/12/22 12:50:20 kls Exp $ */ #include <ncurses.h> @@ -12,7 +12,7 @@ #include <vdr/skins.h> #include <vdr/videodir.h> -static const char *VERSION = "2.2.0"; +static const char *VERSION = "2.3.2"; static const char *DESCRIPTION = trNOOP("A text only skin"); static const char *MAINMENUENTRY = NULL; @@ -20,6 +20,7 @@ static const char *MAINMENUENTRY = NULL; class cCursesFont : public cFont { public: + virtual int Width(void) const { return 1; } virtual int Width(uint c) const { return 1; } virtual int Width(const char *s) const { return s ? Utf8StrLen(s) : 0; } virtual int Height(void) const { return 1; } @@ -6,7 +6,7 @@ * * BiDi support by Osama Alrawab <alrawab@hotmail.com> @2008 Tripoli-Libya. * - * $Id: font.c 4.1 2015/04/19 11:13:45 kls Exp $ + * $Id: font.c 4.2 2016/12/22 12:31:23 kls Exp $ */ #include "font.h" @@ -100,6 +100,7 @@ class cFreetypeFont : public cFont { private: cString fontName; int size; + int width; int height; int bottom; FT_Library library; ///< Handle to library @@ -114,6 +115,7 @@ public: virtual ~cFreetypeFont(); virtual const char *FontName(void) const { return fontName; } virtual int Size(void) const { return size; } + virtual int Width(void) const { return width; } virtual int Width(uint c) const; virtual int Width(const char *s) const; virtual int Height(void) const { return height; } @@ -125,6 +127,7 @@ cFreetypeFont::cFreetypeFont(const char *Name, int CharHeight, int CharWidth) { fontName = Name; size = CharHeight; + width = CharWidth; height = 0; bottom = 0; int error = FT_Init_FreeType(&library); @@ -384,10 +387,12 @@ void cFreetypeFont::DrawText(cPixmap *Pixmap, int x, int y, const char *s, tColo class cDummyFont : public cFont { private: int height; + int width; public: - cDummyFont(int CharHeight) { height = CharHeight; } - virtual int Width(uint c) const { return height; } - virtual int Width(const char *s) const { return height; } + cDummyFont(int CharHeight, int CharWidth) { height = CharHeight; width = CharWidth; } + virtual int Width(void) const { return width ? width : height; } + virtual int Width(uint c) const { return width ? width : height; } + virtual int Width(const char *s) const { return width ? width : height; } virtual int Height(void) const { return height; } virtual void DrawText(cBitmap *Bitmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const {} virtual void DrawText(cPixmap *Pixmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const {}; @@ -425,7 +430,7 @@ cFont *cFont::CreateFont(const char *Name, int CharHeight, int CharWidth) cString fn = GetFontFileName(Name); cFont *f = *fn ? new cFreetypeFont(fn, CharHeight, CharWidth) : NULL; if (!f || !f->Height()) - f = new cDummyFont(CharHeight); + f = new cDummyFont(CharHeight, CharWidth); return f; } @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: font.h 4.1 2016/12/13 14:58:53 kls Exp $ + * $Id: font.h 4.2 2016/12/22 12:43:24 kls Exp $ */ #ifndef __FONT_H @@ -45,6 +45,9 @@ public: ///< Returns the original size as requested when the font was created. ///< This may be smaller than the actual height, for instance if the ///< font contains descenders. + virtual int Width(void) const = 0; + ///< Returns the original character width as requested when the font was + ///< created, or 0 if the default width is used. virtual int Width(uint c) const = 0; ///< Returns the width of the given character in pixel. virtual int Width(const char *s) const = 0; |