From dbd90bd72e95b184984e25e08944b794b1059882 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 3 Oct 2009 15:32:25 +0100 Subject: [PATCH] Cleanups to SFD emitter: * Don't emit Fore, SplineSet, or EndSplineSet if a glyph has no splines. * Emit a blank line between glyphs. * Set the "W" flag on all glyphs to indicate that the width is explicitly set. The last seems to be what's necessary to get Fontforge to believe in my "space" glyph. --- ttxt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ttxt.c b/ttxt.c index a0a8af9..e2eeb69 100644 --- a/ttxt.c +++ b/ttxt.c @@ -216,13 +216,12 @@ main(int argc, char **argv) printf("FitToEm: 1\n"); printf("BeginChars: %d %d\n", nglyphs+32, nglyphs); for (i = 0; i < nglyphs; i++) { - printf("StartChar: %s\n", glyphs[i].name); + printf("\nStartChar: %s\n", glyphs[i].name); printf("Encoding: %d %d %d\n", i+32, glyphs[i].unicode, i); printf("Width: 600\n"); - printf("Flags:\n"); + printf("Flags: W\n"); printf("LayerCount: 2\n"); - printf("Fore\n"); dochar(glyphs[i].data); printf("EndChar\n"); } @@ -406,13 +405,14 @@ clean_path() static void emit_path() { - int i; + int i, started = 0; point *p, *p1; - printf("SplineSet\n"); for (i = 0; i < nextpoint; i++) { p = &points[i]; if (p->next) { + if (!started) printf("Fore\nSplineSet\n"); + started = 1; do { printf(" %d %d %s 1\n", p->v.x*25, p->v.y*25 - 300, @@ -423,7 +423,7 @@ emit_path() } while (p); } } - printf("EndSplineSet\n"); + if (started) printf("EndSplineSet\n"); } static void -- 2.30.2