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 Chris Bowditch <bo...@hotmail.com> on 2005/03/24 15:27:08 UTC

Overlapping characters

I have some SVG which displays incorrectly in Squiggle and in the PDF 
generated by the PDF transcoder.

The SVG represents a form with lines, boxes and text intermingled. I tried the 
SVG both with v1.5.1 and with the latest version, but a lot of the characters 
are overlapping one another.

The SVG makes use of CSS styles, and I thought maybe the problem was related 
to negative values for word-spacing and letter-spacing. However, changing them 
all to zero, didnt have mmuch affect. Then I noticed the SVG contained 
<svg:def> tags with <svg:font> and <svg:glyph> elements. So I thought that 
this may be the root cause of the problem, but removing the <svg:def> tag and 
all its children did not fix the problem, some characters still overlap 
adjacent ones?

Has anyone else seen this behaviour? I can supply the SVG if necessary but its 
about 115K.

Thanks,

Chris


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


Re: Overlapping characters

Posted by Andreas Neumann <ne...@karto.baug.ethz.ch>.
if you want to turn off the behaviour of Adobe Illustrator to add a lot 
of x or tspan values you have to turn off the text kerning features. 
Illustrator wants to enforce correct glyph placements by putting tspans 
or x values everywhere where two characters are involved in movements 
due to text-kerning.

If you want to turn text-kerning off  you should set the kerning from 
"Auto" to "0". You can do that in the "Type"--> "Character" panel in the 
extended options next to the icon "A|V" with the horizontal arrows.

Hope this helps,
Andreas


Chris Bowditch wrote:

> Thomas DeWeese wrote:
>
>> Hi Chris,
>
>
> Thanks for the quick reply.
>
>>
>> Chris Bowditch wrote:
>>
>>> I have some SVG which displays incorrectly in Squiggle and in the 
>>> PDF generated by the PDF transcoder.
>>
>>
>>
>>    By incorrectly you mean not the way you want it to?
>>    Or not the way the spec says it should.
>
>
> I mean the result was not as expected. The SVG was generated by Adobe 
> Illustrator (I think) or similar tool. It displays correctly in that 
> tool.
>
>>
>>> The SVG represents a form with lines, boxes and text intermingled. I 
>>> tried the SVG both with v1.5.1 and with the latest version, but a 
>>> lot of the characters are overlapping one another.
>>
>>
>>
>>    Does your text have the 'text-length' property set?
>
>
> No.
>
>>
>>> The SVG makes use of CSS styles, and I thought maybe the problem was 
>>> related to negative values for word-spacing and letter-spacing. 
>>> However, changing them all to zero, didnt have mmuch affect. Then I 
>>> noticed the SVG contained <svg:def> tags with <svg:font> and 
>>> <svg:glyph> elements. So I thought that this may be the root cause 
>>> of the problem, but removing the <svg:def> tag and all its children 
>>> did not fix the problem, some characters still overlap adjacent ones?
>>
>>
>>
>>    Actually having an svg font should improve the situation as all
>> compliant SVG renderers will use the same glyphs (as opposed to
>> depending on platform fonts which may have different metrics).
>
>
> Oh I see. Forgot to mention that although removing the custom glyph 
> definitions did not fix the problem it did improve the situation.
>
>>
>>> Has anyone else seen this behaviour? I can supply the SVG if 
>>> necessary but its about 115K.
>>
>>
>>
>>    Can you cut it down to just one or two text elements that show
>> the problem? (most help because then I don't have to try and
>> understand your SVG)
>
>
> I have managed to narrow problem right down. It seems to be caused by 
> tspan with lots of values in the x. Sample that exhibits behaviour below:
>
>     <svg:g transform="matrix(1 0 0 -1 0 792)">
>         <svg:text transform="matrix(1 0 0 -1 96 681.3)">
>             <svg:tspan 
> x="0,6.20844,8.86578,10.6373,15.0742,19.5111,23.948,26.1664,31.0422,32.8138,37.2506,41.6875,46.1244,50.1144,51.886,56.3228,58.0944,60.3128,64.7497,66.9682,71.405,73.6235,79.385,81.6035,83.8219,86.0404,88.2588,92.6957,97.1326,101.569,106.006,110.443,112.662,117.537,120.195,124.632,129.069,133.059,134.83,136.602,141.039,143.257,149.019,153.455,155.674,157.892,160.111,165.433,169.87,171.642,173.86,178.297,180.516,184.952,189.389,193.826,198.263,200.482,205.804,210.241,214.678,216.896,221.333,223.552,225.323,229.76,231.532,235.969,238.187,244.834,247.053,249.271,253.708,258.145,262.582,267.019" 
> y="0" class="ps02 ps12 ps22">XXXXX</svg:tspan>
>         </svg:text>
>     </svg:g>
>
>
> Thanks,
>
> Chris
>
>
> ---------------------------------------------------------------------
> 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


Re: Overlapping characters

Posted by Chris Bowditch <bo...@hotmail.com>.
Thomas DeWeese wrote:

>> Oh I see. Forgot to mention that although removing the custom glyph 
>> definitions did not fix the problem it did improve the situation.
> 
> 
>    This is odd, can you send the very top of the font defn?  Say
> the font element and one or two of the glyph elements?

	<svg:defs>
		<svg:font horiz-adv-x="0">
			<svg:font-face font-family="fnt0" units-per-em="2048" ascent="905" 
descent="-211"/>
			<svg:missing-glyph horiz-adv-x="0"/>
			<svg:glyph unicode=" " horiz-adv-x="569" d=""/>
			<svg:glyph unicode="$" horiz-adv-x="1138" 
d="M510,-211L510,-31Q375,-14,290,29Q206,73,144,170Q83,267,73,407L254,441Q275,296,328,228Q404,132,510,121L510,694Q399,715,283,780Q197,828,150,913Q104,998,104,1106Q104,1298,240,1417Q331,1497,510,1515L510,1601L616,1601L616,1515Q773,1500,865,1423Q983,1325,1007,1154L821,1126Q805,1232,754,1288Q704,1345,616,1363L616,844Q752,810,796,791Q880,754,933,701Q986,648,1014,575Q1043,502,1043,417Q1043,230,924,105Q805,-20,616,-29L616,-211L510,-211M510,1365Q405,1349,344,1281Q284,1213,284,1120Q284,1028,335,966Q387,904,510,867L510,1365M616,121Q721,134,789,212Q858,290,858,405Q858,503,809,562Q761,622,616,669L616,121"/>

> 
>> I have managed to narrow problem right down. It seems to be caused by 
>> tspan with lots of values in the x. Sample that exhibits behaviour below:
> 
> 
>    Ohh, well it's absolutely positioning the text, if there is any
> difference in the glyphs you will get all sorts of trouble.  I believe
> you can turn off the use of absolute positioning in Illustrator
> although the exact set of text options escapes me at the moment (you
> might Google it, it's something like tracking or the like).

Thanks, it seems pretty obvious now youve told me!!

> 
>    Did you do anything that might cause the CSS classes to not
> be defined (say by removing a 'style' element)? If say the font-size
> differs this will easily cause them to run together.

The full scenario is; one of our users pointed out that this SVG works with 
XEP and not with FOP. The CSS references the Arial font family. XEP probably 
uses the Font metrics defined in its config file, whilst the PDF Transcoder 
and Batik are probably using the Java AWT system, which is unlikely to match 
the metrics that Adobe Illustrator and XEP are working with.

Thanks for your help,

Chris


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


Re: Overlapping characters

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Chris,

Chris Bowditch wrote:

>>    Actually having an svg font should improve the situation as all
>> compliant SVG renderers will use the same glyphs (as opposed to
>> depending on platform fonts which may have different metrics).
> 
> Oh I see. Forgot to mention that although removing the custom glyph 
> definitions did not fix the problem it did improve the situation.

    This is odd, can you send the very top of the font defn?  Say
the font element and one or two of the glyph elements?

> I have managed to narrow problem right down. It seems to be caused by 
> tspan with lots of values in the x. Sample that exhibits behaviour below:

    Ohh, well it's absolutely positioning the text, if there is any
difference in the glyphs you will get all sorts of trouble.  I believe
you can turn off the use of absolute positioning in Illustrator
although the exact set of text options escapes me at the moment (you
might Google it, it's something like tracking or the like).

    Did you do anything that might cause the CSS classes to not
be defined (say by removing a 'style' element)? If say the font-size
differs this will easily cause them to run together.

>     <svg:g transform="matrix(1 0 0 -1 0 792)">
>         <svg:text transform="matrix(1 0 0 -1 96 681.3)">
>             <svg:tspan 
> x="0,6.20844,8.86578,10.6373,15.0742,19.5111,23.948,26.1664,31.0422,32.8138,37.2506,41.6875,46.1244,50.1144,51.886,56.3228,58.0944,60.3128,64.7497,66.9682,71.405,73.6235,79.385,81.6035,83.8219,86.0404,88.2588,92.6957,97.1326,101.569,106.006,110.443,112.662,117.537,120.195,124.632,129.069,133.059,134.83,136.602,141.039,143.257,149.019,153.455,155.674,157.892,160.111,165.433,169.87,171.642,173.86,178.297,180.516,184.952,189.389,193.826,198.263,200.482,205.804,210.241,214.678,216.896,221.333,223.552,225.323,229.76,231.532,235.969,238.187,244.834,247.053,249.271,253.708,258.145,262.582,267.019" 
> y="0" class="ps02 ps12 ps22">XXXXX</svg:tspan>
>         </svg:text>
>     </svg:g>
> 
> 
> Thanks,
> 
> Chris
> 
> 
> ---------------------------------------------------------------------
> 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


Re: Overlapping characters

Posted by Chris Bowditch <bo...@hotmail.com>.
Thomas DeWeese wrote:

> Hi Chris,

Thanks for the quick reply.

> 
> Chris Bowditch wrote:
> 
>> I have some SVG which displays incorrectly in Squiggle and in the PDF 
>> generated by the PDF transcoder.
> 
> 
>    By incorrectly you mean not the way you want it to?
>    Or not the way the spec says it should.

I mean the result was not as expected. The SVG was generated by Adobe 
Illustrator (I think) or similar tool. It displays correctly in that tool.

> 
>> The SVG represents a form with lines, boxes and text intermingled. I 
>> tried the SVG both with v1.5.1 and with the latest version, but a lot 
>> of the characters are overlapping one another.
> 
> 
>    Does your text have the 'text-length' property set?

No.

> 
>> The SVG makes use of CSS styles, and I thought maybe the problem was 
>> related to negative values for word-spacing and letter-spacing. 
>> However, changing them all to zero, didnt have mmuch affect. Then I 
>> noticed the SVG contained <svg:def> tags with <svg:font> and 
>> <svg:glyph> elements. So I thought that this may be the root cause of 
>> the problem, but removing the <svg:def> tag and all its children did 
>> not fix the problem, some characters still overlap adjacent ones?
> 
> 
>    Actually having an svg font should improve the situation as all
> compliant SVG renderers will use the same glyphs (as opposed to
> depending on platform fonts which may have different metrics).

Oh I see. Forgot to mention that although removing the custom glyph 
definitions did not fix the problem it did improve the situation.

> 
>> Has anyone else seen this behaviour? I can supply the SVG if necessary 
>> but its about 115K.
> 
> 
>    Can you cut it down to just one or two text elements that show
> the problem? (most help because then I don't have to try and
> understand your SVG)

I have managed to narrow problem right down. It seems to be caused by tspan 
with lots of values in the x. Sample that exhibits behaviour below:

	<svg:g transform="matrix(1 0 0 -1 0 792)">
		<svg:text transform="matrix(1 0 0 -1 96 681.3)">
			<svg:tspan 
x="0,6.20844,8.86578,10.6373,15.0742,19.5111,23.948,26.1664,31.0422,32.8138,37.2506,41.6875,46.1244,50.1144,51.886,56.3228,58.0944,60.3128,64.7497,66.9682,71.405,73.6235,79.385,81.6035,83.8219,86.0404,88.2588,92.6957,97.1326,101.569,106.006,110.443,112.662,117.537,120.195,124.632,129.069,133.059,134.83,136.602,141.039,143.257,149.019,153.455,155.674,157.892,160.111,165.433,169.87,171.642,173.86,178.297,180.516,184.952,189.389,193.826,198.263,200.482,205.804,210.241,214.678,216.896,221.333,223.552,225.323,229.76,231.532,235.969,238.187,244.834,247.053,249.271,253.708,258.145,262.582,267.019" 
y="0" class="ps02 ps12 ps22">XXXXX</svg:tspan>
		</svg:text>
	</svg:g>


Thanks,

Chris


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


Re: Overlapping characters

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Chris,

Chris Bowditch wrote:
> I have some SVG which displays incorrectly in Squiggle and in the PDF 
> generated by the PDF transcoder.

    By incorrectly you mean not the way you want it to?
    Or not the way the spec says it should.

> The SVG represents a form with lines, boxes and text intermingled. I 
> tried the SVG both with v1.5.1 and with the latest version, but a lot of 
> the characters are overlapping one another.

    Does your text have the 'text-length' property set?

> The SVG makes use of CSS styles, and I thought maybe the problem was 
> related to negative values for word-spacing and letter-spacing. However, 
> changing them all to zero, didnt have mmuch affect. Then I noticed the 
> SVG contained <svg:def> tags with <svg:font> and <svg:glyph> elements. 
> So I thought that this may be the root cause of the problem, but 
> removing the <svg:def> tag and all its children did not fix the problem, 
> some characters still overlap adjacent ones?

    Actually having an svg font should improve the situation as all
compliant SVG renderers will use the same glyphs (as opposed to
depending on platform fonts which may have different metrics).

> Has anyone else seen this behaviour? I can supply the SVG if necessary 
> but its about 115K.

    Can you cut it down to just one or two text elements that show
the problem? (most help because then I don't have to try and
understand your SVG)

    If you can't reproduce it in a small test case you can also email
me directly although it will probably take longer for me to get
around to looking at it.

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