I have setup a fontdir with fonts.dir (0 entries) and fonts.alias (>0 entries) xset fp+ fontdir causes an error. adding some entries to fonts.dir does work. Is this intentional behaviour or should the check for an empty fontdir include fonts.alias too?
Created attachment 8439 [details] [review] 3091.patch This patch makes libXfont recognize that a properly formatted fonts.dir file in a directory with no fonts is still acceptable. It also makes libXfont parse fonts.alias, which is the desired behaviour.
Comment on attachment 8439 [details] [review] 3091.patch diff --git a/src/fontfile/dirfile.c b/src/fontfile/dirfile.c index f390391..3159a5e 100644 --- a/src/fontfile/dirfile.c +++ b/src/fontfile/dirfile.c @@ -62,7 +62,7 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) char *ptr; FILE *file; int count, - i, + num_fonts, status; struct stat statb; static char format[24] = ""; @@ -90,8 +90,6 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) strcat(dir_file, FontDirFile); file = fopen(dir_file, "rt"); if (file) { - Bool found_font = FALSE; - #ifndef WIN32 if (fstat (fileno(file), &statb) == -1) #else @@ -101,12 +99,12 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) fclose(file); return BadFontPath; } - count = fscanf(file, "%d\n", &i); + count = fscanf(file, "%d\n", &num_fonts); if ((count == EOF) || (count != 1)) { fclose(file); return BadFontPath; } - dir = FontFileMakeDir(directory, i); + dir = FontFileMakeDir(directory, num_fonts); if (dir == NULL) { fclose(file); return BadFontPath; @@ -128,13 +126,13 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) fclose(file); return BadFontPath; } - if (FontFileAddFontFile (dir, font_name, file_name)) - found_font = TRUE; - } - if (!found_font) { - FontFileFreeDir (dir); - fclose(file); - return BadFontPath; + + /* + * We blindly try to load all the font files specified. + * In theory, we might want to warn that some of the fonts + * couldn't be loaded. + */ + FontFileAddFontFile (dir, font_name, file_name); } fclose(file);
Created attachment 8440 [details] [review] 3091-2.patch This patch just makes libXfont accept any syntactically valid fonts.dir, instead of failing out if it finds no fonts.
patch #2 pushed
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.