Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to embed SVG snippits into tags #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to add attributes to textpath instead of the parent text node
1 participant