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

Improvement to output files #184

Open
WillianBR opened this issue Feb 13, 2023 · 2 comments
Open

Improvement to output files #184

WillianBR opened this issue Feb 13, 2023 · 2 comments

Comments

@WillianBR
Copy link

@fogleman,

I have noticed many examples from "fogleman/gg" save it output image file to "out.png".

That can be tricky!

I would like to suggest two additional lines, who it'll save the PNG with the same name of executable. Changing the extension only!

outPNG := strings.ReplaceAll(filepath.Base(os.Args[0]), filepath.Ext(os.Args[0]), ".png")
dc.SavePNG(outPNG)

I have the habit of build all the samples and test it one at the time.
But this litlte folks overwrite the old output file.

@WillianBR
Copy link
Author

Font file issue into "scatter.go"

I also noticed you are using a Apple computer with Mac OSX.
So you hard coded the font file path.

  • /Library/Fonts/Arial Bold.ttf

  • /Library/Fonts/Arial.ttf

I suggest you get a free truetype font and include it into the repository. Than your code can localy load it and use!

Otherwise your code will compile on Linux and Windows, but it'll runtime panic!

panic: open /Library/Fonts/Arial.ttf: The system cannot find the path specified.

@sbinet
Copy link

sbinet commented May 11, 2023

this has been fixed in "my" fork of gg:

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

No branches or pull requests

2 participants