Replacing several glyphs with one, in single instance

I have two instances under Export in Font Info: Regular and Demo

In the Regular I want to include all glyphs.
In the Demo I want to replace some glyphs (e.g. a,b,c,d) with a graphic that states it is a demo. (demosymbol)

Ideally, I would have one glyph that replaces a,b,c,d. How to do this with a custom parameter?

My current solution is non-exporting glyphs a.demo, b.demo, c.demo, d.demo, each containing a component of demosymbol.
And custom instance parameter “Rename Glyphs: a.demo=a, b.demo=b, c.demo=c, d.demo=d”

Is there a more straightforward solution? A “Replace Glyph” parameter where I can bulk replace a,b,c,d with demosymbol?

Glyphs 3.

There’s also Remove Glyphs parameter which should suit what you need.

Yes, but that parameter is excessive in my current solution. How would you suggest using it?

Thanks!

You just need to list all the glyphs that you want to remove (glyph names separated by comma or line break). I don’t know how many glyphs you are talking about, but the easy way is to select glyphs and open context menu where you can find options on what format to copy the glyph names.

The tricky thing in cases like this is how to reverse the selection of glyphs you want. My solution would be to make use of glyph colours and filters. I would mark the glyphs I want to keep (assuming you already use glyph colour labels, using Layer labels might be smarter instead. You hold Alt in contextual menu to reveal that option). Then you make a smart layer using glyph or layer colour label as the criterion, and make it “Layer label is not set”. This way, any glyph that you didn’t mark will show up in one place. You can then select everything in there, and copy glyph names easily.

1 Like

The copying of the Glyph names won’t be an issue, I already have the list.
Do I understand you correctly that this is what you are explaining?

The parameter “Remove Glyphs” would indeed remove the glyphs, but it does not replace them with the demosymbol.

Oh I had totally misunderstood! I thought you wanted to remove those glyphs, therefore negating the need for the demo symbol. Let me think.

You could do it by removing the glyphs and attaching their unicodes to the demosymbol

Remove Glyphs: a,b,c,d
Reencode Glyphs: demosymbol=0061,0062,0063,0064

Unfortunately the dialog to edit the “Reencode Glyphs” parameter is broken at the moment (I just fixed it). So you need to use this script to add it:

for instance in Font.instances:
	if instance.name == "Demo":
		instance.customParameters["Reencode Glyphs"] = "demosymbol=0061,0062,0063,0064"
2 Likes

I was thinking of encoding the symbols but I didn’t know there was that parameter! But what about unencoded glyphs?

Just remove them? What specific ones you have in mind?

I don’t know what he has, but it seems avoiding glyph removal was his point. I can imagine not wanting to change OT features, and wanting to export demo instances as care-free as possible while retaining the glyph set.

There is a plug-in for that. Look for Obfuscator in Window > Plugin Manager.

1 Like

When you say ‘just fixed it’, do you mean it is working in today’s update?
I can find it among the options, but it seems to just remove the a,b,c,d glyphs.
I think I want to stick with parameters rather than to keep it as simple as possible. I am unsure how to use scripts in Glyphs, so maybe I am wrong and it is much simpler than parameters. I tried the one you wrote but nothing happens when I click Run.

Thanks, looks like it does what I am looking for. Cannot get it to work though.
The parameter “Filter: Obfuscator; char: demosymbol; include: a,b,c,d;”
gives me: “Error applying Obfuscator” when exporting.

Reencode Glyphs, when it works, assigns multiple code points to one glyph (you can do that in the standard UI too). Typical scenario is when you’re making an all-cap font and you want to make the uppercase A assume the role of lowercase a too. What is suggested here is to assign all the extra glyphs’s code points to the demo symbol; this way, you can have just one glyph but still type the character that’s supported. The problem in this case is the OpenType alternates which do not have code points.

1 Like

Thank you very much, I got it to work now!

So Reencode Glyphs definitely solves my problem.

This is what I do:

  • Mark demosymbol glyph for export.
  • Add parameter “Reencode Glyphs: demosymbol=0061,0062,0063,0064” to Demo instance.
  • Add parameter “Remove Glyphs: demosymbol” to Regular instance.

The above alone does exactly what I wanted, but feel free to let me know if there are any disadvantages that I am missing.

Yes, one more thing: the glyph palette might look a lot smaller depending on the application you’re using, which might give users false idea of the actual character set. I suggest you check the glyph set visual in apps like Adobe CC and Font Book.

1 Like

Thank you, noted. That is important. In this font it won’t be an issue though, I am only hiding one percent of the glyphs.
FontBook seems to count all; no loss there.

Also I just realized a better solution:

  • Unselect demosymbol for export.
  • Add parameters “Export Glyphs: demosymbol” and “Reencode Glyphs: demosymbol=0061,0062,0063,0064” to Demo instance.

Probably needs an update for Glyphs 3. Will make a pull request.
Update: fixed