Use Masters as layers for smart components

Hi,
This might be me not understanding properly how things are supposed to work in glyphs with smart components but I’m looking for a way to use a regular master as a source of variation in a smart component.

I tried using the following script to make it work but it seems that the only way to use smart component is to use extra layers.

As it is configured now, the slider is visible but when I use it the component doesn’t change at all.

The reason for me to want to do that is that I would like to build small caps (and more) using component interpolated from my existing axis without have to decompose them.

from GlyphsApp import *

f = Glyphs.font

for g in f.glyphs:
	
	if g.selected:
		#Add a Smart ComponentAxis to the glyph
		axis1 = GSSmartComponentAxis()
		axis1.name = 'weight'
		axis1.topValue = 1000
		axis1.bottomValue = 0
		print g.smartComponentAxes
		g.smartComponentAxes.append(axis1)

		weight = g.smartComponentAxes['weight']

		#Mapping existing master layers to the extremes of the smart component
		for layer in g.layers:
			if layer.name == 'Light Mid':
				layer.smartComponentPoleMapping[weight.id] = 1
			elif layer.name == 'Bold Mid':
				layer.smartComponentPoleMapping[weight.id] = 2

It should work with the masters layers. You need to use “Weight” as the axis name.

1 Like

You’re right, it works.
Thanks!

Is there a reason why it is only possible to map Smart components to top and bottom (in my case 0 and 1000)?

I have intermediate masters (& brackets) steps that I would like to be used too.

I tried using interpolationProxy to make the same thing using outlines (and it works), but I think the smartComponent UI is much more pratical to fine tune the right interpolation values. It would be great if it could work!

You should be able to use intermediated layers. I just had a look at this and improved a few bits any pieces.

What do you mean? As it is now (Glyphs 3.0.2, build 3053) I only get the opportunity to map top and bottom, so my intermediate masters (or bracket layers) can’t be set.

For example in a designspace of:
Weight [0,1000]
Width [0,1000]
I can not integrate [500,1000] or [500,500]
I can only map [0,1000], [1000,1000], [0,0] and [1000,0].

This is what the interface looks like. In the scripting documentation, it only introduces “top” and “bottom” (1 and 2), not the axis value.
Is there a way to do that?

You don’t need to select the brace layers in the settings dialogs. It should just be picked up. If not, can you send me the file for testing?

1 Like

Oh ok, then there is something not working.
I already sent my file to Rainer (on the support mail) for another issue (weird interpolation behaviour on variable font export).

I didn’t get a reply yet, I don’t know if he had time to have a look.

I since tried to erase as much things from the file to try to find the source of the problem but even without any component, kerning, opentype, hinting and non master layers (only kept brace layers) it keeps going.

Let me know if you need me to send the file again.

I sent you my file with only one glyph and no component/smart component, kerning, opentype, hinting and non master layers.

I made a video of the issue so that you could see the problem live.
I sent it to the support email.

I removed the plugin folder before doing the video.

Hi,
Just checking in to know if you had time to take a look at this.

If you did/when you, do you think that it is a small solvable bug or something that will take time to implement/fix?

I just need to know if it is worth the wait or if I should better go with my own way using interpolated paths.

I fixed it that you can uncheck layers.

What do you mean by being able to uncheck layers? I didn’t notice any change, I get this in the smart glyph panel. I updated to 3.0.3 (3065)

image

I just fixed the code half an hour ago. Need to prepare and upload a new version. Will do that in the next few days

1 Like

Oh ok, sorry! Thanks a lot for letting me know!

It didn’t solve the problem, the intermediate masters are not being used by the smartComponent interpolation.
It would be nice to have a way to set the smartComonent axes values manually (with UI or scripting API).

Cans you send me a sample?

I sent it to you one the support mail.

You master setup is quite a handful. And the intermediate layer is picked up. The problem is that all the other default middle master are not. You are using the smart components in a un-intended way. I have an idea on how it might be possible to do something like what you are trying but I’m not sure.

1 Like

It would be great as it would allow to have some sort of cross masters components!

1 Like