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 Jeremias Maerki <de...@jeremias-maerki.ch> on 2008/11/17 11:25:19 UTC

Fw: SVG Text rendering

I'm forwarding this to batik-users as this doesn't seem to be an issue
with code in FOP. Even when viewed in Squiggle, the attached file ends
up blank (1.7 and trunk).

I noticed that I get the desired output if I wrap each textPath element
in its own text element. I'm not sure if this is a Batik problem or not.


Forwarded by Jeremias Maerki <de...@jeremias-maerki.ch>
----------------------- Original Message -----------------------
 From:    Martin Jacobson <ja...@gmail.com>
 To:      fop-users@xmlgraphics.apache.org
 Date:    Mon, 17 Nov 2008 09:34:48 +0000
 Subject: Re: SVG Text rendering
----


On 15 Nov 2008, at 08:16, Jeremias Maerki wrote:
>
>> obviously, the pdf doesn't respect the font spec in the style sheet.
>> Furthermore, its treatment of text on a path is no better than  
>> before;
>> viz three textPaths are rendered, out of around 100.
>
> Ok, in that case we're at a point where I'll ask you to send me a test
> file that I can run. In my tests, text on a path was painted as text.
> But there are still situations (for example with filter operations)
> where this is not possible and Batik produces the text internally  
> using
> bitmaps. If I can take a look at your test files, I can tell you  
> exactly
> it doesn't work in any special case.


OK, here is the command I used...

Martin:Batik martin$ java -jar batik-rasterizer.jar -m application/pdf  
-d ~/Desktop/batik-test.pdf ~/Desktop/batik-test.svg
About to transcode 1 SVG file(s)

Converting batik-test.svg to /Users/martin/Desktop/batik- 
test.pdf ... ... success
Martin:Batik martin$



I attach the test file: a set of roads in London's West End. Viewing  
this in Safari or Firefox gives you an idea of what I expect. The pdf  
I get from batik shows a complete blank.

I hope this helps - thanks for your time!

Martin


--------------------- Original Message Ends --------------------


Jeremias Maerki

Re: Fw: SVG Text rendering

Posted by Helder Magalhães <he...@gmail.com>.
> I attach the test file: a set of roads in London's West End. Viewing
> this in Safari or Firefox gives you an idea of what I expect. The pdf
> I get from batik shows a complete blank.

Opening the file using Squiggle also shows a blank document. Opening
it using Firefox and Opera renders the text as expected (?).

By analyzing the document and making some experiments, it seems that
the text nodes (implicitly created by the XML indentation used) are
confusing Batik. It seems that the horizontal position of each
"textPath" isn't tracked down separately within a single "text"
element. More information can be found in the attached test case
("ReducedTestCase.svg"): the text "KO" is horizontally placed
immediately after "broken" although it should start at the beginning
of the path (left aligned). Unfortunately, I haven't found information
within the specification supporting this - are "textPath" supposed to
be capable of this within a single "text" element?. Several working
cases are also available (though commented) within the test case.

Current workarounds seem to be:
 - Remove all indenting white space ("Workaround-AvoidIndenting.svg")
 - Enclosing each "textPath" element in its own "text" element
("Workaround-UseASeparateTextElementForEachTextPath.svg");

This may have (though pretty unrelated) have something to do with bug 45723 [2].

Hope this helps,

 Helder Magalh�es


[1] http://www.w3.org/TR/SVG/text.html#TextPathElement
[2] https://issues.apache.org/bugzilla/show_bug.cgi?id=45723

Re: Fw: SVG Text rendering

Posted by Martin Jacobson <ja...@gmail.com>.
Well, what do you know - that does the trick! Wrapping each <textPath>
element in its own <text> gives me correct output. There may be
stylesheet issues to be resolved later, but at least the text now
appears!

Brilliant! Thanks!
Martin

2008/11/17 Jeremias Maerki <de...@jeremias-maerki.ch>:
> I'm forwarding this to batik-users as this doesn't seem to be an issue
> with code in FOP. Even when viewed in Squiggle, the attached file ends
> up blank (1.7 and trunk).
>
> I noticed that I get the desired output if I wrap each textPath element
> in its own text element. I'm not sure if this is a Batik problem or not.
>
>
> Forwarded by Jeremias Maerki <de...@jeremias-maerki.ch>
> ----------------------- Original Message -----------------------
>  From:    Martin Jacobson <ja...@gmail.com>
>  To:      fop-users@xmlgraphics.apache.org
>  Date:    Mon, 17 Nov 2008 09:34:48 +0000
>  Subject: Re: SVG Text rendering
> ----
>
>
> On 15 Nov 2008, at 08:16, Jeremias Maerki wrote:
>>
>>> obviously, the pdf doesn't respect the font spec in the style sheet.
>>> Furthermore, its treatment of text on a path is no better than
>>> before;
>>> viz three textPaths are rendered, out of around 100.
>>
>> Ok, in that case we're at a point where I'll ask you to send me a test
>> file that I can run. In my tests, text on a path was painted as text.
>> But there are still situations (for example with filter operations)
>> where this is not possible and Batik produces the text internally
>> using
>> bitmaps. If I can take a look at your test files, I can tell you
>> exactly
>> it doesn't work in any special case.
>
>
> OK, here is the command I used...
>
> Martin:Batik martin$ java -jar batik-rasterizer.jar -m application/pdf
> -d ~/Desktop/batik-test.pdf ~/Desktop/batik-test.svg
> About to transcode 1 SVG file(s)
>
> Converting batik-test.svg to /Users/martin/Desktop/batik-
> test.pdf ... ... success
> Martin:Batik martin$
>
>
>
> I attach the test file: a set of roads in London's West End. Viewing
> this in Safari or Firefox gives you an idea of what I expect. The pdf
> I get from batik shows a complete blank.
>
> I hope this helps - thanks for your time!
>
> Martin
>
>
> --------------------- Original Message Ends --------------------
>
>
> 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: Fw: SVG Text rendering

Posted by Helder Magalhães <he...@gmail.com>.
> I attach the test file: a set of roads in London's West End. Viewing
> this in Safari or Firefox gives you an idea of what I expect. The pdf
> I get from batik shows a complete blank.

Opening the file using Squiggle also shows a blank document. Opening
it using Firefox and Opera renders the text as expected (?).

By analyzing the document and making some experiments, it seems that
the text nodes (implicitly created by the XML indentation used) are
confusing Batik. It seems that the horizontal position of each
"textPath" isn't tracked down separately within a single "text"
element. More information can be found in the attached test case
("ReducedTestCase.svg"): the text "KO" is horizontally placed
immediately after "broken" although it should start at the beginning
of the path (left aligned). Unfortunately, I haven't found information
within the specification supporting this - are "textPath" supposed to
be capable of this within a single "text" element?. Several working
cases are also available (though commented) within the test case.

Current workarounds seem to be:
 - Remove all indenting white space ("Workaround-AvoidIndenting.svg")
 - Enclosing each "textPath" element in its own "text" element
("Workaround-UseASeparateTextElementForEachTextPath.svg");

This may have (though pretty unrelated) have something to do with bug 45723 [2].

Hope this helps,

 Helder Magalhães


[1] http://www.w3.org/TR/SVG/text.html#TextPathElement
[2] https://issues.apache.org/bugzilla/show_bug.cgi?id=45723