switch to own SVG of the Swiss cross
Compared to the Adobe Illustrator-exported version from SIX, this version is defined on a 166px x 166px viewbox, which are the recommended dimensions with which the cross should be overlaid on top of QR codes. This versions visually matches the PNG version from SIX when rendered onto the same pixel size (166px x 166px). But, this version scales better! The SIX version does not render correctly. My guess is that it might have to do with their use of floating point coordinates.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -14,4 +14,4 @@
|
||||
|
||||
package qrbill
|
||||
|
||||
//go:generate sh -c "go run third_party/goembed/goembed.go -package qrbill -var swisscross third_party/swiss-cross/CH-Kreuz_7mm/CH-Kreuz_7mm.png third_party/swiss-cross/CH-Kreuz_7mm/CH-Kreuz_7mm.svg > GENERATED_swisscross.go && gofmt -w GENERATED_swisscross.go"
|
||||
//go:generate sh -c "go run third_party/goembed/goembed.go -package qrbill -var swisscross third_party/swiss-cross/CH-Kreuz_7mm/CH-Kreuz_7mm.png third_party/swiss-cross/CH-Kreuz_7mm/CH-Kreuz_7mm.svg swisscross.svg > GENERATED_swisscross.go && gofmt -w GENERATED_swisscross.go"
|
||||
|
||||
@@ -277,11 +277,11 @@ func (b *Bill) EncodeToSVG() ([]byte, error) {
|
||||
}
|
||||
|
||||
// overlay the swiss cross
|
||||
cross := swisscross["third_party/swiss-cross/CH-Kreuz_7mm/CH-Kreuz_7mm.svg"]
|
||||
cross := swisscross["swisscross.svg"]
|
||||
// Remove XML document header, we embed the <svg> element:
|
||||
cross = bytes.ReplaceAll(cross, []byte(`<?xml version="1.0" encoding="utf-8"?>`), nil)
|
||||
// Overwrite position and size of the embedded <svg> element:
|
||||
cross = bytes.ReplaceAll(cross, []byte(`x="0px" y="0px"`), []byte(`x="549" y="549" width="166" height="166"`))
|
||||
cross = bytes.ReplaceAll(cross, []byte(`<svg x="0" y="0" width="166" height="166"`), []byte(`<svg x="549" y="549" width="166" height="166"`))
|
||||
|
||||
// Inject the swiss cross into the <svg> document:
|
||||
return bytes.ReplaceAll(qrCodeSVG, []byte(`</g>`), append(cross, []byte("</g>")...)), nil
|
||||
|
||||
7
swisscross.svg
Normal file
7
swisscross.svg
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg x="0" y="0" width="166" height="166" viewBox="0 0 166 166" version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="0" y="0" width="166" height="166" fill="white"></rect>
|
||||
<rect x="12" y="12" width="142" height="142" fill="black"></rect>
|
||||
<rect x="36" y="66" width="94" height="28" fill="white"></rect>
|
||||
<rect x="68" y="34" width="30" height="92" fill="white"></rect>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 445 B |
Reference in New Issue
Block a user