summaryrefslogtreecommitdiffstats
path: root/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'font.c')
-rw-r--r--font.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/font.c b/font.c
index 3fa6b3c..9356793 100644
--- a/font.c
+++ b/font.c
@@ -1,7 +1,7 @@
#include "rfb.h"
int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
- int x,int y,char c,CARD32 colour)
+ int x,int y,unsigned char c,CARD32 colour)
{
int i,j,k,width,height;
unsigned char d;
@@ -12,7 +12,7 @@ int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
width=font->metaData[c*5+1];
height=font->metaData[c*5+2];
x+=font->metaData[c*5+3];
- y+=font->metaData[c*5+4]-height+1;
+ y+=-font->metaData[c*5+4]-height+1;
for(j=0;j<height;j++) {
for(i=0;i<width;i++) {
@@ -23,7 +23,7 @@ int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
if(d&0x80) {
for(k=0;k<bpp;k++)
rfbScreen->frameBuffer[(y+j)*rowstride+(x+i)*bpp+k]=
- ((colour>>(8*bpp))&0xff);
+ ((colour>>(8*k))&0xff);
}
d<<=1;
}
@@ -34,7 +34,7 @@ int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
}
void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
- int x,int y,char* string,CARD32 colour)
+ int x,int y,unsigned char* string,CARD32 colour)
{
while(*string) {
x+=rfbDrawChar(rfbScreen,font,x,y,*string,colour);
@@ -42,7 +42,7 @@ void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
}
}
-int rfbWidth(rfbFontDataPtr font,char* string)
+int rfbWidth(rfbFontDataPtr font,unsigned char* string)
{
int i=0;
while(*string) {
@@ -52,10 +52,15 @@ int rfbWidth(rfbFontDataPtr font,char* string)
return(i);
}
-void rfbFontBBox(rfbFontDataPtr font,char c,int* x1,int* y1,int* x2,int* y2)
+int rfbWidthOfChar(rfbFontDataPtr font,unsigned char c)
+{
+ return(font->metaData[c*5+1]+font->metaData[c*5+3]);
+}
+
+void rfbFontBBox(rfbFontDataPtr font,unsigned char c,int* x1,int* y1,int* x2,int* y2)
{
*x1+=font->metaData[c*5+3];
- *y1+=font->metaData[c*5+4]-font->metaData[c*5+2]+1;
+ *y1+=-font->metaData[c*5+4]-font->metaData[c*5+2]+1;
*x2=*x1+font->metaData[c*5+1];
*y2=*y1+font->metaData[c*5+2];
}