Mark attachment

Tutorial
by Rainer Erich Scheichelbauer
en fr zh

17 August 2022 Published on 20 February 2015

Non-spacing combining marks allow the user to put any accent on any character. It is possible through the magic powers of mark attachment, and easy to implement in Glyphs.

There are two ways of having accented letters in your font. Firstly, you can simply pre-build them as composite glyphs. We have covered this in a Diacritics tutorial. At CFF export, the components are decomposed, and wherever necessary, overlaps are removed. Even though this means that you have a lot of path duplicates throughout your font, this method is widely used because it is most compatible. And if you cannot predict in which environment your font is going to appear, you may have to stick to this way anyway.

Secondly, however, you can just keep marks and and base glyphs around, and have the rendering engine stick them together on the fly. This is called mark attachment. The big advantage, as you may have guessed, is a drastically reduced file size of the final font. You are even free to put any accent on any base glyph by the means of something called Mark-to-Base Attachment. What’s more, you can even stack accents on top of each other. This also has a name: font experts refer to it as Mark-to-Mark Attachment.

The downside of all this fun stuff is the lack of application support. But gradually, more and more software is supporting mark attachment. So, the best way to cope with this reality is to put both things into your font: prebuilt composites and marks for attachment.

Adding combining accents

For mark attachment to work, we need something called combining marks, or, non-spacing marks. Mark attachment does not work with legacy spacing marks.

Typically, combining marks have a comb at the end of their name, and, apart from the scripts that have their own combining marks, usually live in these Unicode ranges.

  • U+0300-036F COMBINING DIACRITICAL MARKS
  • U+20D0-20FF COMBINING DIACRITICAL MARKS FOR SYMBOLS
  • U+1DC0-1DFF COMBINING DIACRITICAL MARKS SUPPLEMENT
  • U+FE20-FE2F COMBINING HALF MARKS

‘But which ones do I need for the languages I want to add to my font?’, I hear you ask. Fear not, in the language category in the sidebar, you can add them by right-clicking on the Language entry.

You may want to scroll down to see the combining marks. For instance, for Western Latin, these are necessary:

acutecomb
cedillacomb
circumflexcomb
dieresiscomb
dotaccentcomb
gravecomb
ringcomb
strokeshortoverlaycomb
tildecomb

Adding anchors

Basically, all we need now, is a set of defined positions where the letters and marks can connect. You do this by adding anchors to your base letters and accents. In other words, anchors serve as position markers that tell Glyphs where the letters and marks are going to be hooked up with each other. You can quickly add default anchors to selected glyphs with Glyph > Set Anchors (Cmd-U). If you think you have messed up, you can hold down the Option key and choose Glyph > Reset Anchors (Cmd-Opt-U).

Anchors inside a glyph have unique names. The base glyph has anchors called top, bottom, center and ogonek. If anchors are selected, you can see a cloud of marks that can connect with the anchors in the current glyphs.

The mark glyphs have anchors with the same names, except for additional preceding underscores, i.e., _top, _bottom, _center and _ogonek. Actually, marks contain both anchors, so the anchors can stack.

Most important for us are top and bottom anchors, as well as their underscored variants in the marks. Default anchors are a good start, and Glyphs has a big built-in database of which anchors are associated with which glyph. When you add default anchors as described above, Glyphs even tries to put them into default places. So, you may need to adjust the anchor positions in many glyphs. And if you want to add your own, you can do so by right-clicking inside a glyph and choosing Add Anchor from the context menu.

Now, here’s the deal: The underscored anchors will try to connect to the corresponding base anchor in the nearest preceding glyph. If the mark does not find a corresponding anchor in the mark immediately before itself, it will look in the mark before that, until it hits the base letter.

For example, the acute (glyph name acutecomb) knows where to go exactly on a lowercase e, by connecting its _top anchor with the base glyph’s top anchor. If there is a diaeresis (a.k.a. dieresiscomb) between them, it will use the top inside the dieresiscomb, if it is there.

So, choose your anchor positions wisely. We strongly recommend the following.

  • Keep anchors on vertical metric lines wherever possible, e.g., keep bottom on the baseline, top on the x-height or ascender in lowercase letters, and on the cap height in uppercase letters.
  • Since you have wisely put the _top anchor on the x-height, keep your lowercase marks above the x-height.
  • Use case variants for your uppercase marks: Duplicate the marks (Cmd-D), move them above cap height, reset the anchors (Cmd-Opt-U), and change their suffix to .case. Now when you compose uppercase composites, .case variants will be preferred if available. You can re-compose existing composites with Glyph > Make Component Glyph (Cmd-Opt-Shift-C).
  • Small-cap variants work the same way, just that you would use the .sc suffix with the small-cap height defined in the Metrics section of File > Font Info > Masters. If you define a separate metric for small-caps, make sure to set its Scope to Case: Smallcaps.

Derive spacing accents

So, starting in Glyphs version 2.0, combining marks are the default. Yet, there still need to be legacy spacing marks in your font for compatibility reasons.

After you’re finished with your combining marks, just add the legacy marks, which will be generated automatically. Why is that possible? Because legacy accents reuse combining accents components. See for yourself in Window > Glyph Info:

Typing combining accents

In order to test mark attachment in the font, you need to be able to type the non-spacing accents in an application like InDesign. First, export your font into the Adobe Fonts folder, then create a new document, type a base glyph like a and then, add a combining accent. Here is how:

First, choose Show Emoji & Symbols from your Input Methods menu in the toolbar (the one with the flag symbol in your menu bar). If you don’t have such a menu, activate it in System Preferences > Keyboard > Input Sources and turn on the option Show Input menu in menu bar:

Then, if Unicode does not show up in the left sidebar of your Character Viewer, choose Customize List... from the gear menu in the top left oft the window:

... and choose Code Tables > Unicode in the dialog sheet that appears:

Now you can select Unicode in the sidebar, scroll down to the 0300 area between Latin and Greek, pick any of the combining accents there, and insert it by double clicking:

Don’t worry. You only need to set this up once. InDesign even allows you to separately select and color your combining accents:

Again, the smart kids actually build their own keyboard layout with Ukelele from the nice people at SIL. But that is another story.

Zero width anyone?

Combining nonspacing marks should have zero width. Also, they should be shifted left (i.e., have a negative left sidebearing) so they can sit above an average letter. That is meant as a fallback for when the mark feature doesn’t work.

But: In the .glyphs file, you do not need to set the width of combining accents to zero. You can let the app take care of that: At export, Glyphs will automatically retract the LSB to the RSB. Makes editing easier, and you only need to take care of the RSB. That means you can set the LSB to something comfortable for editing, perhaps 50 units or whatever suits you. That’s good news because zero-width glyphs are hard to double click in the Edit view. FTW!


Update 2016-02-19: updated screenshots.
Update 2018-02-01: added clarifying sentence about Zero Width.
Update 2020-02-13: added missing word.
Update 2021-08-07: fixed missing images; added a note about small-cap accents.
Update 2022-17-08: minor formatting changes, changed title, compounds to composite