This project has moved and is read-only. For the latest updates, please go here.

letter spacing

Topics: SVG, SVG# and Parsing, Texts and Fonts
Mar 7, 2012 at 2:21 PM
Edited Mar 8, 2012 at 1:40 PM

Hi,

I'm using this library as a svg render engine. I'm trying to load some svg files with texts and I see that the "letter-spacing" attribute has no effect. Are there any solutions?

I found also another problem: if I load a svg text with border I see the pen definition, and it's ok; if the text is over a path, the pen definition disappear and it's impossible to see the border in the xaml.

Thank you

Coordinator
Mar 11, 2012 at 1:08 PM

Hello,

I have not seen any problem with the letter-spacing as you can see in the test samples.
For this and the border issue, if you can create a simple test svg file for me, I will investigate
the issue.

Best regards,
Paul. 

Mar 12, 2012 at 8:22 AM
Edited Mar 12, 2012 at 8:23 AM

Hi Paul,

at the end of this message you can find the body of a svg file whit the problems which I exaplain.

 

I decided to modify directly your code and I saw that element.GetAttribute("letter-spacing"); return an empty value, so I've wrote a new function. After that I add this progress += LetterSpacing / _pathLength; to the progress value to shift the charters.

 

For the second problem when you write a text on path you use this method dc.DrawText(formText, _formattedOrigins[i]); that paint glyphs, but glyphs doesn't support stroke property so I changed it with  

Geometry textGeometry = formText.BuildGeometry(new Point(0,0));               

dc.DrawGeometry(Foreground, textPen, ExtractTextPathGeometry(textGeometry));

so texts always are drawed by paths, and paths support stroke.

 

Another problem that I found the last week was the bounds value of the objects: they go from 0 to a positive value, and if I've a shape with negative coordinates, it will crop. Today I'll try to solve this.

 

Bye,

Luca

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg   xmlns:dc="http://purl.org/dc/elements/1.1/"   xmlns:cc="http://creativecommons.org/ns#"   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"   xmlns:svg="http://www.w3.org/2000/svg"   xmlns="http://www.w3.org/2000/svg"   xmlns:xlink="http://www.w3.org/1999/xlink"   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"   id="svg2"   version="1.1"   inkscape:version="0.48.1 "   sodipodi:docname="newtext.svg">  <defs     id="defs4" />  <metadata     id="metadata7">    <rdf:RDF>      <cc:Work         rdf:about="">        <dc:format>image/svg+xml</dc:format>        <dc:type           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />        <dc:title></dc:title>      </cc:Work>    </rdf:RDF>  </metadata>  <g     inkscape:label="Livello 1"     inkscape:groupmode="layer"     id="layer1">    <text       xml:space="preserve"       style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:5px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:#00ffff;stroke-width:1;stroke-opacity:1;font-family:Arial;-inkscape-font-specification:Arial"       id="text2985"       sodipodi:linespacing="125%"><textPath         xlink:href="#path2992"         id="textPath2994">new text</textPath></text>    <path       sodipodi:type="arc"       style="fill:none;fill-opacity:1;stroke:#00ff00;stroke-width:0.12242937000000000;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"       id="path2992"       sodipodi:cx="106.25"       sodipodi:cy="135.04076"       sodipodi:rx="30.178572"       sodipodi:ry="30.892857"       d="m 136.42857,135.04076 a 30.178572,30.892857 0 1 1 -60.357142,0 30.178572,30.892857 0 1 1 60.357142,0 z"        />  </g></svg>

Coordinator
Mar 27, 2012 at 2:04 PM

Hello Luca,

Thanks for the information and the test file (wished you used the code feature of the Codeplex editor to display it formatted).

I will look into the problem, just give me a little more time.
I have started a new job, working with Java in the first project and I needed to update my Java knowledge, all my current books are even too old :(

Best regards,
Paul.