xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ing. Angel Monticelli" <an...@arzion.com>
Subject RE: Convert element to curves
Date Tue, 13 Sep 2005 19:52:38 GMT
Ok, I 'll try to explain it again.
I want to write text and convert to curves and save it as a SVG. In the
middle of that, I need to apply some transformations. I have some code
working right now, but it's a little messy. It's some like this:

Shape txt;
TextLayout textTl = new TextLayout("Que lo pario: Arzion!", new
Font("BernhardFashion BT", 1, 96), new FontRenderContext(null, false,
false));
AffineTransform textAt = new AffineTransform();
textAt.translate(0, (float)textTl.getBounds().getHeight());
txt = textTl.getOutline(textAt);
GeneralPath gpath=new GeneralPath(txt);

The I use logic with a PathIterator to view all the segments and
generate a String with de M C Q L H and Z commands of the g element of
SVG.

But I think itsn't the best way to do it and the less easy. What do you
think?

I will thanks any help!

Thanks again,

Angel.




-----Mensaje original-----
De: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com] 
Enviado el: martes, 13 de septiembre de 2005 16:38
Para: batik-users@xmlgraphics.apache.org
Asunto: Re: Convert element to curves


Hi Angel,

Ing. Angel Monticelli wrote:

> I'm trying this code but I can't make it works... Please gime a hand! 
> :D
> 
> Shape shapTxt;
> TextLayout txtTl = new TextLayout("Hello World!", new 
> Font("BernhardFashion BT", 1, 96), new FontRenderContext(null, false, 
> false));
> 
> ... And then?? How can I use 	GraphicsNode???

   There is no SVG here, so there is no use of GraphicsNode. Tonny was
talking about getting the outline of a complex SVG text element.

   If you want to turn Java2D text into outlines you can use
TextLayout.getOutline, however this has nothing to do with Batik:

shapTxt = txtTl.getOutline();

   If you want to output this to SVG then you will want to
look at the batik.svggen.SVGGraphics2D class where you
can draw your outlines as Java2D shapes and it will generate appropriate
SVG 'path' element(s).

> Thank you!
> Oh, by the way, do you know any way to apply 2D effects like 
> perspective? Thanks again!

    Perspective is not a 2D effect, it is a 3D effect.  It is difficult
to apply Perspective and other weird effects to complex geometry and
keep the geometry as 'curves' because the effects do not map spline to
spline.  If you are willing to flatten the data then this becomes a
simple matter of mapping points.


> 
> Angel
> 
> -----Mensaje original-----
> De: Tonny Kohar [mailto:tonny@kiyut.com]
> Enviado el: martes, 13 de septiembre de 2005 14:21
> Para: batik-users@xmlgraphics.apache.org
> Asunto: Re: Convert element to curves
> 
> 
> Hi,
> 
> On Tue, 2005-09-13 at 11:16 -0300, Ing. Angel Monticelli wrote:
> 
>>Hi everyone!
>> 
>>I've trying to use Batik lib to convert text to path (text to curves
>>transformation), but I can't do it. I need some help of experienced 
>>users please!
> 
> 
> If you do not mind using Batik GVT part instead of pure SVG DOM, you 
> could convert text,rect,circle,etc to path by eg:
> 
> GraphicsNode gvtNode = bridgeContext.getGraphicsNode(txtElement);
> Shape s = gvtNode.getOutline();
> 
> Regards
> Tonny Kohar


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




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


Mime
View raw message