[cairo-commit] src/cairo-pdf-interchange.c src/cairo-tag-stack.c

Adrian Johnson ajohnson at kemper.freedesktop.org
Tue Aug 22 11:55:45 UTC 2017


 src/cairo-pdf-interchange.c |   21 +++++++++++++--------
 src/cairo-tag-stack.c       |    1 +
 2 files changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 74c6e3ae1d356e8bb4c7043cb9d3897c45cc0f79
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Aug 22 21:18:54 2017 +0930

    pdf: don't write logical structure if it only contains links

diff --git a/src/cairo-pdf-interchange.c b/src/cairo-pdf-interchange.c
index b7ce1dca..baf3e0fe 100644
--- a/src/cairo-pdf-interchange.c
+++ b/src/cairo-pdf-interchange.c
@@ -1183,17 +1183,22 @@ _cairo_pdf_interchange_write_document_objects (cairo_pdf_surface_t *surface)
 {
     cairo_pdf_interchange_t *ic = &surface->interchange;
     cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
+    cairo_tag_stack_structure_type_t tag_type;
 
-    status = cairo_pdf_interchange_write_parent_tree (surface);
-    if (unlikely (status))
-	return status;
+    tag_type = _cairo_tag_stack_get_structure_type (&ic->analysis_tag_stack);
+    if (tag_type == TAG_TREE_TYPE_TAGGED || tag_type == TAG_TREE_TYPE_STRUCTURE) {
 
-    status = cairo_pdf_interchange_write_struct_tree (surface);
-    if (unlikely (status))
-	return status;
+	status = cairo_pdf_interchange_write_parent_tree (surface);
+	if (unlikely (status))
+	    return status;
 
-    if (_cairo_tag_stack_get_structure_type (&ic->analysis_tag_stack) == TAG_TREE_TYPE_TAGGED)
-	surface->tagged = TRUE;
+	status = cairo_pdf_interchange_write_struct_tree (surface);
+	if (unlikely (status))
+	    return status;
+
+	if (tag_type == TAG_TREE_TYPE_TAGGED)
+	    surface->tagged = TRUE;
+    }
 
     status = cairo_pdf_interchange_write_outline (surface);
     if (unlikely (status))
diff --git a/src/cairo-tag-stack.c b/src/cairo-tag-stack.c
index 858221eb..e7c49094 100644
--- a/src/cairo-tag-stack.c
+++ b/src/cairo-tag-stack.c
@@ -175,6 +175,7 @@ _cairo_tag_stack_push (cairo_tag_stack_t *stack,
 	    stack->type = TAG_TREE_TYPE_STRUCTURE;
     } else {
 	if (stack->type == TAG_TREE_TYPE_LINK_ONLY &&
+	    (strcmp (name, "Link") != 0) &&
 	    name_in_list (name, _cairo_tag_stack_struct_pdf_list))
 	{
 	    stack->type = TAG_TREE_TYPE_STRUCTURE;


More information about the cairo-commit mailing list