fontsel is a test for rfbSelectBox and rfbLoadConsoleFont. If you have Linux console fonts, you can browse them via VNC. Directory browsing not implemented yet :-(
#define FONTDIR "/usr/lib/kbd/consolefonts/"
#define DEFAULTFONT FONTDIR "default8x16"
static 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",
NULL
};
static rfbScreenInfoPtr rfbScreen = NULL;
static rfbFontDataPtr curFont = NULL;
static void showFont(int index)
{
char buffer[1024];
if(!rfbScreen) return;
if(curFont)
strcat(buffer,fontlist[index]);
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++)
0,0,640,480,0xffffff,0x000000);
}
}
int main(
int argc,
char** argv)
{
rfbFontDataPtr font;
int i,j;
if(!s)
return 1;
s->frameBuffer=(char*)malloc(640*480*3);
if(!s->frameBuffer)
return 1;
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;
if(!font) {
exit(1);
}
i =
rfbSelectBox(s,font,fontlist,10,20,200,300,0xffdfdf,0x602040,2,showFont);
rfbLog(
"Selection: %d: %s\n",i,(i>=0)?fontlist[i]:
"cancelled");
free(s->frameBuffer);
return(0);
}
int main(int argc, char **argv)
void rfbFreeFont(rfbFontDataPtr font)
free a dynamically loaded font
void rfbInitServer(rfbScreenInfoPtr rfbScreen)
int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen, rfbFontDataPtr font, int x, int y, unsigned char c, int x1, int y1, int x2, int y2, rfbPixel colour, rfbPixel backColour)
if colour==backColour, background is transparent
rfbFontDataPtr rfbLoadConsoleFont(char *filename)
dynamically load a linux console font (4096 bytes, 256 glyphs a 8x16
int rfbSelectBox(rfbScreenInfoPtr rfbScreen, rfbFontDataPtr font, char **list, int x1, int y1, int x2, int y2, rfbPixel foreColour, rfbPixel backColour, int border, SelectionChangedHookPtr selChangedHook)
void rfbFillRect(rfbScreenInfoPtr s, int x1, int y1, int x2, int y2, rfbPixel col)
void rfbScreenCleanup(rfbScreenInfoPtr screenInfo)
rfbScreenInfoPtr rfbGetScreen(int *argc, char **argv, int width, int height, int bitsPerSample, int samplesPerPixel, int bytesPerPixel)
rfbBool rfbIsActive(rfbScreenInfoPtr screenInfo)
rfbBool rfbProcessEvents(rfbScreenInfoPtr screenInfo, long usec)