1

Im using xsl-fo for printing pdfs (started to make my own library with itext, but xsl-fo looks fine for me). I have problem with aligning text which have different letter-spacing than default. my code is:

<fo:block border="solid 0.5mm green" text-align="center">
    <fo:inline border="solid 0.5mm black" letter-spacing="5pt">lorem ipsum</fo:inline>
</fo:block>

it produces the output:

Output

Problem is, that text "lorem ipsum" got to be positioned with larger letter-spacing, instead of positioning text with default letter-spacing and printing text with user defined letter-spacing. when we delete the letter-spacing="5pt" all works as expected.

Is there any override to this behavior? I have tried googling for some fancy attributes that will help, or tried playing with blocks but have no luck. Thanks.

Baum mit Augen
  • 49,044
  • 25
  • 144
  • 182
user3932298
  • 13
  • 1
  • 3

1 Answers1

3

Formatting the above FO with both RenderX and Apache FOP gives the results you desire if you use Helvetica font, centered with border surrounding the whole text. As you report, you are using Apache FOP with Arial ... this is your issue. I would report a bug to Apache FOP as their output is obviously wrong and should have nothing to do with the font selected.

You could try to accomplish a similar layout with a table with three columns and proportional column width, but I would think it would yield the same incorrect result from Apache FOP..

RenderX and FOP results for Helvetica

Here is the result from oXygen and RenderX XEP using Arial font. It is correct. It is Apache FOP bug.

RenderX XEP result using Arial

Kevin Brown
  • 8,805
  • 2
  • 20
  • 38
  • Im using Apache FOP in oXygen. I forgot to mention that Im using Arial Font. After some research I find out that Helvetica font (looks like the default font) renders correctly. But the Arial font is somehow problematic. Unfortunately Helvetica and Arial fonts should differ from each other and I have to use just the Arial font. – user3932298 Aug 12 '14 at 21:47
  • So you should report a bug to Apache FOP then. Rendering that with RenderX XEP with Arial font results in the perfect result (again) and I do confirm what you see with Apache FOP and Arial. – Kevin Brown Aug 12 '14 at 22:34