diff --git a/amiga/font_scan.c b/amiga/font_scan.c index 8c6c19325..393be8517 100644 --- a/amiga/font_scan.c +++ b/amiga/font_scan.c @@ -82,7 +82,7 @@ struct ami_font_scan_window { const char *ami_font_scan_lookup(const uint16 *code, lwc_string **glypharray) { if(*code >= 0xd800 && *code <= 0xdbff) { - /* This is a multi-byte character, we don't support falback for these yet. */ + /* This is a multi-byte character, we don't support fallback for these yet. */ return NULL; } @@ -242,7 +242,7 @@ static ULONG ami_font_scan_font(const char *fontname, lwc_string **glypharray) gwnode = (struct GlyphWidthEntry *)GetHead((struct List *)widthlist); do { if(gwnode && (glypharray[gwnode->gwe_Code] == NULL)) { - lerror = lwc_intern_string(fontname, strlen(fontname) - 5, &glypharray[gwnode->gwe_Code]); + lerror = lwc_intern_string(fontname, strlen(fontname), &glypharray[gwnode->gwe_Code]); if(lerror != lwc_error_ok) continue; foundglyphs++; } @@ -330,6 +330,8 @@ static ULONG ami_font_scan_list(struct MinList *list) for(int i = 0; i < afh->afh_NumEntries; i++) { if(af[i].af_Attr.ta_Style == FS_NORMAL) { if(af[i].af_Attr.ta_Name != NULL) { + char *p = 0; + if(p = strrchr(af[i].af_Attr.ta_Name, '.')) *p = '\0'; node = (struct nsObject *)FindIName((struct List *)list, af[i].af_Attr.ta_Name); if(node == NULL) { @@ -484,10 +486,9 @@ void ami_font_scan_init(const char *filename, bool force_scan, bool save, char *p; while((p = strsep(&csv, ","))) { - asprintf(&unicode_font, "%s.font", p); - if(unicode_font != NULL) { + if(p != NULL) { node = AddObject(list, AMINS_UNKNOWN); - if(node) node->dtz_Node.ln_Name = unicode_font; + if(node) node->dtz_Node.ln_Name = p; entries++; } } diff --git a/amiga/os3support.c b/amiga/os3support.c index 992fbe007..34117937d 100644 --- a/amiga/os3support.c +++ b/amiga/os3support.c @@ -53,14 +53,16 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl struct BulletBase *BulletBase; struct OutlineFont *of = NULL; struct GlyphEngine *gengine; - char *p; + char *p = 0; if(p = strrchr(fileName, '.')) *p = '\0'; otagpath = (STRPTR)ASPrintf("FONTS:%s.otag", fileName); fh = Open(otagpath, MODE_OLDFILE); - + + if(p) *p = '.'; + if(fh == 0) { /*\todo we should be opening the .font file too and checking * for the magic bytes to indicate this is an outline font. diff --git a/amiga/os3support.h b/amiga/os3support.h index f94efc107..319d3b319 100644 --- a/amiga/os3support.h +++ b/amiga/os3support.h @@ -143,8 +143,8 @@ /* Exec */ #define AllocVecTagList(SZ,TAG) AllocVec(SZ,MEMF_ANY) /* AllocVecTagList with no tags */ #define FindIName FindName -#define GetPred(N) (N)->ln_Pred -#define GetSucc(N) (N)->ln_Succ +#define GetPred(N) N ? (N)->ln_Pred : NULL +#define GetSucc(N) N ? (N)->ln_Succ : NULL /* Gfx */ #define SetRPAttrs(...) (void)0 /*\todo Probably need to emulate this */