From acae6a226364604fe4692f118361af88c12977b0 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 11 May 2009 13:48:22 +0000 Subject: Fix writing of font name to intmetrics file svn path=/trunk/tools/ttf2f/; revision=7467 --- src/intmetrics.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/intmetrics.c b/src/intmetrics.c index 51ed5fd..f79727d 100644 --- a/src/intmetrics.c +++ b/src/intmetrics.c @@ -116,7 +116,7 @@ ttf2f_result intmetrics_write(const char *savein, const char *name, } /* fill in header */ - name_len = max(39, strlen(name)); + name_len = min(39, strlen(name)); snprintf(header.name, 40, "%s", name); memset(header.name + name_len, 0xD, 40 - name_len); header.a = header.b = 16; @@ -130,13 +130,13 @@ ttf2f_result intmetrics_write(const char *savein, const char *name, mapsize = 0; snprintf(out, 1024, "%s" DIR_SEP "IntMetrics", savein); - if ((output = fopen(out, "wb+")) == NULL) { + if ((output = fopen(out, "wb")) == NULL) { free(xwidthtab); return TTF2F_RESULT_OPEN; } - if (fwrite((void*) &header, sizeof(struct intmetrics_header), - 1, output) != 1) goto error_write; + if (fwrite(&header, sizeof(struct intmetrics_header), 1, output) != 1) + goto error_write; if (fputc(mapsize & 0xFF, output) == EOF) goto error_write; if (fputc((mapsize & 0xFF00) >> 8, output) == EOF) goto error_write; -- cgit v1.2.3