Reusing shapes: smart components

by Rainer Erich Scheichelbauer
en fr zh

26 July 2022 Published on 30 March 2015

Smart Components are a fantastic way for re-using partial glyph shapes, especially for CJK radicals, but also for Latin letter parts. Be smart, and find out how to do it!

Imagine you want to re-use the shoulder of your lowercase n, for example, in your lowercase m or h. Sure, you could do that with components like we did with slab serifs. There is one problem with using regular components, though: they are static.

But we need to adjust the shoulders in the m. Most people like to have them a little narrower. That is because the two shoulders would add up too much whitespace in a single letter.

Also, on the lowercase h, most designers will drag down the crotch to make the white incision appear as deep as in the n. That is because the stem of the h cannot be adjusted as easily as the upper serif of the n.

That is why normal, static components are of no use for us here. We need a better solution.

Setting up a Smart Glyph

We will turn the shoulder into a Smart Component. Double click the shoulder of the n to select it. Then right-click to bring up the context menu, and pick Component from selection:

When you are prompted for a Name of the Component Glyph, you enter a name that starts with _part, because it is a part we can reuse in other glyphs. Also, glyphs created with an underscore at the beginning will be set to non-exporting by default, which makes sense for us. Assuming that you will have more than one Smart Component in your font, you should finish it with a dot suffix. In our case, I suggest .shoulder:

A separate glyph called _part.shoulder will be created. Let’s add anchors so the shoulder part can connect to other parts. First, we can add an anchor for the following part to connect, so you can also make an m. We can call it connect and align it to the right edge of the stem.

Then, we need an anchor, so _part.shoulder can connect to a preceding part. Assuming that the preceding one has a connect anchor in it, the corresponding anchor must be called _connect with an underscore at the beginning. Since they should all have the same height (i.e., y coordinate), I suggest keeping the anchors on the baseline. Once we are done, it could look like this:

Because it starts with _part, it is recognized as a Smart Glyph. But as long as it does not have any extra layers, it is not very smart yet. So, let us copy the current layer twice, and name the layers NarrowShoulder and LowCrotch. You can do that in the Layers section of the Panel sidebar (Cmd-Opt-P):

Now, you can activate the NarrowShoulder layer, and nudge it a little tighter: Select the right half of the shoulder, hold down the Ctrl and Option keys, and press the left arrow key. The selected part will move to the left, and the surrounding handles will be adjusted proportionally. Add Shift for increments of 10 units:

Do the same on the LowCrotch layer, but this time, you select the two leftmost nodes and nudge them down to achieve a lower crotch. The simple nudging should do as a start. You can refine the shape later.

Now, with _part.shoulder still active, right-click in the canvas to bring up the context menu, and choose Show Smart Glyph Settings. Or, with the same effect, choose Edit > Info for Selection (Cmd-Opt-I):

In the dialog sheet that appears, you add a property called shoulderWidth with the Plus button, and enter 0 and 100 as its Limits. The name and the numbers are more or less arbitrary, the Bottom limit is required to be smaller than the Top limit, though. And the values should make sense to you. I choose zero to represent the minimum width of the shoulder, and a hundred for its maximum.

Then, add a second property called crotchDepth with -100 and 0 as its limits. To me, -100 best represents the lowest crotch, and zero the normal crotch.

Then, switch to the Layers tab of the dialog sheet. Here, you tell Glyphs which property values apply to which of the layers. In our case, this could be:

  • Regular: crotchDepth 0 and shoulderWidth 100
  • NarrowShoulder: crotchDepth 0 and shoulderWidth 0
  • LowCrotch: crotchDepth -100 and shoulderWidth 100

Once you set all properties for all layers, you can confirm the dialog by clicking on the OK button.

Adjusting the Smart Component

Now, back in glyphs like h, m, and n, you can delete the vector shoulders, and insert _part.shoulder as a component with Glyph > Add Component (Cmd-Shift-C).

Now, if you right-click on the component, and choose Show Smart Component Settings from its context menu, or, alternatively, select the component and choose Edit > Info for Selection (Cmd-Opt-I), you will be presented with a slider dialog. Use the sliders to interpolate the Smart Component in place:

In order to make use of the anchors, it makes sense to also turn the stem into a smart glyph with a connect anchor. And perhaps add an extra layer for different bends on the top serif, so you can achieve various degrees of incisions. In any event, this is what _part.stem could look like:

Automatic alignment with anchors only works if all parts of the glyph are components. As soon as there is a regular path in the glyph, automatic alignment is cancelled, and anchors are ignored.

Now, for instance in the lowercase m, place _part.stem as the first component, and subsequently _part.shoulder twice. You will see that they connect nicely at the anchors. And again, you can adjust the parameters for the Smart Components:

Smart Components as CJK radicals

The original intention of Smart Components was a better way for designing CJK glyphs. In Chinese, Japanese and Korean, some characters get reused in other, more complex ideographs. These characters are therefore called radicals, because they form the root (latin ‘radix’) for other characters.

For that reason, not only glyphs that start with _part count as Smart Glyphs, but also all CJK radicals. Naturally, that is also where Smart Component setups tend to become more complex:

Smart scaling with the bounding box

If you have properties called Height and Width (written with cap letters at the beginning), you can turn on View > Bounding Box (Cmd-Opt-Shift-B), and the knobs of the box will manipulate the Height and Width properties:

This is a convenient and more intuitive way of manipulating the size of Smart Components than those terrible sliders.

Smart handles

So, height and width are taken care of in terms of getting rid of those ugly sliders. But what about all the other parameters? Well, look no further: Ever since Glyphs 2.5, you can add your own handles in Smart Components! Here’s how:

In every Smart Glyph layer, add anchors containing the names of properties. Then position them where it makes most sense. See these two smart layers of a CJK radical, and pay attention to the positioning of the Right Arm anchor:

Make sure the anchor names are exactly the same as the property names. You do not have to add all properties as anchor names. But the ones you do add need to be in all layers. Then, in the Smart Component, Glyphs will display handles you can drag (instead of the property sliders):

Pretty cool, eh?

Update 2017-12-11: added note about _smart as possible alternative name. Added Smart Scaling and Smart Handles.
Update 2018-12-07: corrected typo, it is Height, not Weight. Duh.
Update 2022-04-05: minor formatting and URL updates.
Update 2022-07-26: updated title, related articles, minor formatting.