font-patcher: Allow to specify custom symbolfont with absolute path

[why]
When one wants to use a custom symbol font and specifies it with an
absolute path, the glyphdir is still prepended.

That means that the argument to `--custom` is always used as relative
path (to `--glyphdir`), even when it starts with `/`. That is somehow
unexpected or at least inconvenient.

Example:
fontforge font-patcher --custom ~/Downloads/fa6.otf Inconsolata-Regular.otf

fa6.otf is searched for in ./src/glyphs/home/username/Downloads

[how]
Use Python function that handles joining path fragments. If a component is
an absolute path, all previous components are thrown away.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2022-02-22 16:35:11 +01:00 committed by Fini
parent 64d53b8247
commit 7cda326515

View file

@ -225,7 +225,7 @@ class font_patcher:
if symfont:
symfont.close()
symfont = None
symfont = fontforge.open(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
symfont.em = self.sourceFont.em