From 8373fe14cbf21148ccaf1fabe1a43e90a2def566 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Fri, 30 Jan 2015 18:57:04 +0000 Subject: Enable the font scanner for OS3 --- amiga/font_scan.c | 25 +++++++++++++++---------- amiga/os3support.c | 19 ++++++++++++++++++- amiga/os3support.h | 1 + 3 files changed, 34 insertions(+), 11 deletions(-) (limited to 'amiga') diff --git a/amiga/font_scan.c b/amiga/font_scan.c index a698110ef..8c6c19325 100644 --- a/amiga/font_scan.c +++ b/amiga/font_scan.c @@ -26,6 +26,9 @@ #include #include +#ifndef __amigaos4__ +#include +#endif #include #include #include @@ -69,8 +72,6 @@ struct ami_font_scan_window { char *glyphtext; }; -#ifdef __amigaos4__ - /** * Lookup a font that contains a UTF-16 codepoint * @@ -224,13 +225,17 @@ static ULONG ami_font_scan_font(const char *fontname, lwc_string **glypharray) if(!ofont) return 0; - if(ESetInfo(&ofont->olf_EEngine, +#ifndef __amigaos4__ + struct BulletBase *BulletBase = ofont->BulletBase; +#endif + + if(ESetInfo(AMI_OFONT_ENGINE, OT_PointHeight, 10 * (1 << 16), OT_GlyphCode, 0x0000, OT_GlyphCode2, 0xffff, TAG_END) == OTERR_Success) { - if(EObtainInfo(&ofont->olf_EEngine, + if(EObtainInfo(AMI_OFONT_ENGINE, OT_WidthList, &widthlist, TAG_END) == 0) { @@ -242,19 +247,19 @@ static ULONG ami_font_scan_font(const char *fontname, lwc_string **glypharray) foundglyphs++; } } while((gwnode = (struct GlyphWidthEntry *)GetSucc((struct Node *)gwnode))); - EReleaseInfo(&ofont->olf_EEngine, + EReleaseInfo(AMI_OFONT_ENGINE, OT_WidthList, widthlist, TAG_END); } } - - if(EObtainInfo(&ofont->olf_EEngine, OT_UnicodeRanges, &unicoderanges, TAG_END) == 0) { +#ifdef __amigaos4__ + if(EObtainInfo(AMI_OFONT_ENGINE, OT_UnicodeRanges, &unicoderanges, TAG_END) == 0) { if(unicoderanges & UCR_SURROGATES) LOG(("%s supports UTF-16 surrogates", fontname)); - EReleaseInfo(&ofont->olf_EEngine, + EReleaseInfo(AMI_OFONT_ENGINE, OT_UnicodeRanges, unicoderanges, TAG_END); } - +#endif CloseOutlineFont(ofont, NULL); return foundglyphs; @@ -507,7 +512,7 @@ void ami_font_scan_init(const char *filename, bool force_scan, bool save, LOG(("Initialised with %ld glyphs", found)); } -#else +#if 0 #warning FIXME: font_scan.c needs fixing for OS3 void ami_font_scan_init(const char *filename, bool force_scan, bool save, lwc_string **glypharray) diff --git a/amiga/os3support.c b/amiga/os3support.c index b2a7bf887..992fbe007 100644 --- a/amiga/os3support.c +++ b/amiga/os3support.c @@ -53,7 +53,11 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl struct BulletBase *BulletBase; struct OutlineFont *of = NULL; struct GlyphEngine *gengine; - + char *p; + + if(p = strrchr(fileName, '.')) + *p = '\0'; + otagpath = (STRPTR)ASPrintf("FONTS:%s.otag", fileName); fh = Open(otagpath, MODE_OLDFILE); @@ -355,6 +359,19 @@ char *strlwr(char *str) return str; } +char *strsep(char **s1, const char *s2) +{ + char *const p1 = *s1; + + if (p1 != NULL) { + *s1 = strpbrk(p1, s2); + if (*s1 != NULL) { + *(*s1)++ = '\0'; + } + } + return p1; +} + int scandir(const char *dir, struct dirent ***namelist, int (*filter)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)) diff --git a/amiga/os3support.h b/amiga/os3support.h index 9778d991a..f94efc107 100644 --- a/amiga/os3support.h +++ b/amiga/os3support.h @@ -108,6 +108,7 @@ #define DN_FULLPATH 0 #define BGBACKFILL JAM1 #define OFF_OPEN 0 +#define AFF_OTAG 0 /* Renamed structures */ #define AnchorPathOld AnchorPath -- cgit v1.2.3