Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / diskfont / diskfont_intern.h
blob4f5adedf134fa3d3149e969cfba615494644b01b
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #ifndef DISKFONT_INTERN_H
7 #define DISKFONT_INTERN_H
9 #ifndef PROTO_EXEC_H
10 # include <proto/exec.h>
11 #endif
12 #ifndef EXEC_LIBRARIES_H
13 # include <exec/libraries.h>
14 #endif
15 #ifndef DISKFONT_DISKFONT_H
16 # include <diskfont/diskfont.h>
17 #endif
18 #ifndef EXEC_MEMORY_H
19 # include <exec/memory.h>
20 #endif
21 #ifndef EXEC_LISTS_H
22 # include <exec/lists.h>
23 #endif
24 #include <exec/semaphores.h>
25 #ifndef AROS_ASMCALL_H
26 # include <aros/asmcall.h>
27 #endif
28 #ifndef UTILITY_HOOKS_H
29 # include <utility/hooks.h>
30 #endif
31 #ifndef DOS_DOS_H
32 # include <dos/dos.h>
33 #endif
34 #include <aros/libcall.h>
36 /* Options */
38 #define ALWAYS_ZERO_LIBCOUNT 1
40 /**************/
41 /* */
42 /* AVAILFONTS */
43 /* */
44 /**************/
47 /**************/
48 /* Constants */
49 /**************/
51 /* Number of font hooks used */
52 #define NUMFONTHOOKS 2
54 #define FONTTYPE_ROMFONT FPF_ROMFONT
55 #define FONTTYPE_DISKFONT FPF_DISKFONT
56 #define FONTTYPE_SCALEDFONT 0
57 #define FONTTYPE_OUTLINEFONT (FPF_ROMFONT | FPF_DISKFONT)
58 #define FONTTYPE_FLAGMASK (FPF_ROMFONT | FPF_DISKFONT)
60 #define IS_SCALED_FONT(ta) (((ta)->tta_Flags & FONTTYPE_FLAGMASK) == FONTTYPE_SCALEDFONT)
61 #define IS_OUTLINE_FONT(ta) (((ta)->tta_Flags & FONTTYPE_FLAGMASK) == FONTTYPE_OUTLINEFONT)
63 /* ID for cache-file */
64 #ifdef __MORPHOS__
65 #define CACHE_IDSTR "MORPHOS_FC"
66 #else
67 #define CACHE_IDSTR "AROS_FC"
68 #endif
70 /* Path to the cachefile */
71 #ifdef __MORPHOS__
72 #define CACHE_FILE "FONTS:_fontcache"
73 #else
74 #define CACHE_FILE "fontcache"
75 #endif
76 #define PROGDIRFONTSDIR "PROGDIR:Fonts/"
77 #define FONTSDIR "FONTS:"
79 struct OTagList
81 STRPTR filename;
82 struct TagItem tags[1];
85 struct FontDescrHeader
87 UWORD NumOutlineEntries;
88 UWORD NumEntries;
89 UWORD ContentsID;
90 BOOL Tagged;
91 struct TTextAttr *TAttrArray;
92 struct OTagList *OTagList;
98 struct AADiskFontHeader
100 struct Node dfh_DF;
101 UWORD dfh_FileID;
102 UWORD dfh_Revision;
103 LONG dfh_Segment;
104 char dfh_Name[MAXFONTNAME];
105 struct ColorTextFont dfh_TF;
110 /**************/
111 /* Prototypes */
112 /**************/
114 struct DiskfontBase_intern; /* prerefrence */
116 /* memoryfontfunc.c */
118 APTR MF_IteratorInit(struct DiskfontBase_intern *);
119 struct TTextAttr *MF_IteratorGetNext(APTR, struct DiskfontBase_intern *);
120 VOID MF_IteratorFree(APTR, struct DiskfontBase_intern *);
122 /* diskfontfunc.c */
124 VOID CleanUpFontsDirEntryList(struct DiskfontBase_intern *);
125 APTR DF_IteratorInit(struct TTextAttr *, struct DiskfontBase_intern *);
126 struct TTextAttr *DF_IteratorGetNext(APTR, struct DiskfontBase_intern *);
127 VOID DF_IteratorRemember(APTR, struct DiskfontBase_intern *);
128 struct TextFont *DF_IteratorRememberOpen(APTR, struct DiskfontBase_intern *);
129 VOID DF_IteratorFree(APTR, struct DiskfontBase_intern *);
130 struct TextFont *DF_OpenFontPath(struct TextAttr *, struct DiskfontBase_intern *);
132 /* diskfont_io.c */
134 struct DiskFontHeader *ConvDiskFont(BPTR, CONST_STRPTR, BOOL, struct DiskfontBase_intern *);
135 void DisposeConvDiskFont(struct DiskFontHeader *, struct DiskfontBase_intern *);
136 struct TextFont *ReadDiskFont(struct TTextAttr *, CONST_STRPTR, struct DiskfontBase_intern *);
138 /* af_fontdescr_io.c */
140 struct FontDescrHeader *ReadFontDescr(CONST_STRPTR, struct DiskfontBase_intern *);
141 VOID FreeFontDescr(struct FontDescrHeader *, struct DiskfontBase_intern *);
143 /* dosstreamhook.c */
145 AROS_UFP3(LONG, dosstreamhook,
146 AROS_UFPA(struct Hook *, hook, A0),
147 AROS_UFPA(BPTR, file, A2),
148 AROS_UFPA(ULONG *, msg, A1)
151 /* bullet.c */
153 STRPTR OTAG_MakeFileName(CONST_STRPTR, struct DiskfontBase_intern *);
154 VOID OTAG_FreeFileName(STRPTR, struct DiskfontBase_intern *);
155 struct OTagList *OTAG_GetFile(CONST_STRPTR, struct DiskfontBase_intern *);
156 VOID OTAG_KillFile(struct OTagList *, struct DiskfontBase_intern *);
157 UBYTE OTAG_GetFontStyle(struct OTagList *, struct DiskfontBase_intern *);
158 UBYTE OTAG_GetSupportedStyles(struct OTagList *, struct DiskfontBase_intern *);
159 UBYTE OTAG_GetFontFlags(struct OTagList *, struct DiskfontBase_intern *);
160 struct TextFont *OTAG_ReadOutlineFont(struct TTextAttr *, struct TTextAttr *, struct OTagList *, struct DiskfontBase_intern *);
162 /* basicfuncs.c */
164 #define MAKE_REAL_SEGMENT(x) (MKBADDR(((IPTR)(x)) - sizeof(BPTR)))
166 APTR AllocSegment(BPTR *, ULONG, ULONG, struct DiskfontBase_intern *);
167 struct TagItem *ReadTags(BPTR, ULONG, struct DiskfontBase_intern *);
168 struct TagItem *ReadTagsNum(BPTR, ULONG *, struct DiskfontBase_intern *);
169 /*BOOL WriteTags(BPTR, struct TagItem *, struct DiskfontBase_intern *);*/
170 BOOL WriteTagsNum(BPTR, const struct TagItem *, struct DiskfontBase_intern *);
171 ULONG NumTags(const struct TagItem *, struct DiskfontBase_intern *);
172 ULONG CopyTagItems(struct TagItem *, const struct TagItem *, struct DiskfontBase_intern *);
175 /********************/
176 /* Some nice macros */
177 /********************/
179 #undef AFH
180 #define AFH(p) ((struct AvailFontsHeader *)p)
182 #undef AVF
183 #define AVF(p) ((struct AvailFonts *)p)
185 #undef TAVF
186 #define TAVF(p) ((struct TAvailFonts *)p)
188 #undef TI
189 #define TI(t) ((struct TagItem *)t)
191 #undef UB
192 #define UB(p) ((UBYTE *)p)
194 #undef TFE
195 #define TFE(t) ((struct TextFontExtension*)t)
197 /* Some external stuff (diskfont_init.c) */
199 /* Internal prototypes */
202 struct DiskfontBase_intern
204 struct Library lib;
206 /* dosstreamhandler hook neede for endian io funcs */
207 struct Hook dsh;
208 struct List diskfontlist;
210 struct MinList fontsdirentrylist;
211 struct SignalSemaphore fontssemaphore;
213 /* MemHandler interrupt for flushing library */
214 struct Interrupt memint;
217 #define DFB(dfb) ((struct DiskfontBase_intern *)dfb)
219 #endif /* diskfont_intern.h */