 IFND  VFONT_VFONT_I
VFONT_VFONT_I     SET  1

 IFND EXEC_TYPES_I
 INCLUDE "exec/types.i"
 ENDC
 IFND EXEC_LIBRARIES_I
 INCLUDE "exec/libraries.i"
 ENDC
 IFND EXEC_LISTS_I
 INCLUDE "exec/lists.i"
 ENDC
 IFND EXEC_SAMAPHORES_I
 INCLUDE "exec/semaphores.i"
 ENDC
 IFND GRAPHICS_GFX_I
 INCLUDE "graphics/gfx.i"
 ENDC
 

FIXOFFSET  equ 2097152

;**********************
;* VFont Class stuff. *
;**********************

CharWidth   MACRO
    movea.l vf_Class(\1),a0
    movea.l vfc_Chars(a0),a0
    muls.l  vfcc_SIZEOF,\2
    move.w  vfcc_Width(a0),\2
    move.w  \2,d0
    ENDM

CharHeight MACRO
    movea.l vf_Class(\1),a0
    movea.l vfc_Chars(a0),a0
    muls.l  vfcc_SIZEOF,\2
    move.w  vfcc_Height(a0),\2
    move.w  \2,d0
    ENDM

VC_FILL         equ      $01        ;# Draw solid characters. 
VC_WIRE         equ      $02        ;# Draw wire character. Contour otherwise
VC_CONTINUES    equ      $04        ;# Continue on next curve.     
VC_BEND         equ      $08        ;# Bend the line. 
VC_CURVE        equ      $10        ;# No end points. 
VC_CONTINUED    equ      $20        ;# Continued from the previous curve. 
VC_ROUND        equ      $40        ;# Bended line with no end points. 
VC_THINCURVE    equ      $80        ;# Should be shrunk when mapped.

 STRUCTURE VCurve,0
    APTR    vc_Next                 ;# The next. 
    APTR    vc_Verticies            ;# The verticies. 
    UWORD   vc_Used                 ;# The number of verticies. 
    UWORD   vc_Size                 ;# The actual space for the curve. 
    WORD    vc_R                    ;# The roundness. 
    UBYTE   vc_E                    ;# The edginess. 
    UBYTE   vc_Flags                ;# Flags. 
    BYTE    vc_FgPen                ;# Foreground color. 
    BYTE    vc_BgPen                ;# Background color. 
    BYTE    vc_OlPen                ;# Outline color. 
    BYTE    vc_DMode                ;# Draw mode 
    WORD    vc_sym_x                ;# Symetry point. 
    WORD    vc_sym_y                ;# -"- 
    LABEL   vc_SIZEOF

 STRUCTURE VClassChar,0
    APTR    vcc_Curve 
    UWORD   vcc_Width 
    UWORD   vcc_Height 
    LABEL   vcc_SIZEOF


 STRUCTURE VFontClass,0
    APTR    vfcl_Next        ;# Next font class. 
    APTR    vfcl_Name        ;# Symbolic name of the font class. 
    APTR    vfcl_Author      ;# The name of the author. 
    UWORD   vfcl_XSize       ;# Size of the average template chars. 
    UWORD   vfcl_YSize       ;# Size of the average template chars. 
    LONG    vfcl_UpVector    ;# Default Up direction of char. 
    LONG    vfcl_Tilt        ;# Factor of italic text. 
    UBYTE   vfcl_Flags       ;# The flags. 
    UBYTE   vfcl_Style       ;# The styles. 
    UBYTE   vfcl_Locked      ;# Semaphore of exlusive use of class. 
    UBYTE   vfcl_LowChar     ;# First defined character. 
    UBYTE   vfcl_HighChar    ;# The last defined character. 
    UBYTE   vfcl_Space       ;# Default spacing between char. 
    APTR    vfcl_Chars       ;# The actual definition of chars. 
    UWORD   vfcl_Baseline    ;# Baseline. 
    UWORD   vfcl_Users       ;# Pad. 
    LABEL   vfcl_SIZEOF



;************************
;# VFont instance stuff *
;************************

VFC_FILL         equ        $01        ;# Area fill the character. 
VFC_MAPPED       equ        $02        ;# Character is mapped. 
VFC_NOCOOKIECUT  equ        $04        ;# Don't render a'la cookie-cut. 
VFC_CACHED       equ        $08
VFC_RESERVED     equ        $f0        ;# Reserved for future use. 

VCM_NAME         equ        $01
VCM_SIZE         equ        $02
VCM_STYLE        equ        $04
VCM_UP           equ        $08
VCM_PATH         equ        $10
VCM_TILT         equ        $20
VCM_BOLD         equ        $40

VFCB_FILL        equ        0          ;# Area fill the character.
VFCB_MAPPED      equ        1          ;# Character is mapped.
VFCB_NOCOOKIECUT equ        2          ;# Don't render a'la cookie-cut.
VFCB_CACHED      equ        3

VCMB_NAME        equ        0
VCMB_SIZE        equ        1
VCMB_STYLE       equ        2
VCMB_UP          equ        3
VCMB_PATH        equ        4
VCMB_TILT        equ        5
VCMB_BOLD        equ        6


 STRUCTURE Lines,0
    APTR    l_Next
    APTR    l_XY
    UWORD   l_Count
    BYTE    l_FgPen
    BYTE    l_BgPen
    BYTE    l_OlPen
    BYTE    l_DMode 
    LABEL   l_SIZEOF

 STRUCTURE charDef,0
	WORD    cd_charOffset 
	WORD    cd_charBitWidth 
    LABEL   cd_SIZEOF

 STRUCTURE VFontChar,0
    APTR    vfc_Lines 
    ULONG   vfc_DeltaX
    ULONG   vfc_DeltaY
    UBYTE   vfc_Flags
    STRUCT  vfc_pad,3
    LABEL   vfc_SIZEOF


 STRUCTURE VFont,0

    ;# struct TextFont compatible part 
    APTR    vf_ln_Succ 
    APTR    vf_ln_Pred 
    UBYTE   vf_ln_Type 
    BYTE    vf_ln_Pri 
    APTR    vf_Name 
    APTR    vf_ReplyPort 
    UWORD   vf_Length 

    UWORD   vf_TFYSize 
    UBYTE   vf_Style 
    UBYTE   vf_Flags 
    UWORD   vf_TFXSize 
    UWORD   vf_TFBaseline 
    UWORD   vf_BoldSmear 
    UWORD   vf_Accessors 
    UBYTE   vf_LoChar 
    UBYTE   vf_HiChar 
    APTR    vf_CharData 
    UWORD   vf_Modulo 
    APTR    vf_CharLoc 
    APTR    vf_CharSpace 
    APTR    vf_CharKern  

    ;# struct ColorTextFont compatible extension. 
    UWORD   vf_ColorFlags 
    UBYTE   vf_Depth 
    UBYTE   vf_FgColor 
    UBYTE   vf_Low 
    UBYTE   vf_High 
    UBYTE   vf_PlanePick 
    UBYTE   vf_PlaneOnOff 
    APTR    vf_ColorFontColors 
    STRUCT  vf_ColorCharData,8*4

    ;# The Vector specific part. 
    UWORD   vf_XSize 
    UWORD   vf_YSize 
    UWORD   vf_Baseline 
    APTR    vf_BasePoints       ;# The origin of each character within CharData.
    LONG    vf_UpVector 	    ;# The Up direction of char. 
    LONG    vf_AlfaPath         ;# The direction of text: X-Y angle 
    LONG    vf_BetaPath         ;# The direction of text: Y-Z angle 
    LONG    vf_Tilt 	        ;# Factor of italic text. 
    STRUCT  vf_Lock,SS_SIZE     ;# Semaphore for mutual exclusion. 
    APTR    vf_Chars 	        ;# Character data. 
    APTR    vf_Class            ;# The definition of the font. 
    STRUCT  vf_BM,bm_SIZEOF     ;# A bitmap 
    UWORD   vf_FreeCharOffset   ;# Next free bitoffset in the bitmap. 
    UWORD   vf_CacheSize        ;# Size of the cache. 
    APTR    vf_Next 
    LABEL   vf_SIZEOF



;********************
;# RasterPort hook. *
;********************

MAXBINDS    equ 256

 STRUCTURE VFontBind,0
    APTR    vfbi_VFont      ;# The font. 
    APTR    vfbi_RPort      ;# The rastport. 
    APTR    vfbi_Next       ;# The next. 
    LABEL   vfbi_SIZEOF


;*****************
;# LoadSeg hook. *
;*****************

 STRUCTURE LoadSegs,0
    APTR    lss_Next        ;# The next loadseg. 
    ULONG   lss_Seg         ;# The Segment list. 
    LABEL   lss_SIZEOF


;*****************************
;# VFont library base stuff. *
;*****************************


VFB_MUTE         equ        $0000
VFB_DEBUG        equ        $0001
VFB_VERBOSE      equ        $0002
VFB_FLUSHCLASS   equ        $0004
VFB_FLUSHFONTS   equ        $0008
VFB_MAPPED       equ        $0010
VFB_EXCLUSIVE    equ        $0020
VFB_FORCED       equ        $0040
VFB_NOCONVERT    equ        $0080
VFB_ANYSIZE      equ        $0100
VFB_NOBITCACHE   equ        $0200
VFB_RESERVED     equ        $fc00

 STRUCTURE vFontBase,0
    STRUCT      vfb_Lib,LIB_SIZE        ;# Library stuff. 
    ULONG       vfb_SegList 
    APTR        vfb_VFontClass          ;# List of font classes. 
    APTR        vfb_VFontBinds          ;# List of binding RPort<->VFont. 
    APTR        vfb_DefVFont            ;# List of instansiated fonts. 
    APTR        vfb_DiskFonts           ;# List of loadsegs of diskfonts. 
    STRUCT      vfb_mpool,LH_SIZE       ;# List with MemLists 
    STRUCT      vfb_epool,LH_SIZE       ;# List with MemEntries. 
    WORD        vfb_Flags               ;# For debug purpose etc. 
    APTR        vfb_drawable            ;# Private. 
    APTR        vfb_li                  ;# -""-
    ULONG       vfb_Users               ;# Numbers of clients.
    STRUCT      vfb_Lock,SS_SIZE        ;# Semaphore for mutual exclusion.
    LABEL       vfb_SIZEOF



;**********************
;# Vector Text stuff. *
;**********************

 STRUCTURE TextVAttr,0
    APTR    tva_Name            ;# The name of the desired class or Bitmap font. 
    STRUCT  tva_VectorFont,0    ;# TRUE if vector font. 
    UWORD   tva_YSize           ;# The height. 
    UBYTE   tva_Style           ;# The desired style. 
    UBYTE   tva_Flags           ;# Flags. 
    APTR    tva_FontName        ;# The vector font name. 
    UWORD   tva_XSize           ;# Horizontal size. 
    UWORD   tva_VFlags          ;# Flags for vector fonts. 
    APTR    tva_Type            ;# Indicates the storage format. 
    LABEL   tva_SIZEOF

 STRUCTURE VectorText,0
    UBYTE   vt_FrontPen, BackPen 
    UBYTE   vt_DrawMode 
    WORD    vt_LeftEdge, TopEdge 
    APTR    vt_VFontAttr 
    APTR    vt_Text 
    APTR    vt_Next 
    LABEL   vt_SIZEOF


 ENDC
