ekot1 / DelphiSVG

Delphi SVG library
Other
95 stars 43 forks source link

can't open a svg from inkscape #4

Open mathesoft opened 6 years ago

mathesoft commented 6 years ago

Hi,

I use your SvgViewer for testing. I made a .svg with inkscape v0.92.3 - it breaks the load by

Element "text" enthält keinen einzelnen Textknoten

Trace: :768dc54f KERNELBASE.RaiseException + 0x58 Xml.XMLDoc.XMLDocError('Element "%s" enthält keinen einzelnen Textknoten',(...)) Xml.XMLDoc.TXMLNode.CheckTextNode Xml.XMLDoc.TXMLNode.GetText SVG.TSVGCustomText.ReadTextNodes(TXMLNode($328C500) as IXMLNode) SVG.TSVGText.ReadIn(TXMLNode($328C500) as IXMLNode) SVG.TSVGBasic.ReadChildren(TXMLNode($334D740) as IXMLNode) SVG.TSVGContainer.ReadIn(TXMLNode($334D740) as IXMLNode) SVG.TSVGBasic.ReadChildren(TXMLNode($334FA50) as IXMLNode) SVG.TSVG.ReadIn(TXMLNode($334FA50) as IXMLNode) SVG.TSVG.LoadFromText('<?xml version="1.0" encoding="UTF-8" standalone="no"?>'#$D#$A'<svg'#$D#$A' xmlns:osb="http: ................

Attached a simple sample (remove the extension .txt) inkscape.svg.txt

How to Solve?

ekot1 commented 6 years ago

Try now, it should be fixed

mathesoft commented 6 years ago

Ok, thank you! Now it open the file and display...

Hm.. try my other attached test-file, there is something wrong (I compare the output with Google Chrome, need that for Print the file). _test.svg.txt (Attachment also remove the ".txt")

I tried also to scale (FSVG.Scale). For some examples it works, other not.

procedure TForm1.PaintBox1Paint(Sender: TObject); begin if FSVG.Count > 0 then begin FSVG.Scale(2.315); FSVG.PaintTo(PaintBox1.Canvas.Handle, MakeRect(0.0, 0.0, FSVG.Width, FSVG.Height), nil, 0); end; end;

ekot1 commented 6 years ago

I've fixed couple of issues, but there are still some left with scaling and positioning