Browse Source

FOP-2764: footnote-body ignores rl-tb writing mode by João André Gonçalves

pull/76/merge
Simon Steiner 4 months ago
parent
commit
01e520466c

+ 23
- 0
fop-core/src/main/java/org/apache/fop/fo/flow/Footnote.java View File

@@ -19,9 +19,13 @@

package org.apache.fop.fo.flow;

import java.util.Iterator;
import java.util.Stack;

import org.xml.sax.Locator;

import org.apache.fop.apps.FOPException;
import org.apache.fop.complexscripts.bidi.DelimitedTextRange;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
@@ -148,5 +152,24 @@ public class Footnote extends FObj implements CommonAccessibilityHolder {
public int getNameId() {
return FO_FOOTNOTE;
}

@Override
protected Stack<DelimitedTextRange> collectDelimitedTextRanges(Stack<DelimitedTextRange> ranges,
DelimitedTextRange currentRange) {
FootnoteBody body = getFootnoteBody();
if (body != null) {
ranges = body.collectDelimitedTextRanges(ranges);
}

Inline inline = getFootnoteCitation();
if (inline != null) {
ranges = inline.collectDelimitedTextRanges(ranges);
}

for (Iterator it = getChildNodes(); (it != null) && it.hasNext();) {
ranges = ((FONode) it.next()).collectDelimitedTextRanges(ranges);
}
return ranges;
}
}


+ 72
- 0
fop/test/layoutengine/standard-testcases/footnote_writing-mode_rl.xml View File

@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Id$ -->
<testcase>
<info>
<p>
This test checks that the footnote respects writing-mode="rl" specified on block-container.
</p>
</info>
<fo>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="first" margin-top="2cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<fo:block-container writing-mode="rl-tb">
<fo:block>
rightLeft
<fo:footnote>
<fo:inline>1</fo:inline>
<fo:footnote-body>
<fo:block>
<fo:inline>1</fo:inline>
footnoteRL
</fo:block>
</fo:footnote-body>
</fo:footnote>
</fo:block>
</fo:block-container>
<fo:block-container writing-mode="lr-tb">
<fo:block>
leftRight
<fo:footnote>
<fo:inline>2</fo:inline>
<fo:footnote-body>
<fo:block>
<fo:inline>2</fo:inline>
footnoteLR
</fo:block>
</fo:footnote-body>
</fo:footnote>
</fo:block>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
<eval expected="1 rightLeft" xpath="//block[1]"/>
<eval expected="footnoteRL 1" xpath="//footnote/block[1]"/>
<eval expected="leftRight 2" xpath="//block[2]"/>
<eval expected="2 footnoteLR" xpath="//footnote/block[2]"/>
</checks>
</testcase>

Loading…
Cancel
Save