add a separate header file for MetaContact::Private class
[kdenetwork.git] / krfb / libvncserver / fontsel.c
blobd28a1b0f5101f0a56ddce67b3e087b8a39069bc2
1 #include "rfb.h"
3 #define FONTDIR "/usr/lib/kbd/consolefonts/"
4 #define DEFAULTFONT FONTDIR "default8x16"
6 char *fontlist[50]={
7 "8x16alt", "b.fnt", "c.fnt", "default8x16", "m.fnt", "ml.fnt", "mod_d.fnt",
8 "mod_s.fnt", "mr.fnt", "mu.fnt", "r.fnt", "rl.fnt", "ro.fnt", "s.fnt",
9 "sc.fnt", "scrawl_s.fnt", "scrawl_w.fnt", "sd.fnt", "t.fnt",
13 rfbScreenInfoPtr rfbScreen = 0;
14 rfbFontDataPtr curFont = 0;
15 void showFont(int index)
17 char buffer[1024];
19 if(!rfbScreen) return;
21 if(curFont)
22 rfbFreeFont(curFont);
24 strcpy(buffer,FONTDIR);
25 strcat(buffer,fontlist[index]);
26 curFont = rfbLoadConsoleFont(buffer);
28 rfbFillRect(rfbScreen,210,30-20,210+10*16,30-20+256*20/16,0xb77797);
29 if(curFont) {
30 int i,j;
31 for(j=0;j<256;j+=16)
32 for(i=0;i<16;i++)
33 rfbDrawCharWithClip(rfbScreen,curFont,210+10*i,30+j*20/16,j+i,
34 0,0,640,480,0xffffff,0x000000);
38 int main(int argc,char** argv)
40 rfbFontDataPtr font;
41 rfbScreenInfoPtr s=rfbGetScreen(&argc,argv,640,480,8,3,3);
42 int i,j;
44 s->frameBuffer=(char*)malloc(640*480*3);
45 rfbInitServer(s);
47 for(j=0;j<480;j++)
48 for(i=0;i<640;i++) {
49 s->frameBuffer[(j*640+i)*3+0]=j*256/480;
50 s->frameBuffer[(j*640+i)*3+1]=i*256/640;
51 s->frameBuffer[(j*640+i)*3+2]=(i+j)*256/(480+640);
54 rfbScreen = s;
55 font=rfbLoadConsoleFont(DEFAULTFONT);
56 if(!font) {
57 fprintf(stderr,"Couldn't find %s\n",DEFAULTFONT);
58 exit(1);
61 for(j=0;j<0;j++)
62 rfbProcessEvents(s,900000);
64 i = rfbSelectBox(s,font,fontlist,10,20,200,300,0xffdfdf,0x602040,2,showFont);
65 fprintf(stderr,"Selection: %d: %s\n",i,(i>=0)?fontlist[i]:"canceled");
67 rfbFreeFont(font);
69 return(0);