nerd-fonts icon indicating copy to clipboard operation
nerd-fonts copied to clipboard

font-patcher: Check if glyph source is available (`--glyphdownload`)

Open Finii opened this issue 4 years ago • 4 comments

[why] When users just download the script (and not the source glyphs) the script fails with an obscure error message.

[how] Check if the glyphdir exists at all. If not give a hint to download the glyphs.

Check if the individual glyph font exists and is readable. Bail out if not.

Add option --glyphdownload that tries to download missing glyph fonts.

Requirements / Checklist

What does this Pull Request (PR) do?

Add checks before we open a symbol font and give hints to the users if we can not.

How should this be manually tested?

  • Patch a font (shall work as before)
  • Remove one (needed) symbol font, patch a font again (errors out)
  • Remove complete src/glyphs/ (or use --glyphdir), patch a font again (errors out)

The two bottom cases a meaningful message should be printed.

  • Repeat the 3 tests but specify --glyphdownload. (all shall work)

Any background context you can provide?

For example #659 #662 #495

What are the relevant tickets (if any)?

Screenshots (if appropriate or helpful)

image

Edit: Add --glyphdownload as that has been added as 2nd commit to the PR

Finii avatar Dec 27 '21 14:12 Finii

Not sure if we want to go that route, but it is requested a lot it seems...:

Autodownload...

image

Finii avatar Dec 29 '21 00:12 Finii

Two notes:

  • Of course the first commit should be merged regardless
  • The second commit is kind of optional

If we go the route with the second commit there might be problems of font-patcher version versus actual repo version - when the glyph paths change. So in reality we should download the repo-glyph stuff from the version (and not MASTER) that the font-patcher actually is. But this is not possible at the moment because the versions are not increased even when the directory structure is changed. This might need more thinking and/or ideas. At least maybe a warning in the code when a download fails, that one needs to use the font-patcher HEAD.

Finii avatar Dec 29 '21 10:12 Finii

Rebase on master, force push.

One of the original commits is already in master.

Finii avatar Sep 07 '22 07:09 Finii

All readme files need to be corrected :stop_sign:

Finii avatar Sep 07 '22 07:09 Finii

Does this download the --makegroups stuff also? I guess not. Would that be beneficial, or just disable the feature? Who uses that feature?

Finii avatar Sep 30 '22 10:09 Finii

I believe we should promote the FontPatcher.zip instead. This would need to keep a parallel set of sub-files as for the zip generation. A lot of maintenance burden.

Finii avatar Jan 04 '23 17:01 Finii