Fixup font scanning some more, remove .font suffix

This commit is contained in:
Chris Young 2015-01-30 19:37:38 +00:00
parent 8373fe14cb
commit 7a72ff3161
3 changed files with 12 additions and 9 deletions

View File

@ -82,7 +82,7 @@ struct ami_font_scan_window {
const char *ami_font_scan_lookup(const uint16 *code, lwc_string **glypharray) const char *ami_font_scan_lookup(const uint16 *code, lwc_string **glypharray)
{ {
if(*code >= 0xd800 && *code <= 0xdbff) { 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; 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); gwnode = (struct GlyphWidthEntry *)GetHead((struct List *)widthlist);
do { do {
if(gwnode && (glypharray[gwnode->gwe_Code] == NULL)) { 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; if(lerror != lwc_error_ok) continue;
foundglyphs++; foundglyphs++;
} }
@ -330,6 +330,8 @@ static ULONG ami_font_scan_list(struct MinList *list)
for(int i = 0; i < afh->afh_NumEntries; i++) { for(int i = 0; i < afh->afh_NumEntries; i++) {
if(af[i].af_Attr.ta_Style == FS_NORMAL) { if(af[i].af_Attr.ta_Style == FS_NORMAL) {
if(af[i].af_Attr.ta_Name != NULL) { 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, node = (struct nsObject *)FindIName((struct List *)list,
af[i].af_Attr.ta_Name); af[i].af_Attr.ta_Name);
if(node == NULL) { if(node == NULL) {
@ -484,10 +486,9 @@ void ami_font_scan_init(const char *filename, bool force_scan, bool save,
char *p; char *p;
while((p = strsep(&csv, ","))) { while((p = strsep(&csv, ","))) {
asprintf(&unicode_font, "%s.font", p); if(p != NULL) {
if(unicode_font != NULL) {
node = AddObject(list, AMINS_UNKNOWN); node = AddObject(list, AMINS_UNKNOWN);
if(node) node->dtz_Node.ln_Name = unicode_font; if(node) node->dtz_Node.ln_Name = p;
entries++; entries++;
} }
} }

View File

@ -53,7 +53,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
struct BulletBase *BulletBase; struct BulletBase *BulletBase;
struct OutlineFont *of = NULL; struct OutlineFont *of = NULL;
struct GlyphEngine *gengine; struct GlyphEngine *gengine;
char *p; char *p = 0;
if(p = strrchr(fileName, '.')) if(p = strrchr(fileName, '.'))
*p = '\0'; *p = '\0';
@ -61,6 +61,8 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
otagpath = (STRPTR)ASPrintf("FONTS:%s.otag", fileName); otagpath = (STRPTR)ASPrintf("FONTS:%s.otag", fileName);
fh = Open(otagpath, MODE_OLDFILE); fh = Open(otagpath, MODE_OLDFILE);
if(p) *p = '.';
if(fh == 0) { if(fh == 0) {
/*\todo we should be opening the .font file too and checking /*\todo we should be opening the .font file too and checking
* for the magic bytes to indicate this is an outline font. * for the magic bytes to indicate this is an outline font.

View File

@ -143,8 +143,8 @@
/* Exec */ /* Exec */
#define AllocVecTagList(SZ,TAG) AllocVec(SZ,MEMF_ANY) /* AllocVecTagList with no tags */ #define AllocVecTagList(SZ,TAG) AllocVec(SZ,MEMF_ANY) /* AllocVecTagList with no tags */
#define FindIName FindName #define FindIName FindName
#define GetPred(N) (N)->ln_Pred #define GetPred(N) N ? (N)->ln_Pred : NULL
#define GetSucc(N) (N)->ln_Succ #define GetSucc(N) N ? (N)->ln_Succ : NULL
/* Gfx */ /* Gfx */
#define SetRPAttrs(...) (void)0 /*\todo Probably need to emulate this */ #define SetRPAttrs(...) (void)0 /*\todo Probably need to emulate this */