grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / diskfont / diskfont_intern.h
blob5041ac0e037aa903fe1b81f72b618b11b1b7ceb4
1 /*
2 Copyright © 1995-2016, 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;
83 ULONG data[1];
86 struct FontDescrHeader
88 UWORD NumOutlineEntries;
89 UWORD NumEntries;
90 UWORD ContentsID;
91 BOOL Tagged;
92 struct TTextAttr *TAttrArray;
93 struct OTagList *OTagList;
99 struct AADiskFontHeader
101 struct Node dfh_DF;
102 UWORD dfh_FileID;
103 UWORD dfh_Revision;
104 BPTR dfh_Segment;
105 char dfh_Name[MAXFONTNAME];
106 struct ColorTextFont dfh_TF;
111 /**************/
112 /* Prototypes */
113 /**************/
115 struct DiskfontBase; /* prereference */
117 /* memoryfontfunc.c */
119 APTR MF_IteratorInit(struct DiskfontBase *);
120 struct TTextAttr *MF_IteratorGetNext(APTR, struct DiskfontBase *);
121 VOID MF_IteratorFree(APTR, struct DiskfontBase *);
123 /* diskfontfunc.c */
125 VOID CleanUpFontsDirEntryList(struct DiskfontBase *);
126 APTR DF_IteratorInit(struct TTextAttr *, struct DiskfontBase *);
127 struct TTextAttr *DF_IteratorGetNext(APTR, struct DiskfontBase *);
128 VOID DF_IteratorRemember(APTR, struct DiskfontBase *);
129 struct TextFont *DF_IteratorRememberOpen(APTR, struct DiskfontBase *);
130 VOID DF_IteratorFree(APTR, struct DiskfontBase *);
131 struct TextFont *DF_OpenFontPath(struct TextAttr *, struct DiskfontBase *);
133 /* diskfont_io.c */
135 struct DiskFontHeader *ConvDiskFont(BPTR, CONST_STRPTR, BOOL, struct DiskfontBase *);
136 void DisposeConvDiskFont(struct DiskFontHeader *, struct DiskfontBase *);
137 struct TextFont *ReadDiskFont(struct TTextAttr *, CONST_STRPTR, struct DiskfontBase *);
139 /* af_fontdescr_io.c */
141 struct FontDescrHeader *ReadFontDescr(CONST_STRPTR, struct DiskfontBase *);
142 VOID FreeFontDescr(struct FontDescrHeader *, struct DiskfontBase *);
144 /* dosstreamhook.c */
146 AROS_UFP3(LONG, dosstreamhook,
147 AROS_UFPA(struct Hook *, hook, A0),
148 AROS_UFPA(BPTR, file, A2),
149 AROS_UFPA(ULONG *, msg, A1)
152 /* bullet.c */
154 STRPTR OTAG_MakeFileName(CONST_STRPTR, struct DiskfontBase *);
155 VOID OTAG_FreeFileName(STRPTR, struct DiskfontBase *);
156 struct OTagList *OTAG_GetFile(CONST_STRPTR, struct DiskfontBase *);
157 VOID OTAG_KillFile(struct OTagList *, struct DiskfontBase *);
158 UBYTE OTAG_GetFontStyle(struct OTagList *, struct DiskfontBase *);
159 UBYTE OTAG_GetSupportedStyles(struct OTagList *, struct DiskfontBase *);
160 UBYTE OTAG_GetFontFlags(struct OTagList *, struct DiskfontBase *);
161 struct TextFont *OTAG_ReadOutlineFont(struct TTextAttr *, struct TTextAttr *, struct OTagList *, struct DiskfontBase *);
163 /* basicfuncs.c */
165 #define MAKE_REAL_SEGMENT(x) (MKBADDR(((IPTR)(x)) - sizeof(BPTR)))
167 APTR AllocSegment(BPTR *, ULONG, ULONG, struct DiskfontBase *);
168 struct TagItem *ReadTags(BPTR, ULONG, struct DiskfontBase *);
169 struct TagItem *ReadTagsNum(BPTR, ULONG *, struct DiskfontBase *);
170 /*BOOL WriteTags(BPTR, struct TagItem *, struct DiskfontBase *);*/
171 BOOL WriteTagsNum(BPTR, const struct TagItem *, struct DiskfontBase *);
172 ULONG NumTags(const struct TagItem *, struct DiskfontBase *);
173 ULONG CopyTagItems(struct TagItem *, const struct TagItem *, struct DiskfontBase *);
176 /********************/
177 /* Some nice macros */
178 /********************/
180 #undef AFH
181 #define AFH(p) ((struct AvailFontsHeader *)p)
183 #undef AVF
184 #define AVF(p) ((struct AvailFonts *)p)
186 #undef TAVF
187 #define TAVF(p) ((struct TAvailFonts *)p)
189 #undef TI
190 #define TI(t) ((struct TagItem *)t)
192 #undef UB
193 #define UB(p) ((UBYTE *)p)
195 #undef TFE
196 #define TFE(t) ((struct TextFontExtension*)t)
198 /* Some external stuff (diskfont_init.c) */
200 /* Internal prototypes */
202 struct DiskfontBase
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 *)dfb)
219 #endif /* diskfont_intern.h */