Hi,
lmhelp wrote:
> Hi everyone,
>
> Thank you for reading my post.
> Have a look at the following piece of code:
>
> We have:
> - a "fo:block" element,
> - and two "fo:inline" elements inside of it one after the other:
>
> =====================================================
> <fo:block background-color = "red">
> <fo:inline background-color="teal">
> The sky is blue
> </fo:inline>
>
> <fo:inline background-color = "purple">
> The grass is green
> </fo:inline>
> </fo:block>
> =====================================================
>
> My problem is that:
>
> (1) a white space is added at the end of the
> string "The sky is blue" inside the "fo:inline"
> element ;
>
> (2) a white space is added at the beginning
> of the string "The grass is green" inside the
> "fo:inline" element ;
>
> (3) there is also an extra space between the
> two "fo:inline" elements.
This is due to the white space used to ‘pretty-print’ your FO file. The
carriage returns and spaces used to indent the content are normalized by
FOP into one space.
The only way to avoid that is to remove any superfluous white space:
<fo:block background-color="red"><fo:inline
background-color="teal">The sky is blue</fo:inline><fo:inline
background-color="purple">The grass is green</fo:inline>
</fo:block>
You can still avoid very long lines in the FO file by breaking inside
elements like shown above. This is less human-readable, but you don’t
have much choice. Anyway FO files are rarely edited by hand.
> For the third problem, I wrote the following to get
> rid of the extra space (I put the second "fo:inline"
> element inside the first one):
>
> =====================================================
> <fo:block background-color = "red">
> <fo:inline background-color="teal">
> The sky is blue
> <fo:inline background-color = "purple">
> The grass is green
> </fo:inline>
> </fo:inline>
> </fo:block>
> =====================================================
>
> Do you know how to remove those white spaces (cases (1) and (2))?
> If not, do you understand what is the logics behind it?
>
> Thanks for your help,
> --
> Lmhelp
>
> PS: Here is a gif image which illustrates the problem above:
> http://www.nabble.com/file/p23157799/img_nabble_post.gif
HTH,
Vincent
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]