-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: allow for multi-line attribution strings. Closes #73
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// This is an example on how to use a multiline attribution string. | ||
|
||
package main | ||
|
||
import ( | ||
sm "github.com/flopp/go-staticmaps" | ||
"github.com/fogleman/gg" | ||
"github.com/golang/geo/s2" | ||
) | ||
|
||
func main() { | ||
ctx := sm.NewContext() | ||
ctx.SetSize(400, 300) | ||
ctx.OverrideAttribution("This is a\nmulti-line\nattribution string.") | ||
ctx.SetCenter(s2.LatLngFromDegrees(48, 7.9)) | ||
ctx.SetZoom(13) | ||
|
||
img, err := ctx.Render() | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
if err := gg.SavePNG("multiline-attribution.png", img); err != nil { | ||
panic(err) | ||
} | ||
} |