2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
6 #ifndef DISKFONT_INTERN_H
7 #define DISKFONT_INTERN_H
10 # include <proto/exec.h>
12 #ifndef EXEC_LIBRARIES_H
13 # include <exec/libraries.h>
15 #ifndef DISKFONT_DISKFONT_H
16 # include <diskfont/diskfont.h>
19 # include <exec/memory.h>
22 # include <exec/lists.h>
24 #include <exec/semaphores.h>
25 #ifndef AROS_ASMCALL_H
26 # include <aros/asmcall.h>
28 #ifndef UTILITY_HOOKS_H
29 # include <utility/hooks.h>
34 #include <aros/libcall.h>
38 #define ALWAYS_ZERO_LIBCOUNT 1
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 */
65 #define CACHE_IDSTR "MORPHOS_FC"
67 #define CACHE_IDSTR "AROS_FC"
70 /* Path to the cachefile */
72 #define CACHE_FILE "FONTS:_fontcache"
74 #define CACHE_FILE "fontcache"
76 #define PROGDIRFONTSDIR "PROGDIR:Fonts/"
77 #define FONTSDIR "FONTS:"
82 struct TagItem tags
[1];
85 struct FontDescrHeader
87 UWORD NumOutlineEntries
;
91 struct TTextAttr
*TAttrArray
;
92 struct OTagList
*OTagList
;
98 struct AADiskFontHeader
104 char dfh_Name
[MAXFONTNAME
];
105 struct ColorTextFont dfh_TF
;
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
*);
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
*);
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
)
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
*);
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 /********************/
180 #define AFH(p) ((struct AvailFontsHeader *)p)
183 #define AVF(p) ((struct AvailFonts *)p)
186 #define TAVF(p) ((struct TAvailFonts *)p)
189 #define TI(t) ((struct TagItem *)t)
192 #define UB(p) ((UBYTE *)p)
195 #define TFE(t) ((struct TextFontExtension*)t)
197 /* Some external stuff (diskfont_init.c) */
199 /* Internal prototypes */
202 struct DiskfontBase_intern
206 /* dosstreamhandler hook neede for endian io funcs */
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 */