Kean Johnston writes:
> > Yes, if we don't have an improved version by the end of the week
> > I will revert this.
> I didnt see any comment on my message ... did you see my patch from
> yesterday that implements the -r and -n options?
>
I'm sorry I have overlooked your posting.
I've combined Juliusz's and your patch.
Juliusz, Kean, please check below and tell me if it does what you expect.
Egbert.
Index: config/cf/X11.tmpl
===================================================================
RCS file: /home/x-cvs/xc/config/cf/X11.tmpl,v
retrieving revision 1.208
diff -u -r1.208 X11.tmpl
--- config/cf/X11.tmpl 27 Jun 2003 14:53:08 -0000 1.208
+++ config/cf/X11.tmpl 2 Jul 2003 19:16:40 -0000
@@ -3823,7 +3823,7 @@
#endif
#endif
-#ifndef MakeTblHtmlDoc(file,srcs)
+#ifndef MakeTblHtmlDoc
#ifdef HTMLroffCmd
#define MakeTblHtmlDoc(file,srcs) @@\
file.html: srcs @@\
@@ -3835,7 +3835,7 @@
#endif
#endif
-#ifndef MakeEqnHtmlDoc(file,srcs)
+#ifndef MakeEqnHtmlDoc
#ifdef HTMLroffCmd
#define MakeEqnHtmlDoc(file,srcs) @@\
file.html: srcs @@\
Index: programs/mkfontscale/mkfontscale.c
===================================================================
RCS file: /home/x-cvs/xc/programs/mkfontscale/mkfontscale.c,v
retrieving revision 1.9
diff -u -r1.9 mkfontscale.c
--- programs/mkfontscale/mkfontscale.c 1 Jul 2003 13:05:34 -0000 1.9
+++ programs/mkfontscale/mkfontscale.c 2 Jul 2003 19:16:52 -0000
@@ -74,21 +74,24 @@
#define countof(_a) (sizeof(_a)/sizeof((_a)[0]))
-int doDirectory(char*, int, ListPtr);
+static int doDirectory(char*, int, ListPtr);
static int checkEncoding(FT_Face face, char *encoding_name);
static int checkExtraEncoding(FT_Face face, char *encoding_name, int found);
static int find_cmap(int type, int pid, int eid, FT_Face face);
static char* notice_foundry(char *notice);
static char* vendor_foundry(signed char *vendor);
-int readFontScale(HashTablePtr entries, char *dirname);
+static int readFontScale(HashTablePtr entries, char *dirname);
ListPtr makeXLFD(char *filename, FT_Face face, int);
+static int readEncodings(ListPtr encodings, char *dirname);
static FT_Library ft_library;
static float bigEncodingFuzz = 0.02;
+static int relative;
static int doScalable;
static int doBitmaps;
-static int doEncodings;
+static int onlyEncodings;
+static int onlyEncodings;
static ListPtr encodingsToDo;
static int reencodeLegacy;
char *encodingPrefix = NULL;
@@ -99,7 +102,7 @@
fprintf(stderr,
"mkfontscale [ -b ] [ -s ] [ -o filename ] \n"
" [ -x encoding ] [ -f fuzz ] [ -l ] "
- "[ -e directory ] [ -p prefix ]\n"
+ "[ -e directory ] [ -p prefix ] [ -n ] [ -r ] \n"
" [ directory ]...\n");
}
@@ -108,7 +111,7 @@
{
int argn;
FT_Error ftrc;
- int rc;
+ int rc, ll = 0;
char prefix[NPREFIX];
if(getcwd(prefix, NPREFIX - 1) == NULL) {
@@ -117,6 +120,7 @@
}
if(prefix[strlen(prefix) - 1] != '/')
strcat(prefix, "/");
+ encodingPrefix = dsprintf("%s", prefix);
outfilename = NULL;
@@ -127,8 +131,9 @@
NULL, 0);
doBitmaps = 0;
doScalable = 1;
+ onlyEncodings = 0;
+ relative = 0;
reencodeLegacy = 1;
- doEncodings = 0;
encodingsToDo = NULL;
argn = 1;
@@ -154,14 +159,14 @@
usage();
exit(1);
}
- strcpy(prefix, argv[argn + 1]);
+ free(encodingPrefix);
+ encodingPrefix = dsprintf("%s", argv[argn + 1]);
argn += 2;
} else if(strcmp(argv[argn], "-e") == 0) {
if(argn >= argc - 1) {
usage();
exit(1);
}
- doEncodings = 1;
rc = readEncodings(encodingsToDo, argv[argn + 1]);
if(rc < 0)
exit(1);
@@ -172,6 +177,12 @@
} else if(strcmp(argv[argn], "-s") == 0) {
doScalable = 0;
argn++;
+ } else if(strcmp(argv[argn], "-n") == 0) {
+ onlyEncodings = 1;
+ argn++;
+ } else if(strcmp(argv[argn], "-r") == 0) {
+ relative = 1;
+ argn++;
} else if(strcmp(argv[argn], "-l") == 0) {
reencodeLegacy = !reencodeLegacy;
argn++;
@@ -199,8 +210,6 @@
}
}
- encodingPrefix = dsprintf("%s", prefix);
-
if(outfilename == NULL) {
if(doBitmaps)
outfilename = "fonts.dir";
@@ -213,13 +222,14 @@
fprintf(stderr, "Could not initialise FreeType library: %d\n", ftrc);
exit(1);
}
-
+
+ ll = listLength(encodingsToDo);
if (argn == argc)
- doDirectory(".", doEncodings, encodingsToDo);
+ doDirectory(".", ll, encodingsToDo);
else
while(argn < argc) {
- doDirectory(argv[argn], doEncodings, encodingsToDo);
+ doDirectory(argv[argn], ll, encodingsToDo);
argn++;
}
return 0;
@@ -629,7 +639,7 @@
return xlfd;
}
-int
+static int
readFontScale(HashTablePtr entries, char *dirname)
{
int n = strlen(dirname);
@@ -695,11 +705,11 @@
return 0;
}
-int
-doDirectory(char *dirname_given, int doEncodings, ListPtr encodingsToDo)
+static int
+doDirectory(char *dirname_given, int numEncodings, ListPtr encodingsToDo)
{
- char *dirname, *fontscale_name, *filename;
- FILE *fontscale;
+ char *dirname, *fontscale_name, *filename, *encdir;
+ FILE *fontscale, *encfile;
DIR *dirp;
struct dirent *entry;
FT_Error ftrc;
@@ -708,7 +718,7 @@
HashTablePtr entries;
HashBucketPtr *array;
int i, n, found, rc;
- int isBitmap;
+ int isBitmap=0;
i = strlen(dirname_given);
if(i == 0)
@@ -723,27 +733,9 @@
exit(1);
}
- if(doEncodings) {
- char *e = dsprintf("%s%s", dirname, "encodings.dir");
- FILE *out;
- ListPtr l;
-
- if(e == NULL) {
- perror("encodings");
- exit(1);
- }
- unlink(e);
- out = fopen(e, "w");
- if(out == NULL) {
- perror("open(encodings.dir)");
- exit(1);
- }
- fprintf(out, "%d\n", listLength(encodingsToDo));
- for(l = encodingsToDo; l; l = l->next) {
- fprintf(out, "%s\n", l->value);
- }
- }
-
+ if (onlyEncodings)
+ goto encodings;
+
entries = makeHashTable();
if(doBitmaps && !doScalable) {
readFontScale(entries, dirname);
@@ -915,6 +907,29 @@
fclose(fontscale);
free(fontscale_name);
}
+
+ encodings:
+ encdir = dsprintf("%s%s", dirname, "encodings.dir");
+
+ if(encdir == NULL) {
+ perror("encodings");
+ exit(1);
+ }
+ unlink(encdir);
+
+ if (numEncodings) {
+ encfile = fopen(encdir, "w");
+ if(encfile == NULL) {
+ perror("open(encodings.dir)");
+ exit(1);
+ }
+ fprintf(encfile, "%d\n", numEncodings);
+ for(lp = encodingsToDo; lp; lp = lp->next) {
+ fprintf(encfile, "%s\n", lp->value);
+ }
+ fclose (encfile);
+ }
+
free(dirname);
return 1;
}
@@ -1172,11 +1187,10 @@
return NULL;
}
-int
+static int
readEncodings(ListPtr encodings, char *dirname)
{
char *fullname;
- int slash;
DIR *dirp;
struct dirent *file;
char **names, **name;
@@ -1203,7 +1217,7 @@
continue;
for(name = names; *name; name++) {
- if(fullname[0] != '/') {
+ if(fullname[0] != '/' && !relative) {
char *n;
n = dsprintf("%s%s", encodingPrefix, fullname);
if(n == NULL) {
@@ -1211,10 +1225,12 @@
closedir(dirp);
return -1;
}
- free(fullname);
- fullname = n;
+ encodingsToDo = listConsF(encodingsToDo, "%s %s", *name, n);
+ free(n);
+ } else {
+ encodingsToDo =
+ listConsF(encodingsToDo, "%s %s", *name, fullname);
}
- encodingsToDo = listConsF(encodingsToDo, "%s %s", *name ,fullname);
if(encodingsToDo == NULL) {
fprintf(stderr, "Couldn't allocate encodings\n");
closedir(dirp);
Index: programs/mkfontscale/mkfontscale.man
===================================================================
RCS file: /home/x-cvs/xc/programs/mkfontscale/mkfontscale.man,v
retrieving revision 1.4
diff -u -r1.4 mkfontscale.man
--- programs/mkfontscale/mkfontscale.man 20 Jun 2003 15:49:52 -0000 1.4
+++ programs/mkfontscale/mkfontscale.man 2 Jul 2003 19:16:52 -0000
@@ -27,6 +27,12 @@
.B \-p
.I prefix
] [
+.B \-r
+.I prefix
+] [
+.B \-n
+.I prefix
+] [
.B \-\-
] [
.I directory
@@ -98,6 +104,17 @@
when they are written to the "encodings.dir" file. The prefix is
prepended litterally: if a `/' is required between the prefix and the path
names, it must be supplied explicitly as part of the prefix.
+.TP
+.B \-r
+Keep non-absolute encoding directories in their relative form when
+writing the "encodings.dir" file. The default is to convert relative
+encoding directories to absolute directories by prepending the current
+directory. The positioning of this options is significant, as this
+option only applies to subsequent
+.TP
+.B \-n
+do not scan for fonts, do not write font directory files. This option
+is useful when generating encoding directories only.
.TP
.B \-\-
end of options.
_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel