mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Added cFont::Width(void) to get the default character width and allow stretched font drawing in high level OSDs
This commit is contained in:
parent
f91468ff9b
commit
b6080634cc
@ -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
|
||||
|
2
HISTORY
2
HISTORY
@ -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).
|
||||
|
@ -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).
|
||||
|
@ -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; }
|
||||
|
15
font.c
15
font.c
@ -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;
|
||||
}
|
||||
|
||||
|
5
font.h
5
font.h
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user