diff options
| author | Jürgen Schmitz <vdr@dolze.de> | 2004-09-19 20:15:00 +0200 |
|---|---|---|
| committer | Jürgen Schmitz <vdr@dolze.de> | 2004-09-19 20:15:00 +0200 |
| commit | 4a5845aee69c23fa52f660be1caff00c96d9fc38 (patch) | |
| tree | 8e1b472019c0aa46c2402ada12beb6c80b5f00d5 /anyfont.c | |
| parent | 48a28f4fa2c3b8ba0b3d913d0e233d904a545051 (diff) | |
| download | vdr-plugin-tvonscreen-4a5845aee69c23fa52f660be1caff00c96d9fc38.tar.gz vdr-plugin-tvonscreen-4a5845aee69c23fa52f660be1caff00c96d9fc38.tar.bz2 | |
Version 0.6.0
Diffstat (limited to 'anyfont.c')
| -rw-r--r-- | anyfont.c | 79 |
1 files changed, 73 insertions, 6 deletions
@@ -1,16 +1,20 @@ /* - * anyfont.h: Internationalization + * anyfont.c: Internationalization * * See the README file for copyright information and how to reach the author. * - * $Id: anyfont.c,v 1.2 2004/03/04 23:16:22 schmitzj Exp $ + * $Id: anyfont.c,v 1.6 2004/07/08 13:46:38 schmitzj Exp $ * */ #include "anyfont.h" #include "magazine.h" +#if 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; FontData=fd; @@ -51,22 +55,30 @@ int anyFont::LargeWidth(char c) } return (int)FontData[(((unsigned char)c)-32)*(FontHeight)]*2; } +#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 { unsigned int pxl; int row,col; while (txt && *txt) { - for (row=0; row<Height(); row++) + for (row=0; row<Height()+2; row++) { pxl = FontData[(((unsigned char)*txt)-32)*(FontHeight)+row+2]; - // XXX maybe increment col befor starting? + // XXX maybe increment col before starting? for (col=Width(*txt); col>=0; col--) { if (!trans || pxl&1) - osd->Fill(x+col-1,y+row,x+col-1,y+row,(pxl&1) ? fg : bg,wh); +#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; } } @@ -74,7 +86,11 @@ int anyFont::Text(int x, int y, const char *txt, eDvbColor fg, eDvbColor bg, tWi } return x; } +#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 { unsigned int pxl; int row,col; @@ -89,7 +105,11 @@ int anyFont::LargeText(int x, int y, const char *txt, eDvbColor fg, eDvbColor bg for (col=Width(*txt); col>=0; col--) { if (!trans || pxl&1) - osd->Fill(x+(col-1)*2,y+row,x+(col-1)*2+1,y+row,(pxl&1) ? fg : bg,wh); +#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; } } @@ -97,7 +117,11 @@ int anyFont::LargeText(int x, int y, const char *txt, eDvbColor fg, eDvbColor bg } return x; } +#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; @@ -113,6 +137,8 @@ int anyFont::Text(int x, int y, int w, int h, const char *txt, eDvbColor fg, eDv switch (*mytxt) { case ' ': + case '\t': + case '\n': c=*(mytxt); *(mytxt)=0; if (x0+Width(t2)>w && x0>0) @@ -121,9 +147,28 @@ 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') + { + if (x0==0) + { + x+=20; + w-=20; + } + else + x0=((x0+20)/20)*20; + } + else if (c=='\n') + { + x0=0; + y0+=Height(); + } break; case '-': case '.': @@ -135,7 +180,11 @@ 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; @@ -150,7 +199,11 @@ 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; @@ -170,6 +223,8 @@ int anyFont::TextHeight(int w, const char *txt) switch (*mytxt) { case ' ': + case '\t': + case '\n': c=*(mytxt); *(mytxt)=0; if (x0+Width(t2)>w && x0>0) @@ -180,6 +235,18 @@ int anyFont::TextHeight(int w, const char *txt) x0+=Width(t2)+Width(c); *(mytxt)=c; t2=mytxt+1; + if (c=='\t') + { + if (x0==0) + w-=20; + else + x0=((x0+20)/20)*20; + } + else if (c=='\n') + { + x0=0; + y0+=Height(); + } break; case '-': case '.': |
