lib/gemfont.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
00003  * for personal, academic, and non-profit purposes.  Commercial use          *
00004  * permitted only by explicit agreement with Jim Kent (jim_kent@pacbell.net) *
00005  *****************************************************************************/
00006 #ifndef GEMFONT_H
00007 #define GEMFONT_H
00008 
00009 /* This file supports GEM style fonts.  They live on disk in three parts.
00010    1st there's the header structure below, then a list of 'x' offsets into
00011    the data - one 16-bit word for each offset, and 1 offset for each letter
00012    in the font plus an extra offset at the end.
00013 
00014    This is followed by the data which is a single bitmap.
00015    */
00016 
00017 struct  font_hdr {
00018 WORD    id;                     /* some random number, doesnt matter */
00019 WORD    size;           /* Size in points.  Somehow related to pixel height. */
00020 char    facename[32];   /* Give it a name, don't really matter. */
00021 WORD    ADE_lo;         /* Lowest ascii character in font */
00022 WORD    ADE_hi;         /* Highest ascii character in font */
00023 WORD    top_dist;
00024 WORD    asc_dist;       /* Ascender to baseline?? */
00025 WORD    hlf_dist;
00026 WORD    des_dist;       /* des for descender. */
00027 WORD    bot_dist;
00028 WORD    wchr_wdt;       /* Widest character width. */
00029 WORD    wcel_wdt;       /* Widest 'cell' width (includes distance to next character) */
00030 WORD    lft_ofst;
00031 WORD    rgt_ofst;
00032 WORD    thckning;
00033 WORD    undrline;
00034 WORD    lghtng_m;       /* Lightening mask.  Just use 0x55aa. */
00035 WORD    skewng_m;       /* Skewing mask for italics. If 1 bit rotate this line. 0xaaaa*/
00036 WORD    flags;          /* Just set to zero.  Half-assed intel swap if otherwise. */
00037 signed char *hz_ofst;  /* On disk byte offset from beginning of file to hor. offsets */
00038 WORD    *ch_ofst;       /* On disk byte offset to beginning of ?? kerning ?? data. */
00039 UBYTE   *fnt_dta;       /* On disk byte offset to beginning of bitmap. */
00040 WORD    frm_wdt;        /* Byte width of bitmap. */
00041 WORD    frm_hgt;        /* Pixel height of bitmap. */
00042 struct font_hdr *nxt_fnt; /* Set to 0 */
00043 WORD    xOff;           /* X offset to add. */
00044 WORD    yOff;           /* Y offset to add. */
00045 }; 
00046 
00047 #define STPROP 0
00048 #define MFIXED 1
00049 #define MPROP 2
00050 
00051 /* Write a line of graphics text. */
00052 void gfText(struct memGfx *screen, struct font_hdr *f, char *text, 
00053        int x, int y, Color color, TextBlit tblit, Color bcolor);
00054 
00055 /* How tall is font? */
00056 int font_cel_height(struct font_hdr *f);
00057 
00058 /* How wide would this bunch of characters be? */
00059 long fnstring_width(struct font_hdr *f, unsigned char *s, int n);
00060 
00061 /* How wide is widest char in font? */
00062 int fwidest_char(struct font_hdr *f);
00063 
00064 #endif 

Generated on Tue Dec 25 18:39:30 2007 for blat by  doxygen 1.5.2