You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Szymon Bochniak <sz...@javart.com.pl> on 2006/11/06 12:45:07 UTC

problem with justifying text

Hi everybody,

I'm using FOP 0.20.5 in a servlet. I'm trying to put a larger text (1 
page long) with couple of paragraphs  in a PDF document. I want to have 
the text justified so i'm doing it like this:

<fo:block white-space-collapse="false" text-align="justify" 
text-align-last="start">
Hi everyone

some txt including linebreaks some txt including linebreaks some txt 
including linebreaks some txt including linebreaks some txt including

some txt including linebreaks some txt including linebreaks some txt 
including linebreaks some txt including linebreaks some txt including 
linebreaks some txt including linebreaks

some greetings
</fo:block>

and i get:

Hi                                                      everyone

some    txt    including    linebreaks       some txt
including    linebreaks     some     txt     including
linebreaks     some    txt    including    linebreaks
some                        txt                       including

some      txt      including      linebreaks       some
txt     including        linebreaks        some        txt 
including     linebreaks    some     txt      including
linebreaks     some      txt including      linebreaks
some         txt           including             linebreaks

some greetings


even "Hi everyone" line is justified! also when longer lines are wrapped 
their ending is justified. Only last line - "some greetings" is aligned 
to the left.
text-align docs says: *
justify*
...the last (or only) line of any block, and any lines in the block 
ending in U+000A, will be aligned in accordance with the 
"text-align-last" property value...i tried to write the whole text as a 
one line with &#x000A; instead of linebreaks but it didn't change 
anything. I would like also to keep the whole text in a single block, so 
I don't want to split it into several blocks. Can anyone tell me what 
may be wrong?

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: problem with justifying text

Posted by Szymon Bochniak <sz...@javart.com.pl>.
Thanks a lot for your information. Using FOP 0.92beta solved my problem.
all the best,

Szymon Bochniak

Jeremias Maerki napisaƂ(a):
> Yes, 0.20.5 does it wrong, but your example simply can't work. In
> 0.92beta, your line breaks will simply be converted to spaces, removing
> the manual breaks some of which (not all) you obviously want to preserve.
> There's no option in XSL-FO that lets you treat two consecutive line
> breaks as a hard line break while removing the single line breaks. You
> can set linefeed-treatment="preserve" but that won't do what you want,
> either.
>
> You will have to preprocess the text somehow and create multiple blocks.
> I don't see a way around that unless I misunderstood your intentions.
>
> On 06.11.2006 12:45:07 Szymon Bochniak wrote:
>   
>> Hi everybody,
>>
>> I'm using FOP 0.20.5 in a servlet. I'm trying to put a larger text (1 
>> page long) with couple of paragraphs  in a PDF document. I want to have 
>> the text justified so i'm doing it like this:
>>
>> <fo:block white-space-collapse="false" text-align="justify" 
>> text-align-last="start">
>> Hi everyone
>>
>> some txt including linebreaks some txt including linebreaks some txt 
>> including linebreaks some txt including linebreaks some txt including
>>
>> some txt including linebreaks some txt including linebreaks some txt 
>> including linebreaks some txt including linebreaks some txt including 
>> linebreaks some txt including linebreaks
>>
>> some greetings
>> </fo:block>
>>
>> and i get:
>>
>> Hi                                                      everyone
>>
>> some    txt    including    linebreaks       some txt
>> including    linebreaks     some     txt     including
>> linebreaks     some    txt    including    linebreaks
>> some                        txt                       including
>>
>> some      txt      including      linebreaks       some
>> txt     including        linebreaks        some        txt 
>> including     linebreaks    some     txt      including
>> linebreaks     some      txt including      linebreaks
>> some         txt           including             linebreaks
>>
>> some greetings
>>
>>
>> even "Hi everyone" line is justified! also when longer lines are wrapped 
>> their ending is justified. Only last line - "some greetings" is aligned 
>> to the left.
>> text-align docs says: *
>> justify*
>> ...the last (or only) line of any block, and any lines in the block 
>> ending in U+000A, will be aligned in accordance with the 
>> "text-align-last" property value...i tried to write the whole text as a 
>> one line with &#x000A; instead of linebreaks but it didn't change 
>> anything. I would like also to keep the whole text in a single block, so 
>> I don't want to split it into several blocks. Can anyone tell me what 
>> may be wrong?
>>
>>     
>
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: problem with justifying text

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Yes, 0.20.5 does it wrong, but your example simply can't work. In
0.92beta, your line breaks will simply be converted to spaces, removing
the manual breaks some of which (not all) you obviously want to preserve.
There's no option in XSL-FO that lets you treat two consecutive line
breaks as a hard line break while removing the single line breaks. You
can set linefeed-treatment="preserve" but that won't do what you want,
either.

You will have to preprocess the text somehow and create multiple blocks.
I don't see a way around that unless I misunderstood your intentions.

On 06.11.2006 12:45:07 Szymon Bochniak wrote:
> Hi everybody,
> 
> I'm using FOP 0.20.5 in a servlet. I'm trying to put a larger text (1 
> page long) with couple of paragraphs  in a PDF document. I want to have 
> the text justified so i'm doing it like this:
> 
> <fo:block white-space-collapse="false" text-align="justify" 
> text-align-last="start">
> Hi everyone
> 
> some txt including linebreaks some txt including linebreaks some txt 
> including linebreaks some txt including linebreaks some txt including
> 
> some txt including linebreaks some txt including linebreaks some txt 
> including linebreaks some txt including linebreaks some txt including 
> linebreaks some txt including linebreaks
> 
> some greetings
> </fo:block>
> 
> and i get:
> 
> Hi                                                      everyone
> 
> some    txt    including    linebreaks       some txt
> including    linebreaks     some     txt     including
> linebreaks     some    txt    including    linebreaks
> some                        txt                       including
> 
> some      txt      including      linebreaks       some
> txt     including        linebreaks        some        txt 
> including     linebreaks    some     txt      including
> linebreaks     some      txt including      linebreaks
> some         txt           including             linebreaks
> 
> some greetings
> 
> 
> even "Hi everyone" line is justified! also when longer lines are wrapped 
> their ending is justified. Only last line - "some greetings" is aligned 
> to the left.
> text-align docs says: *
> justify*
> ...the last (or only) line of any block, and any lines in the block 
> ending in U+000A, will be aligned in accordance with the 
> "text-align-last" property value...i tried to write the whole text as a 
> one line with &#x000A; instead of linebreaks but it didn't change 
> anything. I would like also to keep the whole text in a single block, so 
> I don't want to split it into several blocks. Can anyone tell me what 
> may be wrong?
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org