Enable the font scanner for OS3

This commit is contained in:
Chris Young 2015-01-30 18:57:04 +00:00
parent 2066390555
commit 8373fe14cb
3 changed files with 34 additions and 11 deletions

View File

@ -26,6 +26,9 @@
#include <stdlib.h>
#include <string.h>
#ifndef __amigaos4__
#include <proto/bullet.h>
#endif
#include <proto/diskfont.h>
#include <proto/dos.h>
#include <proto/exec.h>
@ -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)

View File

@ -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 **))

View File

@ -108,6 +108,7 @@
#define DN_FULLPATH 0
#define BGBACKFILL JAM1
#define OFF_OPEN 0
#define AFF_OTAG 0
/* Renamed structures */
#define AnchorPathOld AnchorPath