[xep-support] Re: dy attribute in tspan ignored when text-anchor != start

From: Kevin Brown <kevin@renderx.com>
Date: Tue Mar 12 2013 - 17:24:43 PST

Darren:

 

Send me the SVG off list and I will take a look. It is unclear to me that
just because Chrome shows it the way they do, that is correct. The
definition of <tspan> says:

 

"Within a <http://www.w3.org/TR/SVG/text.html#TextElement> 'text' element,
text and font properties and the current text position
<http://www.w3.org/TR/SVG/text.html#CurrentTextPosition> can be adjusted
with absolute or relative coordinate values by including a 'tspan' element."

 

In my opinion, the "position" at the end location of that text string is
16px of blank space (your font-height) but I could be mistaken.

 

Kevin Brown

kevin@renderx.com

 

From: xep-support-bounces@renderx.com
[mailto:xep-support-bounces@renderx.com] On Behalf Of Darren Munt
Sent: Tuesday, March 12, 2013 6:07 PM
To: xep-support@renderx.com
Subject: [xep-support] dy attribute in tspan ignored when text-anchor !=
start

 

I tried with this one already but got no reply, perhaps because I included a
screenshot of the issue. I'll try again with text only.

 

When a tspan element has the text-anchor attribute set to anything other
than 'start', the dy attribute appears to be ignored. I am trying to align
text within a grid and I have left- and right-aligned labels which must
appear on the same y coordinate.

 

In order to support web browsers and RenderX from the same code, and because
they all use different baselines for text, I am using the dy attribute to
apply an offset from the y coordinate of the enclosing text element. This
allows all text to be positioned with a common set of coordinates, making
allowances for different implementations of SVG. However the issue I am
having is that RenderX appears to ignore the dy attribute for tspan elements
that are within text elements with a text-anchor attribute set to 'end' or
'center'.

 

The upshot is that using the same bit of code to set up a tspan element, I
get different y alignment when text-anchor is not 'start'. For example:

 

<text x="24" y="28" text-anchor="start" stroke="none" stroke-width="0"
fill="#5c477a" font-size="16px" font-weight="bold">

<tspan dy="16">Change Agent</tspan>

</text>

<text x="316" y="28" text-anchor="end" stroke="none" stroke-width="0"
fill="#5c477a" font-size="16px" font-weight="bold">

<tspan dy="16">Transformer</tspan>

</text>

 

According to my understanding, the above should produce two blocks of text
which are aligned horizontally on the page. However in RenderX, the second
line is 16 pixels (or the equivalent metric in the PDF) higher.

 

The same code in Google Chrome produces text that is horizontally aligned as
expected..

 

Can you advise if this issue will be resolved, or will I need to build in a
workaround?

 

!DSPAM:87,513fd1ef9851322784897!

_______________________________________________
(*) To unsubscribe, please visit http://lists.renderx.com/mailman/options/xep-support
(*) By using the Service, you expressly agree to these Terms of Service http://w
ww.renderx.com/terms-of-service.html
Received on Tue Mar 12 17:24:51 2013

This archive was generated by hypermail 2.1.8 : Tue Mar 12 2013 - 17:24:56 PST