mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-12 09:41:47 +02:00
font-patcher: Fix crash with older fontforge
[why] If a font has references in glyphs that we want to add to the essential set of glyphs, and fontforge is old (i.e. 2020*) the patcher crashes. [how] The fontforge function glyph.references returns a three element tuple in current fontforge (i.e. 20230101). But older versions skip the selection bit and return only tuples of two. As we use only the first tuple element we do not care about the 2nd and possible 3rd element(s) and just thrash them. Fixes: #1142 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
8d315f467c
commit
4a3ca9069d
1 changed files with 4 additions and 3 deletions
|
@ -6,7 +6,7 @@
|
|||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
# Change the script version when you edit this script:
|
||||
script_version = "3.5.11"
|
||||
script_version = "3.5.12"
|
||||
|
||||
version = "2.3.3"
|
||||
projectName = "Nerd Fonts"
|
||||
|
@ -983,9 +983,10 @@ class font_patcher:
|
|||
self.add_glyphrefs_to_essential(altcode)
|
||||
# From fontforge documentation:
|
||||
# glyph.references return a tuple of tuples containing, for each reference in foreground,
|
||||
# a glyph name, a transformation matrix, and whether the reference is currently selected.
|
||||
# a glyph name, a transformation matrix, and (depending on ff version) whether the
|
||||
# reference is currently selected.
|
||||
references = self.sourceFont[unicode].references
|
||||
for refcode in [ self.sourceFont[n].unicode for n, m, s in references ]:
|
||||
for refcode in [ self.sourceFont[n].unicode for n, *_ in references ]: # tuple of 2 or 3 depending on ff version
|
||||
if refcode not in self.essential and refcode >= 0:
|
||||
self.add_glyphrefs_to_essential(refcode)
|
||||
|
||||
|
|
Loading…
Reference in a new issue