mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-12 09:41:47 +02:00
font-patcher: Check if glyph source is available
[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. [note] Cherry picked, was part of #741 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
7cda326515
commit
f97d729b34
1 changed files with 10 additions and 0 deletions
10
font-patcher
10
font-patcher
|
@ -218,6 +218,10 @@ class font_patcher:
|
|||
PreviousSymbolFilename = ""
|
||||
symfont = None
|
||||
|
||||
if not os.path.isdir(self.args.glyphdir):
|
||||
sys.exit("{}: Can not find symbol glyph directory {} "
|
||||
"(probably you need to download the src/glyphs/ directory?)".format(projectName, self.args.glyphdir))
|
||||
|
||||
for patch in self.patch_set:
|
||||
if patch['Enabled']:
|
||||
if PreviousSymbolFilename != patch['Filename']:
|
||||
|
@ -225,6 +229,12 @@ class font_patcher:
|
|||
if symfont:
|
||||
symfont.close()
|
||||
symfont = None
|
||||
if not os.path.isfile(self.args.glyphdir + patch['Filename']):
|
||||
sys.exit("{}: Can not find symbol source for '{}'\n{:>{}} (i.e. {})".format(
|
||||
projectName, patch['Name'], '', len(projectName), self.args.glyphdir + patch['Filename']))
|
||||
if not os.access(self.args.glyphdir + patch['Filename'], os.R_OK):
|
||||
sys.exit("{}: Can not open symbol source for '{}'\n{:>{}} (i.e. {})".format(
|
||||
projectName, patch['Name'], '', len(projectName), self.args.glyphdir + patch['Filename']))
|
||||
symfont = fontforge.open(os.path.join(self.args.glyphdir, patch['Filename']))
|
||||
|
||||
# Match the symbol font size to the source font size
|
||||
|
|
Loading…
Reference in a new issue