-
-
Notifications
You must be signed in to change notification settings - Fork 102
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 SVG marker support #242
Conversation
font.go
Outdated
@@ -118,10 +117,11 @@ var sysfontFinder = struct { | |||
func FindLocalFont(name string, style FontStyle) string { | |||
// TODO: use style to match font | |||
// try with fc-match first | |||
filename, err := exec.Command("fc-match", "--format=%{file}", name).Output() | |||
// TODO: this causes a panic on Linux "panic: requested font style not found" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This optimization was causing problems on my end on Linux with svg's generated from graphviz. There was the panic shown here in the comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is because the fc-match is returning old X11 fonts on my system, which causes problems further down the line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a custom system font finder with b78baf2, let me know how that goes.
@@ -344,91 +399,64 @@ func (svg *svgParser) skipToEndTag(l *xml.Lexer, tt xml.TokenType) xml.TokenType | |||
return tt | |||
} | |||
|
|||
func (svg *svgParser) parseDefs(l *xml.Lexer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section was causing the elemStack to get corrupted. I have styles on one of my svg files that make reference to the top svg element and they would never accept the elements because that element was missing from the stack. I hope that this rearrangement is a little less error prone.
dc1e972
to
a541df0
Compare
Include qualified selector styles when performing styling Fix problem with unsupported font is used from fc-match in FindLocalFont. Unescape XML encoded strings for text. Default font-size medium absolute size to the default font size.
I've just merged some changes to support markers, it will need some polishing though. Let me know if that works. I've incorporated many of your changes and fixes as well. |
There are a few regressions from the svg examples I have on my end. I'll see what I can do to figure out what goes wrong with the latest changes. Perhaps there could be some test cases that could help with this. |
I think the main problem I'm seeing is that if there are markers then everything behind gets erased. Also, the scaling of the overall canvas is off suddenly. The fill color of the markers is sometimes different than the outline, and that's not getting picked up either. This is and SVG I'm trying at the top of this page: This is what it looks like with the latest changes rendered in gioui: |
Pushed out some fixes, your example works on my end, let me know how it goes! |
Include qualified selector styles when performing styling
Fix problem with unsupported font is used from fc-match in
FindLocalFont.
Unescape XML encoded strings for text.
Default font-size medium absolute size to the default font
size.