diff options
| -rw-r--r-- | src/main.cpp | 28 | ||||
| -rw-r--r-- | src/text-editing.cpp | 17 | ||||
| -rw-r--r-- | src/text-editing.h | 2 |
3 files changed, 47 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 15efd22d9..ee18c8822 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -121,6 +121,11 @@ #include "compat-key-syms.h" #endif +#include "path-chemistry.h" +#include "sp-text.h" +#include "sp-flowtext.h" +#include "text-editing.h" + enum { SP_ARG_NONE, SP_ARG_NOGUI, @@ -1036,6 +1041,29 @@ int sp_process_file_list(GSList *fl) sp_do_export_png(doc); } if (sp_export_svg) { + if (sp_export_text_to_path) { + GSList *items = NULL; + SPRoot *root = doc->getRoot(); + for ( SPObject *iter = root->firstChild(); iter ; iter = iter->getNext()) { + SPItem* item = (SPItem*) iter; + if (! (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item) || SP_IS_GROUP(item))) { + continue; + } + + te_update_layout_now_recursive(item); + items = g_slist_append(items, item); + } + + GSList *selected = NULL; + GSList *to_select = NULL; + + sp_item_list_to_curves(items, &selected, &to_select); + + g_slist_free (items); + g_slist_free (selected); + g_slist_free (to_select); + } + Inkscape::XML::Document *rdoc; Inkscape::XML::Node *repr; rdoc = sp_repr_document_new("svg:svg"); diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 8f005d86a..44b323989 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -34,6 +34,7 @@ #include "sp-flowtext.h" #include "sp-flowdiv.h" #include "sp-flowregion.h" +#include "sp-item-group.h" #include "sp-tref.h" #include "sp-tspan.h" @@ -62,6 +63,22 @@ static void te_update_layout_now (SPItem *item) item->updateRepr(); } +void te_update_layout_now_recursive(SPItem *item) +{ + if (SP_IS_GROUP(item)) { + GSList *item_list = sp_item_group_item_list(SP_GROUP(item)); + for(GSList* elem = item_list; elem; elem = elem->next) { + SPItem* list_item = (SPItem*) elem->data; + te_update_layout_now_recursive(list_item); + } + g_slist_free(item_list); + } else if (SP_IS_TEXT(item)) + SP_TEXT(item)->rebuildLayout(); + else if (SP_IS_FLOWTEXT (item)) + SP_FLOWTEXT(item)->rebuildLayout(); + item->updateRepr(); +} + bool sp_te_output_is_empty(SPItem const *item) { Inkscape::Text::Layout const *layout = te_get_layout(item); diff --git a/src/text-editing.h b/src/text-editing.h index 37527d385..deb6f8538 100644 --- a/src/text-editing.h +++ b/src/text-editing.h @@ -28,6 +28,8 @@ typedef std::pair<Inkscape::Text::Layout::iterator, Inkscape::Text::Layout::iter Inkscape::Text::Layout const * te_get_layout (SPItem const *item); +void te_update_layout_now_recursive(SPItem *item); + /** Returns true if there are no visible characters on the canvas. */ bool sp_te_output_is_empty(SPItem const *item); |
