diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2010-06-05 14:09:41 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2010-06-05 14:09:41 +0000 |
| commit | be17cd266c16854cabb8eee4751edcc7c37a4ab6 (patch) | |
| tree | b34f85f04f403481905fd15962843bbad27ca9e6 /src/style.cpp | |
| parent | Translator credits update (now all files are updated) (diff) | |
| download | inkscape-be17cd266c16854cabb8eee4751edcc7c37a4ab6.tar.gz inkscape-be17cd266c16854cabb8eee4751edcc7c37a4ab6.zip | |
Adding a character to a superscript or subscript no longer resets
baseline-shift.
(bzr r9481)
Diffstat (limited to 'src/style.cpp')
| -rw-r--r-- | src/style.cpp | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/src/style.cpp b/src/style.cpp index f26862871..9c82b1b7a 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -3950,35 +3950,25 @@ sp_style_write_ifontsize(gchar *p, gint const len, gchar const *key, } -/** - * +/* + * baseline-shift is relative to parent. The only time it should + * not be written out is if it is zero (or not set). */ static bool -sp_baseline_shift_differ(SPIBaselineShift const *const a, SPIBaselineShift const *const b) +sp_baseline_shift_notzero(SPIBaselineShift const *const a ) { - if (a->type != b->type) - return true; - if (a->type == SP_BASELINE_SHIFT_LITERAL ) { - if (a->literal != b->literal) - return true; - } - if (a->type == SP_BASELINE_SHIFT_LENGTH) { - if (a->unit == SP_CSS_UNIT_EM || a->unit == SP_CSS_UNIT_EX ) { - if( a->value != b->value ) - return true; - } else { - if (a->computed != b->computed) - return true; + if( a->type == SP_BASELINE_SHIFT_LITERAL ) { + if( a->literal == SP_CSS_BASELINE_SHIFT_BASELINE ) { + return false; + } + } else { + if( a->value == 0.0 ) { + return false; } } - if (a->type == SP_BASELINE_SHIFT_PERCENTAGE) { - if (a->value != b->value) - return true; - } - return false; + return true; } - /** * Write SPIBaselineShift object into string. */ @@ -3990,13 +3980,13 @@ sp_style_write_ibaselineshift(gchar *p, gint const len, gchar const *key, if ((flags & SP_STYLE_FLAG_ALWAYS) || ((flags & SP_STYLE_FLAG_IFSET) && val->set) || ((flags & SP_STYLE_FLAG_IFDIFF) && val->set - && (!base->set || sp_baseline_shift_differ(val, base)))) + && (!base->set || sp_baseline_shift_notzero(val) ))) { if (val->inherit) { return g_snprintf(p, len, "%s:inherit;", key); } else if (val->type == SP_BASELINE_SHIFT_LITERAL) { for (unsigned i = 0; enum_baseline_shift[i].key; i++) { - if (enum_baseline_shift[i].value == static_cast< gint > (val->value) ) { + if (enum_baseline_shift[i].value == static_cast< gint > (val->literal) ) { return g_snprintf(p, len, "%s:%s;", key, enum_baseline_shift[i].key); } } |
