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

Output blank png image when use custom font family in windows #80

Open
lrh3321 opened this issue Apr 17, 2024 · 3 comments · May be fixed by #83
Open

Output blank png image when use custom font family in windows #80

lrh3321 opened this issue Apr 17, 2024 · 3 comments · May be fixed by #83

Comments

@lrh3321
Copy link

lrh3321 commented Apr 17, 2024

Describe the bug

Output blank png image when use custom font family in windows

To Reproduce
Steps to reproduce the behavior:

  1. Execute freeze -x "echo Something" --font.family "Microsoft YaHei" -o freeze.png
  2. Execute explorer freeze.png

Expected behavior

Got an blank image.

Screenshots
If applicable, add screenshots to help explain your problem.
Snipaste_2024-04-17_20-49-36

Desktop (please complete the following information):

  • OS: Microsoft Windows
  • Browser chrome
  • Version 23H2 10.0.22635.3495

Additional context

Load the default fonts dir may help this

freeze/png.go

Lines 50 to 57 in 80803eb

err = fontdb.LoadFontData(font.JetBrainsMonoTTF)
if err != nil {
printErrorFatal("Unable to load font", err)
}
err = fontdb.LoadFontData(font.JetBrainsMonoNLTTF)
if err != nil {
printErrorFatal("Unable to load font", err)
}

fontdb.LoadFontsDir(OS_FONTS_DIR)
@lrh3321
Copy link
Author

lrh3321 commented Apr 17, 2024

--font.file option could not help for png format output.Seems embed font file has no effect for github.com/kanrichan/resvg-go .

@getify
Copy link

getify commented Jun 3, 2024

I am having the same problem -- using the linux build of freeze from inside wsl2 on windows 11 -- trying to specify font.family as "Source Code Pro", or setting font.file as the path to the "SourceCodePro-Regular.ttf" file in my windows\fonts directory. Either way, I get a blank .PNG file. If I use "JetBrains Mono" for the font.family, the file renders correctly (but with an undesirable font).

@divinedragon
Copy link

I am having the same problem -- using the linux build of freeze from inside wsl2 on windows 11 -- trying to specify font.family as "Source Code Pro", or setting font.file as the path to the "SourceCodePro-Regular.ttf" file in my windows\fonts directory. Either way, I get a blank .PNG file. If I use "JetBrains Mono" for the font.family, the file renders correctly (but with an undesirable font).

Same for me in Ubuntu 22.04

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

Successfully merging a pull request may close this issue.

3 participants