You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Stanley Santos de Araújo (JIRA)" <ji...@apache.org> on 2015/09/17 22:04:04 UTC
[jira] [Created] (FOP-2527) RTF first line indent not being
rendered by fo:block text-indent
Stanley Santos de Araújo created FOP-2527:
---------------------------------------------
Summary: RTF first line indent not being rendered by fo:block text-indent
Key: FOP-2527
URL: https://issues.apache.org/jira/browse/FOP-2527
Project: FOP
Issue Type: Bug
Components: renderer/rtf
Affects Versions: 2.0
Environment: Linux JDK8 fop 2.0 stable
Reporter: Stanley Santos de Araújo
I am using FOP to convert from XHTML to RTF using Antennahouse Stylesheet for XHTML to XSL-FO transformation.
My scenario is desbribed below:
I am using stylesheet xhtml2fo.xslt and it works fine when parsing XHTML to PDF, but when I change Fop MIME_TYPE to RTF and execute the same code, RTF output file does not contain first line indentation according XHTML style.
1) XHTML input:
<p style="text-indent: 3cm">BLAH BLAH BLAH</p>
Stylesheet xhtml2fo.xslt:
http://www.antennahouse.com/XSLsample/sample-xsl-xhtml2fo/xhtml2fo.xsl
2) FO Output:
<fo:block text-indent:3m>BLAH BLAH BLAH</fo:block>
3) Expected RTF output:
{ fiXXX BLAH BLAH BLAH }
4) I have verified FOP source code and noticed that current version have a bug on RtfText:
/** constant for left indent first */
public static final String LEFT_INDENT_FIRST = "fi-";
5) Also TextAttributesConverter is not considering text-indent attribute:
public static RtfAttributes convertAttributes(Block fobj)
throws FOPException {
FOPRtfAttributes attrib = new FOPRtfAttributes();
attrFont(fobj.getCommonFont(), attrib);
attrFontColor(fobj.getColor(), attrib);
//attrTextDecoration(fobj.getTextDecoration(), attrib);
attrBlockBackgroundColor(fobj.getCommonBorderPaddingBackground(), attrib);
attrBlockMargin(fobj.getCommonMarginBlock(), attrib);
attrBlockTextAlign(fobj.getTextAlign(), attrib);
attrBorder(fobj.getCommonBorderPaddingBackground(), attrib, fobj);
attrBreak(fobj, attrib);
return attrib;
}
6) I implemented the following patch and it is working fine for me. Check this out:
- Fixed LEFT_INDENT_FIRST to public static final String LEFT_INDENT_FIRST = "fi";
- New method to convert text-indent attribute:
public static RtfAttributes convertAttributes(Block fobj)
throws FOPException {
...
attrBlockTextIndent(fobj.getTextIndent(), attrib);
...
return attrib;
}
private static void attrBlockTextIndent(Length textIndent, FOPRtfAttributes rtfAttr) {
rtfAttr.setTwips(RtfText.LEFT_INDENT_FIRST, textIndent.getValue());
}
Thank you!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)