Duplicate as component?

Hi,
is there any script around to duplicate a glyph by putting inside the source one as a component, and giving sidebearings the name of the source too?
So if I duplicate A, I’d have an A.001 with “A” component inside and “A” & “A” as left and right sidebearings.
Thanks

Not at the moment, but it’s easy to make (I hope). Give me some time.

Great thanks :slight_smile:
It could be useful to others too I guess

Okay, I’ve made it. Please download it from my Github repository (Duplicate glyph with Component).
https://github.com/Tosche/Glyphs-Scripts

For me it’s easy enough to do it manually unless I have to do it very many times, but it was nevertheless fun to program.

Thanks a lot Tosche!
It works but not for metrics/sidebearings :frowning:

Write this in Font > Add Glyphs: A=A.ss01 B=B.ss01

Doesn’t this do what you need?
And for the Metrics keys, simply run Georg’s Set Kerning Groups script.

Oh, I forgot to set the sidebearings. I can update it as you wish, but what are you trying to do? A completely different solution might actually be recommended.

mekkablue, “steal kerning groups” does a different job than inheriting sidebearings forum the source glyph, doesn’t it?

Tosche: it only copies the kerning groups from one font to another, nothing else.

My need is quite basic:
I want a .case version of some punctuation and extra glyphs.
However, I’d like to bother just of vertical shift, leaving any further shape and left/right sidebearing modification to the source glyph.

So I’d like something like cmd+d with automatically component + dyna sidebearings + kern groups if applicable.

The Font > add glyph isn't a time saver in the sense I have to write all the receipt for some 40 glyphs. It takes too much time to write (even with some find and substitute) knowing I have to enter each glyph to add the dynamically linked sidebearing.

In that case you could easily do it with existing tools.

I would use regular expression in TextWrangler (or any decent plain text editor like TextMate or Sublime Text) to build a recipe, which is quite easy. Trust me, plain text editor is going to be your best friend.

For batch-editing sidebearing keys, I use my script (also downloadable) and of course mekkablue’s script for copying kerning groups, which doesn’t make much sense to me though, because the case-specific symbols need different groups.

Well, I feel it’s a quite common action, and would deserve a 1-click-and-not-think command.

BTW I noticed an issue with Glyphs & “Duplicate glyph with Component”. In fact it shows the component from the last master on all the masters. Saving, closing and reopening Glyphs fixes the issue.

It is common, but writing a recipe is more universal (and fast enough for me). Seriously, try a plain text editor and regular expression. It will help you a lot. If the benefit is not obvious, I can give you a tutorial.

There’s another problem with the script. I usually want the sidebearings of .case glyphs slightly wider, and that value changes in each typeface. So there is no 1-click solution for that, but rather a combination of them. Reusing sidebearings and kerning groups of the original glyphs isn’t good in my opinion.

At least I improved my code to your wish; now it gives .case suffix and sidebearing keys of the original glyph (and fixes the issue that you mention). Please download “Create .case alternate” script from my repository.

Ok I understand.
Thank you for the new script anyway.

You can copy glyph names in Font View (via the context menu), then paste in TextMate or SublimeText and do a multiple-line edit. Does not take long.

I hoped to avoid having to learn another software :stuck_out_tongue:

I think knowing how to handle a good text editor is essential. It will make your life easier. And there really is not much to learn. Just watch their tutorial videos about searching, replacing, and multi-line editing. Just a handful of shortcuts.

And it’s useful for whole bunch of other things, not just making new glyphs.

As TextMate are SublimeText are both shareware, which is the best?

I like TextMate. It has a very nice and clean interface and it is free and open source.