summaryrefslogtreecommitdiff
path: root/app/mkfontscale/mkfontscale.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2011-08-28 10:19:32 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2011-08-28 10:19:32 +0000
commitc0a862eba7db1eab5fe7f2c1c85c93d06c6cd99d (patch)
treea610f80b245e87c8e1154c261d64cb4342af5179 /app/mkfontscale/mkfontscale.c
parent2bac4d23b683a1a41618861374616f39a5103d33 (diff)
Update to mkfontscale 1.0.9
Diffstat (limited to 'app/mkfontscale/mkfontscale.c')
-rw-r--r--app/mkfontscale/mkfontscale.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/app/mkfontscale/mkfontscale.c b/app/mkfontscale/mkfontscale.c
index 8134db84e..31553cb5d 100644
--- a/app/mkfontscale/mkfontscale.c
+++ b/app/mkfontscale/mkfontscale.c
@@ -46,12 +46,6 @@
#include "data.h"
#include "ident.h"
-#ifdef NEED_SNPRINTF
-#undef SCOPE
-#define SCOPE static
-#include "snprintf.c"
-#endif
-
#define NPREFIX 1024
#ifndef MAXFONTFILENAMELEN
@@ -61,6 +55,11 @@
#define MAXFONTNAMELEN 1024
#endif
+/* Two levels of macro calls are needed so that we stringify the value
+ of MAXFONT... and not the string "MAXFONT..." */
+#define QUOTE(x) #x
+#define STRINGIFY(x) QUOTE(x)
+
static char *encodings_array[] =
{ "ascii-0",
"iso8859-1", "iso8859-2", "iso8859-3", "iso8859-4", "iso8859-5",
@@ -680,11 +679,7 @@ readFontScale(HashTablePtr entries, char *dirname)
char *filename;
FILE *in;
int rc, count, i;
- char file[MAXFONTFILENAMELEN], font[MAXFONTNAMELEN];
- char format[100];
-
- snprintf(format, 100, "%%%ds %%%d[^\n]\n",
- MAXFONTFILENAMELEN, MAXFONTNAMELEN);
+ char file[MAXFONTFILENAMELEN+1], font[MAXFONTNAMELEN+1];
if(dirname[n - 1] == '/')
filename = dsprintf("%sfonts.scale", dirname);
@@ -709,7 +704,10 @@ readFontScale(HashTablePtr entries, char *dirname)
}
for(i = 0; i < count; i++) {
- rc = fscanf(in, format, file, font);
+ rc = fscanf(in,
+ "%" STRINGIFY(MAXFONTFILENAMELEN) "s "
+ "%" STRINGIFY(MAXFONTNAMELEN) "[^\n]\n",
+ file, font);
if(rc != 2)
break;
putHash(entries, font, file, 100);
@@ -942,10 +940,8 @@ doDirectory(char *dirname_given, int numEncodings, ListPtr encodingsToDo)
}
}
done:
- if(have_face) {
+ if(have_face)
FT_Done_Face(face);
- have_face = 0;
- }
deepDestroyList(xlfd);
xlfd = NULL;
free(filename);
@@ -980,6 +976,7 @@ doDirectory(char *dirname_given, int numEncodings, ListPtr encodingsToDo)
exit(1);
}
fprintf(encfile, "%d\n", numEncodings);
+ encodingsToDo = sortList(encodingsToDo);
for(lp = encodingsToDo; lp; lp = lp->next) {
fprintf(encfile, "%s\n", lp->value);
}