/* This File Automatically Generated by the build system */ 
#include <dev2d.h> 
#ifndef __FONT_H 
#define  __FONT_H 
#pragma once 
// $Header: x:/prj/tech/libsrc/font/RCS/fonts.h 1.2 1997/01/23 14:06:10 KEVIN Exp $

typedef struct grs_font {
   ushort   id;
   uchar    flags;           // special extended flags, EXF_XXX
   uchar    pal_id;          // palette id for 8 bit fonts on 16+ bit canvas
   short    spacing;         // fractional spacing
   long     kernOffset;      // offset to kerning table
   short    vertAdjust;      // Vertical spacing adjustment, added to h
   char     dummy1[24];      // all 0 of 0x0A in case of anti-alias
   short    min;
   short    max;
   char     dummy2[32];
   long     cotptr;
   long     buf;
   short    w;
   short    h;
   short    off_tab[1];
} grs_font;

typedef struct grs_font_info {
   uchar       align_mask;
   uchar       align_base;
   ushort      pad;
   gdubm_func *blitter;
   uchar      *bits;
   short      *off_tab;
   uint        range;
   grs_bitmap  bm;
} grs_font_info;

// font flags
#define FONTF_SPACING      0x02  // extra (fractional) spacing set
#define FONTF_KERNTABLE    0x04  // kerning table appended
#define FONTF_VERTADJUST   0x08  // Vertical spacing adjust

// font types
#define FONTT_MONO         0x0000
#define FONTT_ANTIALIAS16  0x0001
#define FONTT_FLAT8        0xcccc

/*
 * $Source: x:/prj/tech/libsrc/font/RCS/chrsiz.h $
 * $Revision: 1.2 $
 * $Author: PATMAC $
 * $Date: 1998/07/04 13:16:18 $
 *
 * character size routine prototypes.
 *
 * This file is part of the font library.
 *
 */

EXTERN short gr_font_char_width (grs_font *f, char c);
EXTERN void gr_font_char_size (grs_font *f, char c, short *w, short *h);

/*
 * $Source: x:/prj/tech/libsrc/font/RCS/strsiz.h $
 * $Revision: 1.2 $
 * $Author: PATMAC $
 * $Date: 1998/07/04 13:16:30 $
 *
 * string size routine prototypes.
 *
 * This file is part of the font library.
 *
 */

EXTERN short gr_font_string_width (grs_font *f, char *s);
EXTERN short gr_font_string_height (grs_font *f, char *s);
EXTERN void gr_font_string_size (grs_font *f, char *s, short *w, short *h);

EXTERN short gr_font_string_nwidth (grs_font *f, char *s, int n);
EXTERN short gr_font_string_nheight (grs_font *f, char *s, int n);
EXTERN void gr_font_string_nsize (grs_font *f, char *s, short *w, short *h, int n);

/*
 * $Source: x:/prj/tech/libsrc/font/RCS/fontf.h $
 * $Revision: 1.6 $
 * $Author: PATMAC $
 * $Date: 1998/07/04 13:16:27 $
 *
 * Prototypes for font functions.
 *
 * This file is part of the font library.
 *
 */

/* font set/get macros */
#define gr_set_font(font_parm) (grd_canvas->gc.font = (void *)(font_parm))
#define gr_get_font()     ((grs_font *)(grd_canvas->gc.font))

/* prototypes for non-table driven string handling routines. */
EXTERN void gr_font_string_uclear (grs_font *f, char *s, short x, short y);
EXTERN int gr_font_string_clear (grs_font *f, char *s, short x, short y);
EXTERN void gr_font_uchar (grs_font *f, char c, short x, short y);
EXTERN int gr_font_char (grs_font *f, char c, short x, short y);
EXTERN void gr_font_char_uclear (grs_font *f, char c, short x, short y);
EXTERN int gr_font_char_clear (grs_font *f, char c, short x, short y);
EXTERN int gr_font_string_wrap (grs_font *pfont, char *ps, short width);
EXTERN void gr_font_string_unwrap (char *s);
EXTERN void gr_font_ustring(grs_font *f, char *s, int x, int y);
EXTERN int gr_font_string(grs_font *f, char *s, int x, int y);
EXTERN void gr_font_scale_ustring(grs_font *f, char *s, int x, int y, int w, int h);
EXTERN int gr_font_scale_string(grs_font *f, char *s, int x, int y, int w, int h);

/* use the current font */

#define gr_char_width(c) \
    gr_font_char_width (gr_get_font(), c)

#define gr_char_size(c, w, h) \
    gr_font_char_size (gr_get_font(), c, w, h)

#define gr_string_size(s, w, h) \
   gr_font_string_size (gr_get_font(), s, w, h)

#define gr_string_nsize(s, n, w, h) \
   gr_font_string_nsize (gr_get_font(), s, n, w, h)

#define gr_string_width(s) \
   gr_font_string_width (gr_get_font(), s)

#define gr_string_nwidth(s, n) \
   gr_font_string_nwidth (gr_get_font(), s, n)

#define gr_string_height(s) \
   gr_font_string_height (gr_get_font(), s)

#define gr_string_nheight(s, n) \
   gr_font_string_nheight (gr_get_font(), s, n)

#define gr_string_uclear(s, x, y) \
   gr_font_string_uclear (gr_get_font, s, x, y)

#define gr_string_clear(s, x, y) \
    gr_font_string_clear (gr_get_font(), s, x, y)

#define gr_char(c, x, y) \
    gr_font_char (gr_get_font(), c, x, y)

#define gr_char_uclear(c, x, y) \
    gr_font_char_uclear (gr_get_font(), c, x, y)

#define gr_char_clear(c, x, y) \
    gr_font_char_clear (gr_get_font(), c, x, y)

#define gr_string_warp(s) \
    gr_font_string_wrap (gr_get_font(), s)

#define gr_string_unwarp(s) \
    gr_font_string_unwrap (gr_get_font(), s)

#define gr_ustring(s, x, y) \
    gr_font_ustring (gr_get_font(), s, x, y)

#define gr_string(s, x, y) \
    gr_font_string (gr_get_font(), s, x, y)

#define gr_scale_ustring(s, x, y, w, h) \
    gr_font_scale_ustring (gr_get_font(), s, x, y, w, h)

#define gr_scale_string(s, x, y, w, h) \
    gr_font_scale_string (gr_get_font(), s, x, y, w, h)

#endif /* __FONT_H */ 
