Layers[0] works, layers[:1] does not work

I’m trying to slice the GSGlyph.layers collection to grab multiple layers at once, but it’s returning the wrong layers.

This works great, layers are in the correct order:

	<GSLayer "Display Hairline" (A)>,
	<GSLayer "Display Black" (A)>,
	<GSLayer "Display Hairline" (A)>,
	<GSLayer "Display Black" (A)>,
	<GSLayer "Micro Hairline" (A)>,
	<GSLayer "Micro Black" (A)>

This works too, returns the first layer as expected:

<GSLayer "Display Hairline" (A)>

But if I slice the first layer, it returns some other layer instead:

[<GSLayer "Display Black" (A)>]

And if I slice the whole collection, you can see it’s all in the wrong order:

[<GSLayer "Display Black" (A)>, <GSLayer "Display Hairline" (A)>, <GSLayer "Micro Black" (A)>, <GSLayer "Micro Hairline" (A)>, <GSLayer "Display Black" (A)>, <GSLayer "Display Hairline" (A)>]

I would not rely on slicing here. But I have a look at the wrapper and see if I can improve it.

1 Like