summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Law <sfllaw@debian.org>2007-01-19 08:50:39 +1100
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2007-01-19 08:50:39 +1100
commit63af35b908b51690a6c12fd42b54cf4ee08c762a (patch)
tree245830a77a1cef79e8c7b7b7cdbe5bfe7a3912e9
parent931b777108526dd0761f948dcd9f1603ac02efc8 (diff)
fontfile: accept empty (but valid) font paths (bug #3091)
If a path has a valid fonts.dir or fonts.alias, but does not contain any fonts (either fonts.dir specifies zero fonts, or fonts could not be loaded), load it as a valid font path anyway.
-rw-r--r--src/fontfile/dirfile.c22
1 files changed, 10 insertions, 12 deletions
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);