summaryrefslogtreecommitdiffstats
path: root/krfb/libvncserver/fontsel.c
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /krfb/libvncserver/fontsel.c
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krfb/libvncserver/fontsel.c')
-rw-r--r--krfb/libvncserver/fontsel.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/krfb/libvncserver/fontsel.c b/krfb/libvncserver/fontsel.c
new file mode 100644
index 00000000..100db817
--- /dev/null
+++ b/krfb/libvncserver/fontsel.c
@@ -0,0 +1,71 @@
+#include "rfb.h"
+
+#define FONTDIR "/usr/lib/kbd/consolefonts/"
+#define DEFAULTFONT FONTDIR "default8x16"
+
+char *fontlist[50]={
+"8x16alt", "b.fnt", "c.fnt", "default8x16", "m.fnt", "ml.fnt", "mod_d.fnt",
+"mod_s.fnt", "mr.fnt", "mu.fnt", "r.fnt", "rl.fnt", "ro.fnt", "s.fnt",
+"sc.fnt", "scrawl_s.fnt", "scrawl_w.fnt", "sd.fnt", "t.fnt",
+ 0
+};
+
+rfbScreenInfoPtr rfbScreen = 0;
+rfbFontDataPtr curFont = 0;
+void showFont(int index)
+{
+ char buffer[1024];
+
+ if(!rfbScreen) return;
+
+ if(curFont)
+ rfbFreeFont(curFont);
+
+ strcpy(buffer,FONTDIR);
+ strcat(buffer,fontlist[index]);
+ curFont = rfbLoadConsoleFont(buffer);
+
+ rfbFillRect(rfbScreen,210,30-20,210+10*16,30-20+256*20/16,0xb77797);
+ if(curFont) {
+ int i,j;
+ for(j=0;j<256;j+=16)
+ for(i=0;i<16;i++)
+ rfbDrawCharWithClip(rfbScreen,curFont,210+10*i,30+j*20/16,j+i,
+ 0,0,640,480,0xffffff,0x000000);
+ }
+}
+
+int main(int argc,char** argv)
+{
+ rfbFontDataPtr font;
+ rfbScreenInfoPtr s=rfbGetScreen(&argc,argv,640,480,8,3,3);
+ int i,j;
+
+ s->frameBuffer=(char*)malloc(640*480*3);
+ rfbInitServer(s);
+
+ for(j=0;j<480;j++)
+ for(i=0;i<640;i++) {
+ s->frameBuffer[(j*640+i)*3+0]=j*256/480;
+ s->frameBuffer[(j*640+i)*3+1]=i*256/640;
+ s->frameBuffer[(j*640+i)*3+2]=(i+j)*256/(480+640);
+ }
+
+ rfbScreen = s;
+ font=rfbLoadConsoleFont(DEFAULTFONT);
+ if(!font) {
+ fprintf(stderr,"Couldn't find %s\n",DEFAULTFONT);
+ exit(1);
+ }
+
+ for(j=0;j<0;j++)
+ rfbProcessEvents(s,900000);
+
+ i = rfbSelectBox(s,font,fontlist,10,20,200,300,0xffdfdf,0x602040,2,showFont);
+ fprintf(stderr,"Selection: %d: %s\n",i,(i>=0)?fontlist[i]:"cancelled");
+
+ rfbFreeFont(font);
+
+ return(0);
+}
+