lettering: ignore invalid glyph layers (#1892)

pull/1866/head^2
Kaalleen 2022-11-10 14:03:32 +01:00 zatwierdzone przez GitHub
rodzic ea13c42997
commit 7445b91851
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 8 dodań i 4 usunięć

Wyświetl plik

@ -216,7 +216,8 @@ class FillStitch(EmbroideryElement):
@property
@param('staggers',
_('Stagger rows this many times before repeating'),
tooltip=_('Length of the cycle by which successive stitch rows are staggered. Fractional values are allowed and can have less visible diagonals than integer values.'),
tooltip=_('Length of the cycle by which successive stitch rows are staggered.'
'Fractional values are allowed and can have less visible diagonals than integer values.'),
type='int',
sort_index=6,
select_items=[('fill_method', 0), ('fill_method', 2), ('fill_method', 3)],

Wyświetl plik

@ -69,7 +69,10 @@ class FontVariant(object):
self._clean_group(layer)
layer.attrib[INKSCAPE_LABEL] = layer.attrib[INKSCAPE_LABEL].replace("GlyphLayer-", "", 1)
glyph_name = layer.attrib[INKSCAPE_LABEL]
self.glyphs[glyph_name] = Glyph(layer)
try:
self.glyphs[glyph_name] = Glyph(layer)
except AttributeError:
pass
def _clean_group(self, group):
# We'll repurpose the layer as a container group labelled with the

Wyświetl plik

@ -38,7 +38,7 @@ def row_num(point, angle, row_spacing):
def adjust_stagger(stitch, angle, row_spacing, max_stitch_length, staggers):
if staggers == 0:
staggers = 1 # sanity check to avoid division by zero.
staggers = 1 # sanity check to avoid division by zero.
this_row_num = row_num(stitch, angle, row_spacing)
stagger_phase = (this_row_num / staggers) % 1
stagger_offset = stagger_phase * max_stitch_length

Wyświetl plik

@ -149,7 +149,7 @@ def take_only_line_strings(thing):
def apply_stitches(line, max_stitch_length, num_staggers, row_spacing, row_num):
if num_staggers == 0:
num_staggers = 1 # sanity check to avoid division by zero.
num_staggers = 1 # sanity check to avoid division by zero.
start = ((row_num / num_staggers) % 1) * max_stitch_length
projections = np.arange(start, line.length, max_stitch_length)
points = np.array([line.interpolate(projection).coords[0] for projection in projections])