diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2019-04-24 13:16:09 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2019-04-24 13:16:46 +0000 |
| commit | 1446f4eeb37a47231dd45db757454db045049ac6 (patch) | |
| tree | e6f59679f166cb2c93d307c5c6d787abb5e1926e | |
| parent | Add second Tav fix (diff) | |
| download | inkscape-1446f4eeb37a47231dd45db757454db045049ac6.tar.gz inkscape-1446f4eeb37a47231dd45db757454db045049ac6.zip | |
Add comment, rename function
| -rw-r--r-- | src/document.cpp | 2 | ||||
| -rw-r--r-- | src/file-update.cpp | 17 | ||||
| -rw-r--r-- | src/file.h | 2 |
3 files changed, 16 insertions, 5 deletions
diff --git a/src/document.cpp b/src/document.cpp index f923a45d6..03b285710 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -452,7 +452,7 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, /** Fix first line spacing in legacy documents (pre-1.0 files) **/ if (sp_version_inside_range(document->root->version.inkscape, 0, 1, 1, 0)) { - sp_file_remove_style_on_empty_lines(document); + sp_file_fix_empty_lines(document); } /** Fix dpi (pre-92 files). With GUI fixed in Inkscape::Application::fix_document. **/ diff --git a/src/file-update.cpp b/src/file-update.cpp index ff72f9b0e..9f1eafd7f 100644 --- a/src/file-update.cpp +++ b/src/file-update.cpp @@ -205,7 +205,18 @@ void sp_file_convert_text_baseline_spacing(SPDocument *doc) sp_file_text_run_recursive(fix_update, doc->getRoot()); } -void _remove_style_on_empty_lines(SPObject *o) + +/** + * Implements a fix for https://gitlab.com/inkscape/inkscape/issues/45 + * Line spacing for empty lines was handled differently before 1.0 + * and in particular with the first empty lines or with how style attributes + * are processed in empty lines (line = tspan with sodipodi:role="line") + * + * This function "fixes" a text element in a old document by removing the + * first empty lines and style attrs on other empty lines. + * + * */ +void _fix_pre_v1_empty_lines(SPObject *o) { std::vector<SPObject *> cl = o->childList(false); bool begin = true; @@ -233,9 +244,9 @@ void _remove_style_on_empty_lines(SPObject *o) -void sp_file_remove_style_on_empty_lines(SPDocument *doc) +void sp_file_fix_empty_lines(SPDocument *doc) { - sp_file_text_run_recursive(_remove_style_on_empty_lines, doc->getRoot()); + sp_file_text_run_recursive(_fix_pre_v1_empty_lines, doc->getRoot()); sp_file_text_run_recursive(fix_update, doc->getRoot()); } diff --git a/src/file.h b/src/file.h index 5feb81a0c..c6353ad99 100644 --- a/src/file.h +++ b/src/file.h @@ -196,7 +196,7 @@ void sp_file_vacuum (SPDocument *doc); void sp_file_convert_text_baseline_spacing(SPDocument *doc); void sp_file_convert_font_name(SPDocument *doc); void sp_file_convert_dpi(SPDocument *doc); -void sp_file_remove_style_on_empty_lines(SPDocument *doc); +void sp_file_fix_empty_lines(SPDocument *doc); enum File_DPI_Fix { FILE_DPI_UNCHANGED = 0, FILE_DPI_VIEWBOX_SCALED, FILE_DPI_DOCUMENT_SCALED }; extern int sp_file_convert_dpi_method_commandline; |
