NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.65k stars 13.8k forks source link

Simplify font PR review #93108

Open davidak opened 4 years ago

davidak commented 4 years ago

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.

rnhmjoj commented 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.

davidak commented 4 years ago

Do you know of any tool which can can produce an image?

No, i would have to do research.

Mathnerd314 commented 4 years ago

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.

davidak commented 4 years ago

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

font

Another option might be fontpreview. It's just a bash script and supports .otf, .ttf and .woff.

Screenshot from 2020-07-20 16-45-47

omasanori commented 3 years ago

Google Fonts maintains a bunch of font QA tools like fontbakery, pyfontaine, gftools, etc. Some of them may be useful for us too.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info