You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Vossler T <vo...@gmail.com> on 2008/08/08 08:54:52 UTC

Re: Text layout with Batik

Hi Cameron ,

I tried to download flowText.svg and resource/style/test.css,

I download above files to local pc  and tried to use batik convert to jpg,
It is doing ok, however, why css's font don;t work correctly?  I changed
font to , of course I did put that font in D:\Java\jre6\lib\fonts, but
everytime textflow only convert to system default's font such as arial.

Thanks in advance.



http://svn.apache.org/repos/asf/xmlgraphics/batik/trunk/samples/tests/spec12/text/flowText.svg


Cameron McCormack-4 wrote:
> 
> Hi Andy.
> 
> Andy Hall:
>> I'm currently writing a small Java tool for generating SVG files from  
>> a set of data.  At the moment I have am generating the SVG in a  
>> rather naive way, by sticking data values into a SVG template, which  
>> works well enough for the structures I'm generating.  However I will  
>> need to add text to the images, more specifically variable length  
>> lines of text.  I require this text to be word wrapped within a  
>> defined area and for separate blocks of text to be stacked on top of  
>> each other.
>> 
>> I've been planning on using Batik's swing component for the purpose  
>> of previewing these images, but I was wondering if I would be able to  
>> solve my text problem with Batik's other components.
>> 
>> I'd be really grateful if someone could point me in the right direction.
> 
> You have two choices for laying out text in SVG.  The first is to write
> some script that will determine the linebreaks and lay out the text
> manually.  For a greedy text layout (try to put the next word on the
> line, and if it overflows the desired maximum line width, put a line
> break there) this is not too hard.  This will be compatible with other
> SVG 1.1 implementations.
> 
> Alternatively, you can use Batik’s flowText support.  Here’s an example:
> 
>  
> http://svn.apache.org/repos/asf/xmlgraphics/batik/trunk/samples/tests/spec12/text/flowText.svg
> 
> Note that this syntax for flowing text comes from a draft of SVG 1.2
> Full, which will likely change at some point.
> 
> Cameron
> 
> -- 
> Cameron McCormack, http://mcc.id.au/
> 	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Text-layout-with-Batik-tp8928258p18886594.html
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: Text layout with Batik

Posted by th...@kodak.com.
Hi Vossler,

Vossler T <vo...@gmail.com> wrote on 08/08/2008 02:54:52 AM:

> why css's font don;t work correctly?

    Well I think they do...

> I changed font to , of course I did put that font in 
D:\Java\jre6\lib\fonts, 
> but everytime textflow only convert to system default's font such as 
arial.

   Well first I'm not sure what you changed font to since it seems to have
gotten lost.  Second there is a chance that the font is in a format that 
Java 
doesn't support (i.e. anything but TrueType?).  Third to be honest I'm not 
sure how java 
adds fonts to it's list of platform fonts (so just adding it to lib/fonts 
might 
not be enough).  I typically point the SVG directly at the font with 
something 
like (taken from samples/tests/spec/fonts/fontFace.svg):

    @font-face { font-family: "CSS Batik TrueType"; 
                 src: url(../../resources/ttf/glb12.ttf); }

   I hope that helps.

> Cameron McCormack-4 wrote:
> > 
> > Hi Andy.
> > 
> > Andy Hall:
> >> I'm currently writing a small Java tool for generating SVG files from 
 
> >> a set of data.  At the moment I have am generating the SVG in a 
> >> rather naive way, by sticking data values into a SVG template, which 
> >> works well enough for the structures I'm generating.  However I will 
> >> need to add text to the images, more specifically variable length 
> >> lines of text.  I require this text to be word wrapped within a 
> >> defined area and for separate blocks of text to be stacked on top of 
> >> each other.
> >> 
> >> I've been planning on using Batik's swing component for the purpose 
> >> of previewing these images, but I was wondering if I would be able to 
 
> >> solve my text problem with Batik's other components.
> >> 
> >> I'd be really grateful if someone could point me in the right 
direction.
> > 
> > You have two choices for laying out text in SVG.  The first is to 
write
> > some script that will determine the linebreaks and lay out the text
> > manually.  For a greedy text layout (try to put the next word on the
> > line, and if it overflows the desired maximum line width, put a line
> > break there) this is not too hard.  This will be compatible with other
> > SVG 1.1 implementations.
> > 
> > Alternatively, you can use Batik?s flowText support.  Here?s an 
example:
> > 
> > 
> > http://svn.apache.
> 
org/repos/asf/xmlgraphics/batik/trunk/samples/tests/spec12/text/flowText.svg
> > 
> > Note that this syntax for flowing text comes from a draft of SVG 1.2
> > Full, which will likely change at some point.
> > 
> > Cameron
> > 
> > -- 
> > Cameron McCormack, http://mcc.id.au/
> >    xmpp:heycam@jabber.org  ?  ICQ 26955922  ?  MSN cam@mcc.id.au
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Text-layout-
> with-Batik-tp8928258p18886594.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>