Index: xc/lib/font/fontfile/dirfile.c =================================================================== RCS file: /cvs/xprint/xprint/src/xprint_main/xc/lib/font/fontfile/dirfile.c,v retrieving revision 1.3 diff -u -r1.3 dirfile.c --- xc/lib/font/fontfile/dirfile.c 16 Feb 2004 12:25:12 -0000 1.3 +++ xc/lib/font/fontfile/dirfile.c 16 Feb 2004 12:44:31 -0000 @@ -25,7 +25,6 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/font/fontfile/dirfile.c,v 3.18 2004/02/11 21:11:18 dawes Exp $ */ /* * Author: Keith Packard, MIT X Consortium @@ -42,23 +41,20 @@ #include #include #include +#ifdef X_NOT_STDC_ENV +extern int errno; +#endif -static Bool AddFileNameAliases ( FontDirectoryPtr dir ); -static int ReadFontAlias ( char *directory, Bool isFile, - FontDirectoryPtr *pdir ); -static int lexAlias ( FILE *file, char **lexToken ); -static int lexc ( FILE *file ); +static int ReadFontAlias(); int -FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) +FontFileReadDirectory (directory, pdir) + char *directory; + FontDirectoryPtr *pdir; { char file_name[MAXFONTFILENAMELEN]; char font_name[MAXFONTNAMELEN]; char dir_file[MAXFONTFILENAMELEN]; -#ifdef FONTDIRATTRIB - char dir_path[MAXFONTFILENAMELEN]; - char *ptr; -#endif FILE *file; int count, i, @@ -68,33 +64,12 @@ FontDirectoryPtr dir = NullFontDirectory; - if (strlen(directory) + 1 + sizeof(FontDirFile) > sizeof(dir_file)) - return BadFontPath; - -#ifdef FONTDIRATTRIB - /* Check for font directory attributes */ -#ifndef __UNIXOS2__ - if ((ptr = strchr(directory, ':'))) { -#else - /* OS/2 path might start with a drive letter, don't clip this */ - if (ptr = strchr(directory+2, ':')) { -#endif - strncpy(dir_path, directory, ptr - directory); - dir_path[ptr - directory] = '\0'; - } else { - strcpy(dir_path, directory); - } - strcpy(dir_file, dir_path); -#else strcpy(dir_file, directory); -#endif - if (dir_file[strlen(dir_file) - 1] != '/') + if (directory[strlen(directory) - 1] != '/') strcat(dir_file, "/"); strcat(dir_file, FontDirFile); file = fopen(dir_file, "r"); if (file) { - Bool found_font = FALSE; - if (fstat (fileno(file), &statb) == -1) return BadFontPath; count = fscanf(file, "%d\n", &i); @@ -110,38 +85,25 @@ dir->dir_mtime = statb.st_mtime; if (format[0] == '\0') sprintf(format, "%%%ds %%%d[^\n]\n", - MAXFONTFILENAMELEN-1, MAXFONTNAMELEN-1); - + MAXFONTFILENAMELEN-1, MAXFONTNAMELEN-1); while ((count = fscanf(file, format, file_name, font_name)) != EOF) { -#ifdef __UNIXOS2__ - /* strip any existing trailing CR */ - for (i=0; idirectory) + sizeof(FontDirFile) > sizeof(dir_file)) - return FALSE; - strcpy (dir_file, dir->directory); strcat (dir_file, FontDirFile); if (stat (dir_file, &statb) == -1) @@ -193,10 +153,11 @@ */ static Bool -AddFileNameAliases(FontDirectoryPtr dir) +AddFileNameAliases(dir) + FontDirectoryPtr dir; { int i; - char copy[MAXFONTFILENAMELEN]; + char copy[MAXFONTNAMELEN]; char *fileName; FontTablePtr table; FontRendererPtr renderer; @@ -213,8 +174,6 @@ continue; len = strlen (fileName) - renderer->fileSuffixLen; - if (len >= sizeof(copy)) - continue; CopyISOLatin1Lowered (copy, fileName, len); copy[len] = '\0'; name.name = copy; @@ -239,24 +198,29 @@ * "font name \"With Double Quotes\" \\ and \\ back-slashes" * works just fine. * - * A line beginning with a ! denotes a newline-terminated comment. + * A line beginning with a # denotes a newline-terminated comment. */ /* * token types */ +static int lexAlias(), lexc(); + #define NAME 0 #define NEWLINE 1 #define DONE 2 #define EALLOC 3 static int -ReadFontAlias(char *directory, Bool isFile, FontDirectoryPtr *pdir) +ReadFontAlias(directory, isFile, pdir) + char *directory; + Bool isFile; + FontDirectoryPtr *pdir; { char alias[MAXFONTNAMELEN]; char font_name[MAXFONTNAMELEN]; - char alias_file[MAXFONTFILENAMELEN]; + char alias_file[MAXFONTNAMELEN]; FILE *file; FontDirectoryPtr dir; int token; @@ -264,13 +228,9 @@ int status = Successful; struct stat statb; - if (strlen(directory) >= sizeof(alias_file)) - return BadFontPath; dir = *pdir; strcpy(alias_file, directory); if (!isFile) { - if (strlen(directory) + 1 + sizeof(FontAliasFile) > sizeof(alias_file)) - return BadFontPath; if (directory[strlen(directory) - 1] != '/') strcat(alias_file, "/"); strcat(alias_file, FontAliasFile); @@ -303,10 +263,10 @@ status = AllocError; break; case NAME: - if (strlen(lexToken) >= sizeof(alias)) { - status = BadFontPath; - break; - } + if (strlen(lexToken) >= sizeof alias) { + status = BadFontPath; + break; + } strcpy(alias, lexToken); token = lexAlias(file, &lexToken); switch (token) { @@ -323,12 +283,12 @@ status = AllocError; break; case NAME: - if (strlen(lexToken) >= sizeof(font_name)) { - status = BadFontPath; - break; - } - CopyISOLatin1Lowered(alias, alias, strlen(alias)); - CopyISOLatin1Lowered(font_name, lexToken, strlen(lexToken)); + CopyISOLatin1Lowered((unsigned char *) alias, + (unsigned char *) alias, + strlen(alias)); + CopyISOLatin1Lowered((unsigned char *) font_name, + (unsigned char *) lexToken, + strlen(lexToken)); if (!FontFileAddFontAlias (dir, alias, font_name)) status = AllocError; break; @@ -349,7 +309,9 @@ static int charClass; static int -lexAlias(FILE *file, char **lexToken) +lexAlias(file, lexToken) + FILE *file; + char **lexToken; { int c; char *t; @@ -412,8 +374,6 @@ break; case Comment: continue; - default: - break; } *t++ = c; ++count; @@ -449,7 +409,8 @@ } static int -lexc(FILE *file) +lexc(file) + FILE *file; { int c; @@ -472,7 +433,6 @@ case '\t': charClass = WHITE; break; - case '\r': case '\n': charClass = NL; break; Index: xc/lib/font/fontfile/encparse.c =================================================================== RCS file: /cvs/xprint/xprint/src/xprint_main/xc/lib/font/fontfile/encparse.c,v retrieving revision 1.2 diff -u -r1.2 encparse.c --- xc/lib/font/fontfile/encparse.c 16 Feb 2004 12:25:12 -0000 1.2 +++ xc/lib/font/fontfile/encparse.c 16 Feb 2004 12:44:31 -0000 @@ -20,7 +20,7 @@ THE SOFTWARE. */ -/* $XFree86: xc/lib/font/fontfile/encparse.c,v 1.20 2004/02/11 21:11:19 dawes Exp $ */ +/* $XFree86: xc/lib/font/fontfile/encparse.c,v 1.18 2001/11/02 03:06:40 dawes Exp $ */ /* Parser for encoding files */ @@ -32,10 +32,6 @@ #include #include -#ifdef SCO325 -#include -#endif - #ifndef FONTENC_NO_LIBFONT #include "fntfilio.h" @@ -837,7 +833,6 @@ char file_name[MAXFONTFILENAMELEN], encoding_name[MAXFONTNAMELEN], buf[MAXFONTFILENAMELEN]; int count, n; - static char format[24] = ""; /* As we don't really expect to open encodings that often, we don't take the trouble of caching encodings directories. */ @@ -853,12 +848,8 @@ } encoding = NULL; - if (!format[0]) { - sprintf(format, "%%%ds %%%d[^\n]\n", sizeof(encoding_name) - 1, - sizeof(file_name) - 1); - } for(;;) { - count = fscanf(file, format, encoding_name, file_name); + count = fscanf(file, "%s %[^\n]\n", encoding_name, file_name); if(count == EOF) break; if(count != 2) Index: xc/lib/font/fontfile/fontfile.c =================================================================== RCS file: /cvs/xprint/xprint/src/xprint_main/xc/lib/font/fontfile/fontfile.c,v retrieving revision 1.3 diff -u -r1.3 fontfile.c --- xc/lib/font/fontfile/fontfile.c 16 Feb 2004 12:25:12 -0000 1.3 +++ xc/lib/font/fontfile/fontfile.c 16 Feb 2004 12:44:32 -0000 @@ -25,12 +25,11 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/font/fontfile/fontfile.c,v 3.22 2004/02/11 21:11:20 dawes Exp $ */ /* * Author: Keith Packard, MIT X Consortium */ -/* $NCDXorg: @(#)fontfile.c,v 1.6 1991/07/02 17:00:46 lemke Exp $ */ +/* $NCDId: @(#)fontfile.c,v 1.6 1991/07/02 17:00:46 lemke Exp $ */ #include "fntfilst.h" @@ -38,23 +37,11 @@ * Map FPE functions to renderer functions */ -static int FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont, - int flags, FontEntryPtr entry, - fsBitmapFormat format, - fsBitmapFormatMask fmask, - FontPtr non_cachable_font); - int -FontFileNameCheck (char *name) +FontFileNameCheck (name) + char *name; { #ifndef NCD -#ifdef __UNIXOS2__ - /* OS/2 uses D:/... as a path name for fonts, so accept this as a valid - * path if it starts with a letter and a colon - */ - if (isalpha(*name) && name[1]==':') - return TRUE; -#endif return *name == '/'; #else return ((strcmp(name, "built-ins") == 0) || (*name == '/')); @@ -62,7 +49,8 @@ } int -FontFileInitFPE (FontPathElementPtr fpe) +FontFileInitFPE (fpe) + FontPathElementPtr fpe; { int status; FontDirectoryPtr dir; @@ -83,15 +71,12 @@ /* ARGSUSED */ int -FontFileResetFPE (FontPathElementPtr fpe) +FontFileResetFPE (fpe) + FontPathElementPtr fpe; { FontDirectoryPtr dir; dir = (FontDirectoryPtr) fpe->private; - /* - * The reset must fail for bitmap fonts because they get cleared when - * the path is set. - */ if (FontFileDirectoryChanged (dir)) { /* can't do it, so tell the caller to close and re-open */ @@ -109,7 +94,8 @@ } int -FontFileFreeFPE (FontPathElementPtr fpe) +FontFileFreeFPE (fpe) + FontPathElementPtr fpe; { FontFileUnregisterBitmapSource (fpe); FontFileFreeDir ((FontDirectoryPtr) fpe->private); @@ -117,9 +103,13 @@ } static int -transfer_values_to_alias(char *entryname, int entrynamelength, - char *resolvedname, - char **aliasName, FontScalablePtr vals) +transfer_values_to_alias(entryname, entrynamelength, resolvedname, + aliasName, vals) + char *entryname; + int entrynamelength; + char *resolvedname; + char **aliasName; + FontScalablePtr vals; { static char aliasname[MAXFONTNAMELEN]; int nameok = 1, len; @@ -127,7 +117,6 @@ *aliasName = resolvedname; if ((len = strlen(*aliasName)) <= MAXFONTNAMELEN && - (entrynamelength < MAXFONTNAMELEN) && FontFileCountDashes (*aliasName, len) == 14) { FontScalableRec tmpVals; @@ -169,6 +158,7 @@ gotchas */ if (FontFileCompleteXLFD(&tmpVals2, &tmpVals2)) { + double hypot(); tempmatrix[0] = matrix[0] * tmpVals2.point_matrix[0] + matrix[1] * tmpVals2.point_matrix[2]; @@ -229,11 +219,19 @@ /* ARGSUSED */ int -FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, - char *name, int namelen, - fsBitmapFormat format, fsBitmapFormatMask fmask, - XID id, FontPtr *pFont, char **aliasName, - FontPtr non_cachable_font) +FontFileOpenFont (client, fpe, flags, name, namelen, format, fmask, + id, pFont, aliasName, non_cachable_font) + pointer client; + FontPathElementPtr fpe; + Mask flags; + char *name; + int namelen; + fsBitmapFormat format; + fsBitmapFormatMask fmask; + XID id; + FontPtr *pFont; + char **aliasName; + FontPtr non_cachable_font; { FontDirectoryPtr dir; char lowerName[MAXFONTNAMELEN]; @@ -331,7 +329,8 @@ if (!FontParseXLFDName (lowerName, &vals, FONT_XLFD_REPLACE_ZERO) || !(tmpName.length = strlen (lowerName), entry = FontFileFindNameInScalableDir (&dir->scalable, &tmpName, - &vals))) { + &vals))) + { CopyISOLatin1Lowered (lowerName, name, namelen); lowerName[namelen] = '\0'; tmpName.name = lowerName; @@ -423,16 +422,11 @@ vals.ranges = ranges; vals.nranges = nranges; - if (strlen(dir->directory) + strlen(scalable->fileName) >= - sizeof(fileName)) { - ret = BadFontName; - } else { - strcpy (fileName, dir->directory); - strcat (fileName, scalable->fileName); - ret = (*scalable->renderer->OpenScalable) (fpe, pFont, + strcpy (fileName, dir->directory); + strcat (fileName, scalable->fileName); + ret = (*scalable->renderer->OpenScalable) (fpe, pFont, flags, entry, fileName, &vals, format, fmask, non_cachable_font); - } /* In case rasterizer does something bad because of charset subsetting... */ @@ -467,7 +461,9 @@ /* ARGSUSED */ void -FontFileCloseFont (FontPathElementPtr fpe, FontPtr pFont) +FontFileCloseFont (fpe, pFont) + FontPathElementPtr fpe; + FontPtr pFont; { FontEntryPtr entry; @@ -488,11 +484,14 @@ (*pFont->unload_font) (pFont); } -static int -FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont, - int flags, FontEntryPtr entry, - fsBitmapFormat format, fsBitmapFormatMask fmask, - FontPtr non_cachable_font) +int +FontFileOpenBitmapNCF (fpe, pFont, flags, entry, format, fmask, + non_cachable_font) + FontPathElementPtr fpe; + int flags; + FontEntryPtr entry; + FontPtr *pFont; + FontPtr non_cachable_font; { FontBitmapEntryPtr bitmap; char fileName[MAXFONTFILENAMELEN*2+1]; @@ -501,10 +500,6 @@ dir = (FontDirectoryPtr) fpe->private; bitmap = &entry->u.bitmap; - if(!bitmap || !bitmap->renderer->OpenBitmap) - return BadFontName; - if (strlen(dir->directory) + strlen(bitmap->fileName) >= sizeof(fileName)) - return BadFontName; strcpy (fileName, dir->directory); strcat (fileName, bitmap->fileName); ret = (*bitmap->renderer->OpenBitmap) @@ -519,17 +514,23 @@ } int -FontFileOpenBitmap (FontPathElementPtr fpe, FontPtr *pFont, - int flags, FontEntryPtr entry, - fsBitmapFormat format, fsBitmapFormatMask fmask) +FontFileOpenBitmap (fpe, pFont, flags, entry, format, fmask) + FontPathElementPtr fpe; + FontPtr *pFont; + int flags; + FontEntryPtr entry; + fsBitmapFormat format; + fsBitmapFormatMask fmask; { return FontFileOpenBitmapNCF (fpe, pFont, flags, entry, format, fmask, (FontPtr)0); } -static int -FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo, - FontEntryPtr entry) +int +FontFileGetInfoBitmap (fpe, pFontInfo, entry) + FontPathElementPtr fpe; + FontInfoPtr pFontInfo; + FontEntryPtr entry; { FontBitmapEntryPtr bitmap; char fileName[MAXFONTFILENAMELEN*2+1]; @@ -538,10 +539,6 @@ dir = (FontDirectoryPtr) fpe->private; bitmap = &entry->u.bitmap; - if (!bitmap || !bitmap->renderer->GetInfoBitmap) - return BadFontName; - if (strlen(dir->directory) + strlen(bitmap->fileName) >= sizeof(fileName)) - return BadFontName; strcpy (fileName, dir->directory); strcat (fileName, bitmap->fileName); ret = (*bitmap->renderer->GetInfoBitmap) (fpe, pFontInfo, entry, fileName); @@ -549,10 +546,16 @@ } static void -_FontFileAddScalableNames(FontNamesPtr names, FontNamesPtr scaleNames, - FontNamePtr nameptr, char *zeroChars, - FontScalablePtr vals, fsRange *ranges, - int nranges, int *max) +_FontFileAddScalableNames(names, scaleNames, nameptr, zeroChars, vals, ranges, + nranges, max) + FontNamesPtr names; + FontNamesPtr scaleNames; + FontNamePtr nameptr; + char *zeroChars; + FontScalablePtr vals; + fsRange *ranges; + int nranges; + int *max; { int i; FontScalableRec zeroVals, tmpVals; @@ -666,9 +669,14 @@ /* ARGSUSED */ static int -_FontFileListFonts (pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, FontNamesPtr names, - int mark_aliases) +_FontFileListFonts (client, fpe, pat, len, max, names, mark_aliases) + pointer client; + FontPathElementPtr fpe; + char *pat; + int len; + int max; + FontNamesPtr names; + int mark_aliases; { FontDirectoryPtr dir; char lowerChars[MAXFONTNAMELEN], zeroChars[MAXFONTNAMELEN]; @@ -773,16 +781,25 @@ } LFWIDataRec, *LFWIDataPtr; int -FontFileListFonts (pointer client, FontPathElementPtr fpe, char *pat, - int len, int max, FontNamesPtr names) +FontFileListFonts (client, fpe, pat, len, max, names) + pointer client; + FontPathElementPtr fpe; + char *pat; + int len; + int max; + FontNamesPtr names; { return _FontFileListFonts (client, fpe, pat, len, max, names, 0); } int -FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, - pointer *privatep) +FontFileStartListFontsWithInfo(client, fpe, pat, len, max, privatep) + pointer client; + FontPathElementPtr fpe; + char *pat; + int len; + int max; + pointer *privatep; { LFWIDataPtr data; int ret; @@ -810,9 +827,12 @@ /* ARGSUSED */ static int -FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, - char **namep, int *namelenp, - FontInfoPtr *pFontInfo) +FontFileListOneFontWithInfo (client, fpe, namep, namelenp, pFontInfo) + pointer client; + FontPathElementPtr fpe; + char **namep; + int *namelenp; + FontInfoPtr *pFontInfo; { FontDirectoryPtr dir; char lowerName[MAXFONTNAMELEN]; @@ -823,117 +843,26 @@ FontScalableEntryPtr scalable; FontScaledPtr scaled; FontBitmapEntryPtr bitmap; + FontAliasEntryPtr alias; int ret; - Bool noSpecificSize; - int nranges; - fsRange *ranges; - char *name = *namep; int namelen = *namelenp; + Bool noSpecificSize; if (namelen >= MAXFONTNAMELEN) return AllocError; dir = (FontDirectoryPtr) fpe->private; - - /* Match non-scalable pattern */ CopyISOLatin1Lowered (lowerName, name, namelen); lowerName[namelen] = '\0'; - ranges = FontParseRanges(lowerName, &nranges); tmpName.name = lowerName; tmpName.length = namelen; tmpName.ndashes = FontFileCountDashes (lowerName, namelen); - if (!FontParseXLFDName(lowerName, &vals, FONT_XLFD_REPLACE_NONE)) - bzero(&vals, sizeof(vals)); - if (!(entry = FontFileFindNameInDir (&dir->nonScalable, &tmpName)) && - tmpName.ndashes == 14 && + /* Match XLFD patterns */ + if (tmpName.ndashes == 14 && FontParseXLFDName (lowerName, &vals, FONT_XLFD_REPLACE_ZERO)) { - tmpName.length = strlen(lowerName); - entry = FontFileFindNameInDir (&dir->nonScalable, &tmpName); - } - - if (entry) - { - switch (entry->type) { - case FONT_ENTRY_BITMAP: - bitmap = &entry->u.bitmap; - if (bitmap->pFont) - { - *pFontInfo = &bitmap->pFont->info; - ret = Successful; - } - else - { - ret = FontFileGetInfoBitmap (fpe, *pFontInfo, entry); - } - break; - case FONT_ENTRY_ALIAS: - vals.nranges = nranges; - vals.ranges = ranges; - transfer_values_to_alias(entry->name.name, entry->name.length, - entry->u.alias.resolved, namep, &vals); - *namelenp = strlen (*namep); - ret = FontNameAlias; - break; -#ifdef NOTYET - case FONT_ENTRY_BC: - /* no LFWI for this yet */ - bc = &entry->u.bc; - entry = bc->entry; - /* Make a new scaled instance */ - if (strlen(dir->directory) + strlen(scalable->fileName) >= - sizeof(fileName)) { - ret = BadFontName; - } else { - strcpy (fileName, dir->directory); - strcat (fileName, scalable->fileName); - ret = (*scalable->renderer->GetInfoScalable) - (fpe, *pFontInfo, entry, tmpName, fileName, &bc->vals); - } - break; -#endif - default: - ret = BadFontName; - } - } - else - { - ret = BadFontName; - } - - if (ret != BadFontName) - { - if (ranges) xfree(ranges); - return ret; - } - - /* Match XLFD patterns */ - CopyISOLatin1Lowered (lowerName, name, namelen); - lowerName[namelen] = '\0'; - tmpName.name = lowerName; - tmpName.length = namelen; - tmpName.ndashes = FontFileCountDashes (lowerName, namelen); - if (!FontParseXLFDName (lowerName, &vals, FONT_XLFD_REPLACE_ZERO) || - !(tmpName.length = strlen (lowerName), - entry = FontFileFindNameInScalableDir (&dir->scalable, &tmpName, - &vals))) { - CopyISOLatin1Lowered (lowerName, name, namelen); - lowerName[namelen] = '\0'; - tmpName.name = lowerName; - tmpName.length = namelen; - tmpName.ndashes = FontFileCountDashes (lowerName, namelen); + tmpName.length = strlen (lowerName); entry = FontFileFindNameInScalableDir (&dir->scalable, &tmpName, &vals); - if (entry) - { - strcpy(lowerName, entry->name.name); - tmpName.name = lowerName; - tmpName.length = entry->name.length; - tmpName.ndashes = entry->name.ndashes; - } - } - - if (entry) - { noSpecificSize = FALSE; /* TRUE breaks XLFD enhancements */ if (entry && entry->type == FONT_ENTRY_SCALABLE && FontFileCompleteXLFD (&vals, &entry->u.scalable.extra->defaults)) @@ -986,23 +915,18 @@ #endif { char origName[MAXFONTNAMELEN]; + fsRange *ranges; CopyISOLatin1Lowered (origName, name, namelen); origName[namelen] = '\0'; vals.xlfdName = origName; - vals.ranges = ranges; - vals.nranges = nranges; - + vals.ranges = FontParseRanges(origName, &vals.nranges); + ranges = vals.ranges; /* Make a new scaled instance */ - if (strlen(dir->directory) + strlen(scalable->fileName) >= - sizeof(fileName)) { - ret = BadFontName; - } else { - strcpy (fileName, dir->directory); - strcat (fileName, scalable->fileName); - ret = (*scalable->renderer->GetInfoScalable) - (fpe, *pFontInfo, entry, &tmpName, fileName, &vals); - } + strcpy (fileName, dir->directory); + strcat (fileName, scalable->fileName); + ret = (*scalable->renderer->GetInfoScalable) + (fpe, *pFontInfo, entry, &tmpName, fileName, &vals); if (ranges) xfree(ranges); } } @@ -1011,19 +935,61 @@ CopyISOLatin1Lowered (lowerName, name, namelen); tmpName.length = namelen; } + /* Match non XLFD pattern */ + if ((entry = FontFileFindNameInDir (&dir->nonScalable, &tmpName))) + { + switch (entry->type) { + case FONT_ENTRY_BITMAP: + bitmap = &entry->u.bitmap; + if (bitmap->pFont) + { + *pFontInfo = &bitmap->pFont->info; + ret = Successful; + } + else + { + ret = FontFileGetInfoBitmap (fpe, *pFontInfo, entry); + } + break; + case FONT_ENTRY_ALIAS: + alias = &entry->u.alias; + *(char **)pFontInfo = name; + *namelenp = strlen (*namep = alias->resolved); + ret = FontNameAlias; + break; +#ifdef NOTYET + case FONT_ENTRY_BC: + /* no LFWI for this yet */ + bc = &entry->u.bc; + entry = bc->entry; + /* Make a new scaled instance */ + strcpy (fileName, dir->directory); + strcat (fileName, scalable->fileName); + ret = (*scalable->renderer->GetInfoScalable) + (fpe, *pFontInfo, entry, tmpName, fileName, &bc->vals); + break; +#endif + default: + ret = BadFontName; + } + } else + { ret = BadFontName; - - if (ranges) - xfree(ranges); + } return ret; } int -FontFileListNextFontWithInfo(pointer client, FontPathElementPtr fpe, - char **namep, int *namelenp, - FontInfoPtr *pFontInfo, - int *numFonts, pointer private) +FontFileListNextFontWithInfo(client, fpe, namep, namelenp, pFontInfo, + numFonts, private) + pointer client; + FontPathElementPtr fpe; + char **namep; + int *namelenp; + FontInfoPtr *pFontInfo; + int *numFonts; + pointer private; { LFWIDataPtr data = (LFWIDataPtr) private; int ret; @@ -1049,9 +1015,13 @@ } int -FontFileStartListFontsAndAliases(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, - pointer *privatep) +FontFileStartListFontsAndAliases(client, fpe, pat, len, max, privatep) + pointer client; + FontPathElementPtr fpe; + char *pat; + int len; + int max; + pointer *privatep; { LFWIDataPtr data; int ret; @@ -1078,9 +1048,15 @@ } int -FontFileListNextFontOrAlias(pointer client, FontPathElementPtr fpe, - char **namep, int *namelenp, char **resolvedp, - int *resolvedlenp, pointer private) +FontFileListNextFontOrAlias(client, fpe, namep, namelenp, resolvedp, + resolvedlenp, private) + pointer client; + FontPathElementPtr fpe; + char **namep; + int *namelenp; + char **resolvedp; + int *resolvedlenp; + pointer private; { LFWIDataPtr data = (LFWIDataPtr) private; int ret; @@ -1119,22 +1095,27 @@ return ret; } + +extern void FontFileEmptyBitmapSource(); +typedef int (*IntFunc) (); +static int font_file_type; + void -FontFileRegisterLocalFpeFunctions (void) +FontFileRegisterLocalFpeFunctions () { - RegisterFPEFunctions(FontFileNameCheck, - FontFileInitFPE, - FontFileFreeFPE, - FontFileResetFPE, - FontFileOpenFont, - FontFileCloseFont, - FontFileListFonts, - FontFileStartListFontsWithInfo, - FontFileListNextFontWithInfo, - NULL, - NULL, - NULL, - FontFileStartListFontsAndAliases, - FontFileListNextFontOrAlias, - FontFileEmptyBitmapSource); + font_file_type = RegisterFPEFunctions(FontFileNameCheck, + FontFileInitFPE, + FontFileFreeFPE, + FontFileResetFPE, + FontFileOpenFont, + FontFileCloseFont, + FontFileListFonts, + FontFileStartListFontsWithInfo, + FontFileListNextFontWithInfo, + (IntFunc) 0, + (IntFunc) 0, + (IntFunc) 0, + FontFileStartListFontsAndAliases, + FontFileListNextFontOrAlias, + FontFileEmptyBitmapSource); }