xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DeWeese Thomas <thomas.dewe...@gmail.com>
Subject Re: TextPainter
Date Thu, 14 Feb 2013 11:00:09 GMT
Hi Barry,
    I'm not aware of a way to do this that doesn't involve writing a lot of code. The two
main paths would be to write an implementation of Graphics2D that can try and turn GlyphVectors
back into text (hard because a GlyphVector may include ligatures where the mapping between
text and glyphs isn't 1:1, and the JDK  doesn't actually provide the info you need to do the
back mapping from GlyphID to code point when it is possible), or to modify the SVG Text rendering
so that internally it recognizes simple text and skips the glyph vector and uses a simple
drawString.

    Thomas

On Feb 13, 2013, at 7:24 PM, Barry Kreiser <barry@guild1.com> wrote:

> thanks Thomas.
> 
> I guess that I am wondering how I can get the Java2D implementation of the Graphics2D
to render the SVG as text values instead of outlines.  I am drawing some SVG along with native
Java2D calls but then when I render all of that to another svg some of the text shows up as
strokes while the text that I drew using drawString shows up as SVG text objects.
> 
> So
> 
> SVG & Native Java2D -----> Into a Swing Canvas -----> Back to SVG ---> And
then on to PDF via FOP and XSL
> _______________________________________________
> 
> 
> On 2013-02-13, at 5:11 PM, DeWeese Thomas <thomas.deweese@gmail.com> wrote:
> 
>> Hi Barry,
>>   The PDF Transcoder using code from FOP doesn't have a full StrokingTextPainter
(which doesn't really mean what you think it means) implementation but it tries to detect
"simple" text and render that with drawString.
>> 
>>   FYI the StrokingTextPainter doesn't generally draw all text as outlines but it
does draw it as GlyphVectors which is really required to implement all of the text effects
required by the SVG standard (and most Graphics2D implementations turn those into Outlines)
.  It's called StrokingTextPainter because it can, optionally, stroke the text it renders
(meaning draw a fat line around the outline of the text, which does need to be done as outlines).
>> 
>>   Hope that helps.
>> 
>> On Feb 12, 2013, at 6:13 PM, Barry Kreiser <barry@guild1.com> wrote:
>> 
>>> Are there any existing TextPainter implementations that will use native Java2D
font rendering
>>> in the case where I am rendering SVG to a SunGraphics2D?
>>> 
>>> I am drawing SVG into a swing canvas and then taking the swing canvas to PDF.
 I end up getting
>>> stroked text in the PDF and have determined that when the render to SunGraphics2D
happens it uses
>>> the StrokingTextPainter.
>>> 
>>> Barry
>>> ---------------------------------------------------------------------
>>> 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