Skip to content

Commit

Permalink
Merge branch 'master' of github.com:tdewolff/canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Apr 17, 2024
2 parents 2d654ff + b731d22 commit 2506056
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion renderers/svg/svg.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ type Options struct {
Compression int
EmbedFonts bool
SubsetFonts bool
SizeUnits string
canvas.ImageEncoding
}

var DefaultOptions = Options{
EmbedFonts: true,
SubsetFonts: false, // TODO: enable when properly handling GPOS and GSUB tables
SizeUnits: "mm",
ImageEncoding: canvas.Lossless,
}

Expand Down Expand Up @@ -58,7 +60,7 @@ func New(w io.Writer, width, height float64, opts *Options) *SVG {
w, _ = gzip.NewWriterLevel(w, opts.Compression)
}

fmt.Fprintf(w, `<svg version="1.1" width="%vmm" height="%vmm" viewBox="0 0 %v %v" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">`, dec(width), dec(height), dec(width), dec(height))
fmt.Fprintf(w, `<svg version="1.1" width="%v%s" height="%v%s" viewBox="0 0 %v %v" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">`, dec(width), opts.SizeUnits, dec(height), opts.SizeUnits, dec(width), dec(height))
return &SVG{
w: w,
width: width,
Expand Down

0 comments on commit 2506056

Please sign in to comment.