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 Alex McLintock <al...@yahoo.com> on 2001/05/09 16:29:47 UTC

writing-mode in SVG and FOP

Hi folks, 

I am trying to include some vertically written text in an SVG inside an FO file.
It seems to be coming out as horizontal text.

I am essentially trying to draw some text so that it comes out like

H
E
L
L
O

and for that I am using some SVG something like

<svg:text x='0' y='0' writing-mode='tb-lr' >HELLO</svg:text>

(There is more SVG too which I have stripped out for this example.)

It is coming out like this

HELLO


I can see some code in the FOP 0.18 source which attempts to read in
the writing modes of "tb-lr" and others, but I am not sure it actually 
does anything with that information.

Can anyone with some experience of the SVG code point me in the right direction.

I don't really understand how it all fits together.

My guess is that each character in the text is treated separately and joined together
in a textGraph object using "appendChild". I assume that this somehow figures out
where to position the next letter but I can't see it doing it. 

Before you ask - no I can't use an <fo:block> because this text needs to be within
the SVG object.

Any help understanding the code would be appreciated because I could possibly help
enhancing it afterwards :-)

Alex


=====
Alex McLintock        alex@OWAL.co.uk
OpenWeb Analysts Ltd, http://www.OWAL.co.uk/ 
COMPETITION: http://www.diversebooks.com/cgi-bin/caption/captions.cgi?date=200104
Get Your XML T-Shirt <t-shirt/> at http://www.inversity.co.uk/

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: writing-mode in SVG and FOP

Posted by Keiron Liddle <ke...@aftexsw.com>.
On Thu, 10 May 2001 13:56:38 Alex McLintock wrote:
> Now I am actually using FOP in a production environment. (We are
> currently rotating the 
> text which provides a reasonable work around). I was hoping that I could
> help fix 
> this feature in the FOP SVG code and carry on. However there seems to be
> little point
> in improving the FOP SVG code if it is going to be replaced with Batik.
> 

> Is anyone working on this?

It is being worked on.

> Can anyone give any estimates of timescales (eg this year. next year
maybe.

How long is a piece of string? :)
As you can see from the example it already is working. It just needs to be
checked in plus a few areas of improvements.

> Should I be volunteering to help integrate FOP and Batik?
> How much work is that?

Help is always a good thing.
Unfortunately there isn't much you can do for the integration at the
moment, just wait a bit.

You can always update the docs.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: writing-mode in SVG and FOP

Posted by Alex McLintock <al...@yahoo.com>.
--- Keiron Liddle <ke...@aftexsw.com> wrote: > 
> The code will (eventually) use batik to render svg images. So what is or is
> not handled will depend on what batik does (mostly).

Oh! I thought we weren't using Batik for a good reason - and that we weren't going to.
In that case I better get on the Batik mailing lists and try it out.

> I have attached a sample pdf using batik and fop to render and I added the
> following lines:
> 
> <text style="font-size:30" x='150' y='150'>HELLO</text>
> 
> <text style="font-size:30" x='160' y='170' writing-mode='tb-rl'
> >HELLO</text>

My reading of the spec is that Batik is wrong in this respect. I will see if I can do the same 
thing with other SVG viewers. I have the Adobe SVG plugin and will try that.

Thanks for spotting that I had incorrectly specified "tb-lr" instead of "tb-rl".
I personally think that is a missing requirement from the spec but who am I to argue.


To quote from the SVG spec

'writing-mode'
Value: lr-tb | rl-tb | tb-rl | lr | rl | tb | inherit
Initial: lr-tb
Applies to: 'text' elements
Inherited: yes
Percentages: N/A
Media: visual
Animatable: no

lr-tb | lr
Sets the initial inline progression direction to left-to-right, as is common in most Latin-based
documents. For most characters, the current text position is advanced from left to right after
each glyph is rendered. (When the character data includes characters which are subject to the
Unicode bidirectional algorithm, the text advance rules are more complex. 

rl-tb | rl
Sets the initial inline progression direction to right-to-left, as is common in Arabic or Hebrew
scripts. 

tb-rl | tb
Sets the initial inline progression direction to top-to-bottom, as is common in Asian scripts.
Though hardly as frequent as horizontal, this type of vertical layout also occurs in Latin based
documents, particularly in table column or row labels. In most cases, the vertical
baselines running through the middle of each glyph are aligned.
 

Now I am actually using FOP in a production environment. (We are currently rotating the 
text which provides a reasonable work around). I was hoping that I could help fix 
this feature in the FOP SVG code and carry on. However there seems to be little point
in improving the FOP SVG code if it is going to be replaced with Batik.

Is anyone working on this? Can anyone give any estimates of timescales (eg this year.
next year maybe.) Should I be volunteering to help integrate FOP and Batik?
How much work is that?



=====
Alex McLintock        alex@OWAL.co.uk
OpenWeb Analysts Ltd, http://www.OWAL.co.uk/ 
COMPETITION: http://www.diversebooks.com/cgi-bin/caption/captions.cgi?date=200104
Get Your XML T-Shirt <t-shirt/> at http://www.inversity.co.uk/

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: writing-mode in SVG and FOP

Posted by Keiron Liddle <ke...@aftexsw.com>.
The code will (eventually) use batik to render svg images. So what is or is
not handled will depend on what batik does (mostly).
I have attached a sample pdf using batik and fop to render and I added the
following lines:

<text style="font-size:30" x='150' y='150'>HELLO</text>

<text style="font-size:30" x='160' y='170' writing-mode='tb-rl'
>HELLO</text>


according to the dtd writing mode is as follows:
 writing-mode (lr-tb | rl-tb | tb-rl | lr | rl | tb | inherit) #IMPLIED " >

so your mode is incorrect.

As you can see batik does not do anything with the different writing mode.
I'm not sure what the writing mode should do so I don't know if that is
incorrect.

On Wed, 09 May 2001 16:29:47 Alex McLintock wrote:
> Hi folks, 
> 
> I am trying to include some vertically written text in an SVG inside an
> FO file.
> It seems to be coming out as horizontal text.
> 
> I am essentially trying to draw some text so that it comes out like
> 
> H
> E
> L
> L
> O
> 
> and for that I am using some SVG something like
> 
> <svg:text x='0' y='0' writing-mode='tb-lr' >HELLO</svg:text>
> 
> (There is more SVG too which I have stripped out for this example.)
> 
> It is coming out like this
> 
> HELLO
> 
> 
> I can see some code in the FOP 0.18 source which attempts to read in
> the writing modes of "tb-lr" and others, but I am not sure it actually 
> does anything with that information.
> 
> Can anyone with some experience of the SVG code point me in the right
> direction.
> 
> I don't really understand how it all fits together.
> 
> My guess is that each character in the text is treated separately and
> joined together
> in a textGraph object using "appendChild". I assume that this somehow
> figures out
> where to position the next letter but I can't see it doing it. 
> 
> Before you ask - no I can't use an <fo:block> because this text needs to
> be within
> the SVG object.
> 
> Any help understanding the code would be appreciated because I could
> possibly help
> enhancing it afterwards :-)