Adding a component into every single glyph

In order to resolve a problem of underline’s appearance on the web, I need to create a copy of a font with its every glyph having an underline. What’s the easiest way to do it? How do I quickly insert a line into every glyph? Also I need the underline to match glyphs’ widths.

  1. Copy the source glyph (best a smart glyph like Florian explains below)
  2. Select the target glyphs
  3. Hold down you option key and choose Edit > Paste Special
  4. Paste as components is the option you want.
1 Like

Create a _part.underscore glyph and make it a smart component so that you can vary its width to match each glyph.


@FlorianPircher @mekkablue Thank you for your help, folks! Unfortunately, my task is pretty idiosyncratic and I’m still trying to find a way for the smart component to automatically match all the glyphs’ widths. I explained my task in details in another thread here. Maybe you would know a script or something

Follow the steps as described above and then select all glyph where you want the line length adjusted to the width of the layer. Then, run the following script:

for layer in Font.selectedLayers:
	for component in layer.components:
		if == "_part.underscore":
			component.smartComponentValues["Width"] = layer.width

Here, Width is the name of your smart component property. Also, make sure that the minimum and maximum values match exactly the width of the two smart component layers:


As described in the other thread, wouldn’t it make sense to add a normal component of, for example, width 100 and set the x scale to layer width / 100?

The smart component approach is admittedly quite smart, though :grin:

That depends on how complex the line is. Maybe you want rounded caps on either side of the line or some other ornament, that would be possible with Smart Components but not with scaling.

Good point, thanks!

OT: Very nice flair. I’m jealous.

1 Like

Thank you so much for your effort! It worked and i’m very close.

There’s one more thing to fix, however: smart component’s positioning on the glyphs’ horizontal axis. Is there a way to modify your script for it to center the component relatively to the glyph canvas?

You should only need to move the component to 0/0.

Right, but with hundreds of glyphs that would be a bummer, no?

When you use Paste Special, the components should all be added at (0, 0).

Thank you, now it worked! The problem was that my component’s canvas was wide and it actually had to be more narrow than all the other glyphs. Now my problem is fixed.