Skip to content

Add ability to embed SVG snippits into tags#75

Open
marcuswu wants to merge 1 commit intoajstarks:masterfrom
marcuswu:fix-textpath
Open

Add ability to embed SVG snippits into tags#75
marcuswu wants to merge 1 commit intoajstarks:masterfrom
marcuswu:fix-textpath

Conversation

@marcuswu
Copy link

This proposed change gives finer grained control over the produced XML by allowing tags that were produced by start / end functions to have their contents defined by a function that receives a temporary SVG object context.

This work can close #74 by allowing code like this:

canvas.TextFunc(func(s *svg.SVG) {	s.TextpathFunc("#topArc", func(s *svg.SVG) {	s.SpanFunc(func(s *svg.SVG) {	s.TextRaw("Some text here")	}, `dy="20.8"`, `x="0"`)	}, `startOffset="50%"`, `text-anchor="middle"`)	}, `font-size="25"`, `font-family="Salma Pro"`) 

This is backwards compatible, but as seen above, it can change how the library is used and the flow of the code when the library is used.

I implemented this pattern across all methods that exhibit the start / end pattern. It may or may not be necessary to do all of them, and in some cases it might produce invalid SVGs, but that was already possible with the library -- users should continue to be aware of what is valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant