[ 
https://issues.apache.org/jira/browse/FOP-3167?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nico Kutscherauer updated FOP-3167:
-----------------------------------
    Attachment: colspan-rowspan-tag-properties.JPG

> Tagging attribute for TH Scope is overwritten by span attributes
> ----------------------------------------------------------------
>
>                 Key: FOP-3167
>                 URL: https://issues.apache.org/jira/browse/FOP-3167
>             Project: FOP
>          Issue Type: Bug
>            Reporter: Nico Kutscherauer
>            Priority: Major
>              Labels: Accessibility, Table, Tagging
>         Attachments: colspan-rowspan-tag-properties.JPG, 
> scope-with-colspan.fo, scope-with-colspan.pdf, scope-with-colspan_headA.jpg, 
> scope-with-colspan_headC.jpg
>
>
> If a table cell has the role {{TH}} it gets a scope info as PDF tag attribute 
> (Entry A) with the name {{/Scope}} and a value {{Column}} (default), {{Row}} 
> or {{{}Both{}}}.
> This works fine, but if the {{fo:table-cell}} has an additional 
> {{number-columns-spanned}} attribute, the Scope info is lost.
> The attached FO document ([^scope-with-colspan.fo]) shows two table head 
> cells only one with {{{}number-columns-spanned{}}}{{{}=2{}}}.
> The screenshot shows the tag property view in Acrobat of the rendered PDF 
> ([^scope-with-colspan.pdf]) for both cells.
> One has the ColSpan attribute but no Scope info:
> !scope-with-colspan_headA.jpg|width=591!
> The other with no ColSpan attribute has the Scope info:
> !scope-with-colspan_headC.jpg|width=591!
> The reason for the behavior of FOP is that the scope is written directly as 
> {{{}"A"{}}}-Entry:
> {code:java}
>             static void addScopeAttribute(PDFStructElem th, Scope scope) {
>                 PDFDictionary scopeAttribute = new PDFDictionary();
>                 scopeAttribute.put("O", Table.NAME);
>                 scopeAttribute.put("Scope", scope.getName());
>                 th.put("A", scopeAttribute);
>             }
> {code}
> Source: 
> [StandardStructureAttributes.java:58|https://github.com/apache/xmlgraphics-fop/blob/cb26fed42b675c576d8f4b69827a32a25e36c5bb/fop-core/src/main/java/org/apache/fop/pdf/StandardStructureAttributes.java#L58-L63]
> But the colspan/rowspan attributes are collected as a special {{attribute}} 
> field of PDFStructElem:
> {code:java}
>     public void setTableAttributeColSpan(int colSpan) {
>         setTableAttributeRowColumnSpan("ColSpan", colSpan);
>     }
>     public void setTableAttributeRowSpan(int rowSpan) {
>         setTableAttributeRowColumnSpan("RowSpan", rowSpan);
>     }
>     private void setTableAttributeRowColumnSpan(String typeSpan, int span) {
>         PDFDictionary attribute = new PDFDictionary();
>         attribute.put("O", Table.NAME);
>         attribute.put(typeSpan, span);
>         if (attributes == null) {
>             attributes = new ArrayList<PDFDictionary>(2);
>         }
>         attributes.add(attribute);
>     }
> {code}
> Source: 
> [PDFStructElem.java:230|https://github.com/apache/xmlgraphics-fop/blob/cb26fed42b675c576d8f4b69827a32a25e36c5bb/fop-core/src/main/java/org/apache/fop/pdf/PDFStructElem.java#L230-L246]
> At the end the field attribute overwrites the {{{}"A"{}}}-Entry:
> {code:java}
>     private void attachAttributes() {
>         if (attributes != null) {
>             if (attributes.size() == 1) {
>                 put("A", attributes.get(0));
>             } else {
>                 PDFArray array = new PDFArray(attributes);
>                 put("A", array);
>             }
>         }
>     }
> {code}
> Source: 
> [PDFStructElem.java:174|https://github.com/apache/xmlgraphics-fop/blob/cb26fed42b675c576d8f4b69827a32a25e36c5bb/fop-core/src/main/java/org/apache/fop/pdf/PDFStructElem.java#L174-L183]
> I will see If I can produce a patch in the next days.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to