32#include <proto/bullet.h>
33#include <proto/exec.h>
34#include <proto/intuition.h>
36#include <proto/utility.h>
38#include <diskfont/diskfont.h>
39#include <diskfont/diskfonttag.h>
40#include <intuition/gadgetclass.h>
45#define FAILURE (FALSE)
64 (*Context->
Index) = Char;
70 if(Context->
Size == 1)
73 (*Context->
Index) =
'\0';
89 const STRPTR FormatString,
90 const va_list VarArgs)
99 if (Buffer == NULL || FormatString == NULL)
return(
result);
105 Context.
Index = Buffer;
106 Context.
Size = MaxLen;
109 RawDoFmt(FormatString,(APTR)VarArgs,(VOID (*)())
StuffChar,(APTR)&Context);
122 const STRPTR FormatString,
130 if (Buffer == NULL && FormatString == NULL)
return result;
132 va_start(VarArgs,FormatString);
151 rbuf = AllocVec(r+1, MEMF_CLEAR);
163 size_t len = strlen(str);
166 str[i] = tolower((
unsigned char)str[i]);
173 char *
const p1 = *s1;
176 *s1 = strpbrk(p1, s2);
184int alphasort(
const struct dirent **d1,
const struct dirent **d2)
190int scandir(
const char *dir,
struct dirent ***namelist,
191 int (*filter)(
const struct dirent *),
192 int (*
compar)(
const struct dirent **,
const struct dirent **))
200 return (
long long int)strtol(nptr, endptr,
base);
210 STRPTR fname, otagpath, fontpath;
211 struct BulletBase *BulletBase;
213 struct GlyphEngine *gengine;
215 struct FontContentsHeader fch;
217 if((p = strrchr(fileName,
'.')))
220 fontpath = (STRPTR)
ASPrintf(
"FONTS:%s.font", fileName);
221 fh = Open(fontpath, MODE_OLDFILE);
224 NSLOG(netsurf, INFO,
"Unable to open FONT %s", fontpath);
229 if(Read(fh, &fch,
sizeof(
struct FontContentsHeader)) !=
sizeof(
struct FontContentsHeader)) {
230 NSLOG(netsurf, INFO,
"Unable to read FONT %s", fontpath);
238 if(fch.fch_FileID != OFCH_ID) {
239 NSLOG(netsurf, INFO,
"%s is not an outline font!", fontpath);
244 otagpath = (STRPTR)
ASPrintf(
"FONTS:%s.otag", fileName);
245 fh = Open(otagpath, MODE_OLDFILE);
250 NSLOG(netsurf, INFO,
"Unable to open OTAG %s", otagpath);
256 buffer = (UBYTE *)malloc(size);
258 NSLOG(netsurf, INFO,
"Unable to allocate memory");
268 struct TagItem *tag = (
struct TagItem *)
buffer;
269 if((tag->ti_Tag != OT_FileIdent) || (tag->ti_Data != (ULONG)size)) {
270 NSLOG(netsurf, INFO,
"Invalid OTAG file");
277 while((ti = NextTagItem(&tag))) {
278 if(ti->ti_Tag & OT_Indirect) {
279 ti->ti_Data += (ULONG)
buffer;
284 if(ti = FindTagItem(OT_Engine,
buffer)) {
285 NSLOG(netsurf, INFO,
"Using font engine %s", ti->ti_Data);
286 fname =
ASPrintf(
"%s.library", ti->ti_Data);
288 NSLOG(netsurf, INFO,
"Cannot find OT_Engine tag");
294 BulletBase = (
struct BulletBase *)OpenLibrary(fname, 0L);
296 if(BulletBase == NULL) {
297 NSLOG(netsurf, INFO,
"Unable to open font engine %s", fname);
305 gengine = OpenEngine();
308 OT_OTagPath, (ULONG)otagpath,
309 OT_OTagList, (ULONG)
buffer,
313 if(of == NULL)
return NULL;
325 struct BulletBase *BulletBase = of->
BulletBase;
328 CloseLibrary((
struct Library *)BulletBase);
340 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
341 if(fib == NULL)
return 0;
344 size = fib->fib_Size;
346 FreeDosObject(DOS_FIB, fib);
357 DeleteIORequest(obj);
366 struct Node *res = NULL;
368 if ((NULL != list) && (NULL != list->lh_Head->ln_Succ))
377 if (node->ln_Pred->ln_Pred == NULL)
return NULL;
378 return node->ln_Pred;
383 if (node->ln_Succ->ln_Succ == NULL)
return NULL;
384 return node->ln_Succ;
398 while(tag != TAG_DONE) {
399 data = va_arg(ap, ULONG);
400 i += GetAttr(tag, obj, (
void *)data);
401 tag = va_arg(ap, Tag);
411 BOOL changedisabled = FALSE;
416 if ((ti = FindTagItem(GA_Disabled,tags)) && (ti->ti_Data != FALSE)) {
417 changedisabled = TRUE;
418 disabled = g->Flags & GFLG_DISABLED;
421 retval = SetGadgetAttrsA(g,w,r,tags);
422 if (w && (retval || (changedisabled && disabled != (g->Flags & GFLG_DISABLED)))) {
423 RefreshGList(g,w,r,1);
434APTR
NewObject(
struct IClass * classPtr, CONST_STRPTR classID, ULONG tagList, ...)
436 return NewObjectA(classPtr, classID, (
const struct TagItem *) &tagList);
static osspriteop_area * buffer
The buffer characteristics.
static int compar(const void *va, const void *vb)
Quick sort comparison.
Netsurf additional integer type formatting macros.
#define NSLOG(catname, level, logmsg, args...)
int scandir(const char *dir, struct dirent ***namelist, int(*filter)(const struct dirent *), int(*compar)(const struct dirent **, const struct dirent **))
BOOL VSPrintfN(LONG MaxLen, STRPTR Buffer, const STRPTR FormatString, const va_list VarArgs)
BOOL SPrintfN(LONG MaxLen, STRPTR Buffer, const STRPTR FormatString,...)
struct Node * GetPred(struct Node *node)
void FreeSysObject(ULONG type, APTR obj)
void CloseOutlineFont(struct OutlineFont *of, struct List *list)
APTR NewObject(struct IClass *classPtr, CONST_STRPTR classID, ULONG tagList,...)
char * ASPrintf(const char *fmt,...)
int alphasort(const struct dirent **d1, const struct dirent **d2)
struct OutlineFont * OpenOutlineFont(STRPTR fileName, struct List *list, ULONG flags)
int64 GetFileSize(BPTR fh)
long long int strtoll(const char *nptr, char **endptr, int base)
STATIC VOID ASM StuffChar(REG(a3, struct FormatContext *Context), REG(d0, UBYTE Char))
char * strsep(char **s1, const char *s2)
uint32 GetAttrs(Object *obj, Tag tag1,...)
ULONG RefreshSetGadgetAttrsA(struct Gadget *g, struct Window *w, struct Requester *r, struct TagItem *tags)
struct Node * GetHead(struct List *list)
ULONG RefreshSetGadgetAttrs(struct Gadget *g, struct Window *w, struct Requester *r, Tag tag1,...)
struct Node * GetSucc(struct Node *node)
Minimal compatibility header for AmigaOS 3.
struct GlyphEngine * GEngine
struct TagItem * olf_OTagList
struct BulletBase * BulletBase