diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-05-08 10:05:07 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-05-08 10:05:07 +0000 |
commit | 65ba8bdea7cbe493934ebd9624f3b9af70e40033 (patch) | |
tree | 85c031ac0470418216a6c5001b4d808eb69feb0c /src | |
parent | 4aed351e3376d70cedf1dfbcf4f396cc904e2703 (diff) | |
download | ttf2f-65ba8bdea7cbe493934ebd9624f3b9af70e40033.tar.gz ttf2f-65ba8bdea7cbe493934ebd9624f3b9af70e40033.tar.bz2 |
Slightly more useful behaviour on non-RO platforms.
Fix segv in cli frontend.
Make cli frontend create output directory.
svn path=/trunk/tools/ttf2f/; revision=7437
Diffstat (limited to 'src')
-rw-r--r-- | src/cli.c | 12 | ||||
-rw-r--r-- | src/encoding.c | 2 | ||||
-rw-r--r-- | src/glyphs.c | 4 | ||||
-rw-r--r-- | src/intmetrics.c | 2 | ||||
-rw-r--r-- | src/outlines.c | 2 | ||||
-rw-r--r-- | src/utils.h | 6 |
6 files changed, 21 insertions, 7 deletions
@@ -1,6 +1,8 @@ #include <stdio.h> #include <stdlib.h> +#include <sys/stat.h> + #include "encoding.h" #include "fm.h" #include "ft.h" @@ -79,13 +81,15 @@ int main(int argc, char **argv) return 1; } - glmetrics(glist, NULL); + glmetrics(glist, progress); + + mkdir(argv[2], 0755); - write_intmetrics("", argv[2], glist, nglyphs, metrics, progress); + write_intmetrics(argv[2], argv[2], glist, nglyphs, metrics, progress); - write_outlines("", argv[2], glist, nglyphs, metrics, progress); + write_outlines(argv[2], argv[2], glist, nglyphs, metrics, progress); - write_encoding("", argv[2], glist, nglyphs, 0, progress); + write_encoding(argv[2], argv[2], glist, nglyphs, 0, progress); free(metrics); free(glist); diff --git a/src/encoding.c b/src/encoding.c index 4d5bcde..61df3ed 100644 --- a/src/encoding.c +++ b/src/encoding.c @@ -25,7 +25,7 @@ void write_encoding(const char *savein, const char *name, int i; char out[1024]; - snprintf(out, 1024, "%s.Encoding", savein); + snprintf(out, 1024, "%s" DIR_SEP "Encoding", savein); output = fopen(out, "w+"); fprintf(output, "%% %sEncoding 1.00\n", name); diff --git a/src/glyphs.c b/src/glyphs.c index 71a8775..f24cbd6 100644 --- a/src/glyphs.c +++ b/src/glyphs.c @@ -19,7 +19,11 @@ void load_glyph_list(void) char *semi, *name; struct glyph_entry *g, *cur; +#ifdef __riscos__ fp = fopen("<TTF2f$Dir>.Glyphs", "r"); +#else + fp = fopen("Glyphs", "r"); +#endif if (!fp) { fprintf(stderr, "Failed opening glyphs file\n"); exit(255); diff --git a/src/intmetrics.c b/src/intmetrics.c index 0c95950..4e8e5f1 100644 --- a/src/intmetrics.c +++ b/src/intmetrics.c @@ -137,7 +137,7 @@ void write_intmetrics(const char *savein, const char *name, mapsize = charmap_size; - snprintf(out, 1024, "%s.IntMetrics", savein); + snprintf(out, 1024, "%s" DIR_SEP "IntMetrics", savein); output = fopen(out, "wb+"); fwrite((void*)&header, sizeof(struct intmetrics_header), 1, output); fputc(mapsize & 0xFF, output); diff --git a/src/outlines.c b/src/outlines.c index 0a35de9..2aef1bb 100644 --- a/src/outlines.c +++ b/src/outlines.c @@ -60,7 +60,7 @@ void write_outlines(const char *savein, const char *name, header.chunk_data.reserved[3] = 0; header.chunk_data.reserved[4] = 0; - snprintf(out, 1024, "%s.Outlines", savein); + snprintf(out, 1024, "%s" DIR_SEP "Outlines", savein); output = fopen(out, "wb+"); /* write file header */ fwrite((void*)&header, sizeof(struct outlines_header), 1, output); diff --git a/src/utils.h b/src/utils.h index 8837255..de1d067 100644 --- a/src/utils.h +++ b/src/utils.h @@ -5,6 +5,12 @@ #define UNUSED(x) ((x)=(x)) #endif +#ifdef __riscos__ +#define DIR_SEP "." +#else +#define DIR_SEP "/" +#endif + void ttf2f_poll(int active); char *strndup(const char *s, size_t n); long convert_units(long raw, long ppem); |