Open davidak opened 4 years ago
Do you know of any tool which can can produce an image?
I know pango-view
, which can be used from the command line but I don't think it can output an image.
Do you know of any tool which can can produce an image?
No, i would have to do research.
pango-view can output images with --no-display --output=foo.png
.
There is also ImageMagick, even simpler since I think you can just copy his script: https://dev.to/danburzo/how-to-make-png-font-samples-with-imagemagick-part-1-29p8
A better test might be rendering in a browser and taking a screenshot, like here, but this requires a VM and messing around with fc-list
to find the font name, so probably isn't worth it.
I did a little research. pango-view don't work.
A very good option seems FontForges fontimage. It is actively maintained and supports pfa, pfb, pt3, sfd, ttf, otf, otb, t42, cef, cff, gsf, ttc, svg, ik, mf, woff and bdf files and possibly more.
fontimage --o font.png --fontname --text "The quick brown fox jumps over the lazy dog." ~/.nix-profile/share/fonts/truetype/FiraCode-Bold.ttf
Another option might be fontpreview. It's just a bash script and supports .otf, .ttf and .woff.
Google Fonts maintains a bunch of font QA tools like fontbakery, pyfontaine, gftools, etc. Some of them may be useful for us too.
I marked this as stale due to inactivity. → More info
I have done a review of a font update PR by building it locally and previewing the font. (https://github.com/NixOS/nixpkgs/pull/93028#pullrequestreview-447965877)
We can automate that by:
Then a reviewer just has to look at the PR if the font is rendered. When any error happens, it will not render and automated test fail.