diff options
author | Thomas White <taw@bitwiz.me.uk> | 2019-04-06 22:45:57 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2019-04-06 22:45:57 +0200 |
commit | cb559aa47b65cb02a59ef972b2cda938b35db138 (patch) | |
tree | e262a6a103654203780b9e87776cf05a585a8c6a | |
parent | 702642aec53d5d57f9bf8d685d57b89b25411a34 (diff) |
Stylesheet saving fixes
-rw-r--r-- | libstorycode/stylesheet.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libstorycode/stylesheet.c b/libstorycode/stylesheet.c index c3da08b..3fdb7af 100644 --- a/libstorycode/stylesheet.c +++ b/libstorycode/stylesheet.c @@ -480,10 +480,16 @@ static void add_style(char **text, size_t *len, size_t *lenmax, const char *pref if ( sty->set & SM_BGCOL ) { char tmp[256]; - snprintf(tmp, 255, "BGCOL %s%.4g,%.4g,%.4g,%.4g %.4g,%.4g,%.4g,%.4g\n", - bgcolc(sty->bggrad), - sty->bgcol[0], sty->bgcol[1], sty->bgcol[2], sty->bgcol[3], - sty->bgcol2[0], sty->bgcol2[1], sty->bgcol2[2], sty->bgcol2[3]); + if ( sty->bggrad == GRAD_NONE ) { + snprintf(tmp, 255, "BGCOL %s%.4g,%.4g,%.4g,%.4g\n", + bgcolc(sty->bggrad), + sty->bgcol[0], sty->bgcol[1], sty->bgcol[2], sty->bgcol[3]); + } else { + snprintf(tmp, 255, "BGCOL %s%.4g,%.4g,%.4g,%.4g %.4g,%.4g,%.4g,%.4g\n", + bgcolc(sty->bggrad), + sty->bgcol[0], sty->bgcol[1], sty->bgcol[2], sty->bgcol[3], + sty->bgcol2[0], sty->bgcol2[1], sty->bgcol2[2], sty->bgcol2[3]); + } add_text(text, len, lenmax, prefix, tmp); } @@ -499,7 +505,7 @@ static void add_style(char **text, size_t *len, size_t *lenmax, const char *pref if ( sty->set & SM_PADDING ) { char tmp[256]; - snprintf(tmp, 255, "PADDING %.4g%c,%.4g%c,%.4g%c,%.4g%c\n", + snprintf(tmp, 255, "PAD %.4g%c,%.4g%c,%.4g%c,%.4g%c\n", sty->padding[0].len, unitc(sty->padding[0].unit), sty->padding[1].len, unitc(sty->padding[1].unit), sty->padding[2].len, unitc(sty->padding[2].unit), |