[ https://issues.apache.org/jira/browse/FOP-2527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
simon steiner updated FOP-2527: ------------------------------- Fix Version/s: 2.3 > 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 > Assignee: simon steiner > Priority: Major > Labels: fo:block, html, rtf, text-indent, xhtml, xslt > Fix For: 2.3 > > Attachments: RtfText.java, TestFOP.java, > TextAttributesConverter.java, test.fo, test.html, xhtml2fo.xsl > > > 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: > <pre> > /** constant for left indent first */ > public static final String LEFT_INDENT_FIRST = "fi-"; > </pre> > 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 (v7.6.3#76005)