From 0ddd4dbbb33b23b91465470ef37e771fe066e595 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 26 Jul 2016 17:37:35 -0300 Subject: [PATCH] sch2fig/lib.c (lib_parse): replace all ~ in unquoted strings with spaces --- sch2fig/TODO | 1 - sch2fig/lib.c | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sch2fig/TODO b/sch2fig/TODO index b96169e..6e3c921 100644 --- a/sch2fig/TODO +++ b/sch2fig/TODO @@ -4,7 +4,6 @@ - unify alignment, direction - support fonts attributes ? - support line thickness ? -- ~ as space (grep for ~ in out.fig) - ~ as overline (grep for ~ in out.fig) - glabel: build for "right" style, then rotate poly - break into file reading, internal storage, rendering diff --git a/sch2fig/lib.c b/sch2fig/lib.c index 465787e..b6d7087 100644 --- a/sch2fig/lib.c +++ b/sch2fig/lib.c @@ -603,13 +603,22 @@ bool lib_parse(struct lib_ctx *ctx, const char *line) &obj->u.text.dim, &zero1, &obj->unit, &obj->convert, &obj->u.text.s, &style, &zero2, &obj->u.text.hor_align, &obj->u.text.vert_align); - if (n != 12) + if (n != 12) { n = sscanf(line, "T %d %d %d %d %u %u %u %ms %ms %u %c %c", &obj->u.text.orient, &obj->u.text.x, &obj->u.text.y, &obj->u.text.dim, &zero1, &obj->unit, &obj->convert, &obj->u.text.s, &style, &zero2, &obj->u.text.hor_align, &obj->u.text.vert_align); + while (n == 12) { + char *tilde; + + tilde = strchr(obj->u.text.s, '~'); + if (!tilde) + break; + *tilde = ' '; + } + } if (n == 12) { if (zero1 || zero2) { fprintf(stderr, "%u: only understand 0 x x\n",