summaryrefslogtreecommitdiff
path: root/anyfont.cpp
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2010-08-02 16:01:52 +0200
committerJochen Dolze <vdr@dolze.de>2010-08-02 16:01:52 +0200
commitf79593139e7c46f7ce92711229485a46fa5d7c58 (patch)
tree35d6412641af902ad56d21e9c549a5f608336956 /anyfont.cpp
parent5bdb0a08787c65532625ca74aebee76bbf2606a6 (diff)
downloadvdr-plugin-tvonscreen-f79593139e7c46f7ce92711229485a46fa5d7c58.tar.gz
vdr-plugin-tvonscreen-f79593139e7c46f7ce92711229485a46fa5d7c58.tar.bz2
Added patch from freevdr for HD-OSD
Diffstat (limited to 'anyfont.cpp')
-rw-r--r--anyfont.cpp118
1 files changed, 1 insertions, 117 deletions
diff --git a/anyfont.cpp b/anyfont.cpp
index c230cbc..45e516a 100644
--- a/anyfont.cpp
+++ b/anyfont.cpp
@@ -3,43 +3,23 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: anyfont.c,v 1.6 2004/07/08 13:46:38 schmitzj Exp $
- *
*/
#include "anyfont.h"
#include "magazine.h"
-#if VDRVERSNUM >= 10503
anyFont::anyFont(cOsd *_osd,int fheight,int transparent)
-#elif VDRVERSNUM >= 10307
-anyFont::anyFont(cOsd *_osd,const cFont::tPixelData *fd,int fheight,int transparent)
-#else
-anyFont::anyFont(cOsdBase *_osd,const cFont::tPixelData *fd,int fheight,int transparent)
-#endif
+
{
osd=_osd;
-#if VDRVERSNUM >= 10503
-#if VDRVERSNUM >= 10504
Font = cFont::CreateFont(Setup.FontOsd, fheight);
-#else
- Font = new cFreetypeFont(*AddDirectory(FONTDIR, Setup.FontOsd, fheight);
-#endif
if (!Font || !Font->Height())
Font = cFont::GetFont(fontSml);
-#else
- FontData=fd;
- FontHeight=fheight;
-#endif
trans=transparent;
}
int anyFont::Height(void)
{
-#if VDRVERSNUM >= 10503
return Font->Height();
-#else
- return FontHeight-2-2;
-#endif
}
int anyFont::Width(const char *txt)
{
@@ -55,107 +35,23 @@ int anyFont::LargeWidth(const char *txt)
}
int anyFont::Width(char c)
{
-#if VDRVERSNUM >= 10503
return Font->Width(c);
-#else
- if ((int)FontData[(((unsigned char)c)-32)*(FontHeight)]>100)
- {
- mzlog(1," big letter error %c: %d",c,(int)FontData[(((unsigned char)c)-32)*(FontHeight)]);
- return 100;
- }
- return (int)FontData[(((unsigned char)c)-32)*(FontHeight)];
-#endif
}
int anyFont::LargeWidth(char c)
{
-#if VDRVERSNUM >= 10503
return Font->Width(c);
-#else
- if ((int)FontData[(((unsigned char)c)-32)*(FontHeight)]>100)
- {
- mzlog(1," big letter error %c: %d",c,(int)FontData[(((unsigned char)c)-32)*(FontHeight)]);
- return 100;
- }
- return (int)FontData[(((unsigned char)c)-32)*(FontHeight)]*2;
-#endif
}
-#if VDRVERSNUM >= 10307
int anyFont::Text(int x, int y, const char *txt, tColor fg, tColor bg)
-#else
-int anyFont::Text(int x, int y, const char *txt, eDvbColor fg, eDvbColor bg, tWindowHandle wh)
-#endif
{
-#if VDRVERSNUM >= 10503
osd->DrawText(x, y, txt, fg, trans ? clrTransparent : bg, Font);
return x += Font->Width(txt);
-#else
- unsigned int pxl;
- int row,col;
-
- while (txt && *txt)
- {
- for (row=0; row<Height()+2; row++)
- {
- pxl = FontData[(((unsigned char)*txt)-32)*(FontHeight)+row+2];
-
- // XXX maybe increment col before starting?
- for (col=Width(*txt); col>=0; col--)
- {
- if (!trans || pxl&1)
-#if VDRVERSNUM >= 10307
- osd->DrawRectangle(x+col-1,y+row,x+col-1,y+row,(pxl&1) ? fg : bg);
-#else
- osd->Fill (x+col-1,y+row,x+col-1,y+row,(pxl&1) ? fg : bg,wh);
-#endif
- pxl >>= 1;
- }
- }
- x += Width(*txt++);
- }
- return x;
-#endif
}
-#if VDRVERSNUM >= 10307
int anyFont::LargeText(int x, int y, const char *txt, tColor fg, tColor bg)
-#else
-int anyFont::LargeText(int x, int y, const char *txt, eDvbColor fg, eDvbColor bg, tWindowHandle wh)
-#endif
{
-#if VDRVERSNUM >= 10503
osd->DrawText(x, y, txt, fg, trans ? clrTransparent : bg, Font);
return x + Font->Width(txt);
-#else
- unsigned int pxl;
- int row,col;
-
- while (txt && *txt)
- {
- for (row=0; row<Height(); row++)
- {
- pxl = FontData[(((unsigned char)*txt)-32)*(FontHeight)+row+2];
-
- // XXX maybe increment col befor starting?
- for (col=Width(*txt); col>=0; col--)
- {
- if (!trans || pxl&1)
-#if VDRVERSNUM >= 10307
- osd->DrawRectangle(x+(col-1)*2,y+row,x+(col-1)*2+1,y+row,(pxl&1) ? fg : bg);
-#else
- osd->Fill (x+(col-1)*2,y+row,x+(col-1)*2+1,y+row,(pxl&1) ? fg : bg,wh);
-#endif
- pxl >>= 1;
- }
- }
- x += LargeWidth(*txt++);
- }
- return x;
-#endif
}
-#if VDRVERSNUM >= 10307
int anyFont::Text(int x, int y, int w, int h, const char *txt, tColor fg, tColor bg)
-#else
-int anyFont::Text(int x, int y, int w, int h, const char *txt, eDvbColor fg, eDvbColor bg, tWindowHandle wh)
-#endif
{
if (txt==NULL)
return x;
@@ -181,11 +77,7 @@ int anyFont::Text(int x, int y, int w, int h, const char *txt, eDvbColor fg, eDv
y0+=Height();
}
if (y0<h*Height())
-#if VDRVERSNUM >= 10307
x0+=Text(x+x0,y+y0,t2,fg,bg) -x-x0+Width(c);
-#else
- x0+=Text(x+x0,y+y0,t2,fg,bg,wh)-x-x0+Width(c);
-#endif
*(mytxt)=c;
t2=mytxt+1;
if (c=='\t')
@@ -214,11 +106,7 @@ int anyFont::Text(int x, int y, int w, int h, const char *txt, eDvbColor fg, eDv
y0+=Height();
}
if (y0<h*Height())
-#if VDRVERSNUM >= 10307
x0+=Text(x+x0,y+y0,t2,fg,bg) -x-x0;
-#else
- x0+=Text(x+x0,y+y0,t2,fg,bg,wh)-x-x0;
-#endif
*(mytxt+1)=c;
t2=mytxt+1;
break;
@@ -233,11 +121,7 @@ int anyFont::Text(int x, int y, int w, int h, const char *txt, eDvbColor fg, eDv
y0+=Height();
}
if (y0<h*Height())
-#if VDRVERSNUM >= 10307
x0+=Text(x+x0,y+y0,t2,fg,bg);
-#else
- x0+=Text(x+x0,y+y0,t2,fg,bg,wh);
-#endif
}
free(memtxt);
return y0/Height()+1;