lib/gemfont.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  font_hdr

Defines

#define STPROP   0
#define MFIXED   1
#define MPROP   2

Functions

void gfText (struct memGfx *screen, struct font_hdr *f, char *text, int x, int y, Color color, TextBlit tblit, Color bcolor)
int font_cel_height (struct font_hdr *f)
long fnstring_width (struct font_hdr *f, unsigned char *s, int n)
int fwidest_char (struct font_hdr *f)


Define Documentation

#define MFIXED   1

Definition at line 48 of file gemfont.h.

Referenced by fchar_width(), and gfText().

#define MPROP   2

Definition at line 49 of file gemfont.h.

Referenced by fchar_width(), and gfText().

#define STPROP   0

Definition at line 47 of file gemfont.h.

Referenced by fchar_width(), and gfText().


Function Documentation

long fnstring_width ( struct font_hdr f,
unsigned char *  s,
int  n 
)

Definition at line 150 of file gemfont.c.

References fchar_width().

Referenced by mgFontWidth().

00151 {
00152 long acc = 0;
00153 
00154 while (--n >= 0)
00155     {
00156     acc += fchar_width(f, s);
00157     s++;
00158     }
00159 return(acc);
00160 }

Here is the call graph for this function:

Here is the caller graph for this function:

int font_cel_height ( struct font_hdr f  ) 

Definition at line 191 of file gemfont.c.

References font_hdr::frm_hgt.

Referenced by mgFontLineHeight(), and mgFontPixelHeight().

00192 {
00193 int dy;
00194 
00195 dy = f->frm_hgt;
00196 return(dy);
00197 }

Here is the caller graph for this function:

int fwidest_char ( struct font_hdr f  ) 

Definition at line 170 of file gemfont.c.

References font_hdr::ADE_hi, font_hdr::ADE_lo, and fchar_width().

00171 {
00172 unsigned char buf[2];
00173 int i;
00174 int c;
00175 int widest = 1;
00176 int w;
00177 
00178 c = f->ADE_lo;
00179 i = f->ADE_hi - c;
00180 buf[1] = 0;
00181 while (--i >= 0)
00182         {
00183         buf[0] = c++;
00184         w = fchar_width(f, buf);
00185         if (w > widest)
00186                 widest = w;
00187         }
00188 return(widest);
00189 }

Here is the call graph for this function:

void gfText ( struct memGfx screen,
struct font_hdr f,
char *  text,
int  x,
int  y,
Color  color,
TextBlit  tblit,
Color  bcolor 
)

Definition at line 17 of file gemfont.c.

References font_hdr::ADE_hi, font_hdr::ADE_lo, font_hdr::ch_ofst, font_hdr::fnt_dta, font_hdr::frm_hgt, font_hdr::frm_wdt, font_hdr::hz_ofst, font_hdr::id, font_hdr::lft_ofst, MFIXED, MPROP, font_hdr::rgt_ofst, ss, STPROP, UBYTE, font_hdr::wchr_wdt, WORD, font_hdr::xOff, and font_hdr::yOff.

Referenced by mgText().

00019 {
00020 UBYTE *s = (UBYTE*)text;
00021 UBYTE *ss;
00022 int c, lo, hi;
00023 int sx, imageWid;
00024 WORD *off, wd, ht;
00025 UBYTE *data;
00026 myInt *OWtab, *iPtr;
00027 int missChar;
00028 int font_type;
00029 int extraWidth = f->lft_ofst + f->rgt_ofst;
00030 
00031 x += f->xOff;
00032 y += f->yOff;
00033 x += f->lft_ofst;
00034 lo = f->ADE_lo;
00035 hi = f->ADE_hi;
00036 off = f->ch_ofst;
00037 wd = f->frm_wdt;
00038 ht = f->frm_hgt,
00039 data = f->fnt_dta;
00040 OWtab= (myInt *)(f->hz_ofst);
00041 font_type = f->id;
00042 
00043 while ((c = *s++)!=0)
00044     {
00045     /* If we don't have the character, just turn it into a space. */
00046     if (c > hi)
00047         {
00048         c = ' ';
00049         }
00050     c -= lo;
00051     if (c < 0)
00052         {
00053         c = ' ' - lo;
00054         }
00055 
00056     /* Mac prop font && its a missing char */
00057     if (font_type == MPROP && (*(OWtab+c)).theInt == -1) 
00058         {            
00059         c=hi-lo;                      /* last char is set */
00060         missChar=1;
00061         sx = off[c+1];
00062         imageWid= f->frm_wdt*8 - sx;  /* sort of a kludge */
00063         }
00064     else 
00065         {
00066         missChar=0;
00067         sx = off[c];
00068         imageWid = off[c+1]-sx;
00069         }
00070     (*tblit)(imageWid, ht, sx, 0, data, wd, screen, x, y, color, bcolor);
00071     switch (font_type)
00072         {
00073         case STPROP:
00074             x += imageWid + extraWidth;
00075             break;
00076         case MFIXED:
00077             x += f->wchr_wdt + extraWidth;          
00078             break;
00079         case MPROP:
00080             iPtr=OWtab+c;  
00081             if (!missChar)
00082                     /* -1 means its a missing character */
00083                 {
00084                 x += (int)((*iPtr).bytes[1]);
00085                 ss=s;
00086                 if ((c=*(ss++)) != 0)
00087                         /* look to next char to determine amt to change x */
00088                     {
00089                     c-= lo;
00090                     iPtr=OWtab+c;
00091                     /* subtract kern Of Next char */
00092                     /* f->rgt_ofst is neg of Mac maxKern value */
00093                     if ((*iPtr).theInt!=-1)
00094                        x += (int)((*iPtr).bytes[0])+ f->rgt_ofst;  
00095                     }           
00096                 }
00097             else /* display the non print char */
00098                 x+=imageWid + extraWidth;
00099             break;
00100         }
00101     }
00102 }

Here is the caller graph for this function:


Generated on Tue Dec 25 19:51:33 2007 for blat by  doxygen 1.5.2