Quantcast
Channel: Glyphs News, Events and Tutorials
Viewing all articles
Browse latest Browse all 569

Mark Attachment

$
0
0

There are two ways of having accented letters in your font. Firstly, you can simply pre-build them as compound 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 compounds 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:

markattachment1

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:

markattachment2

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:

markattachment3

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 compounds, .case variants will be preferred if available. You can re-compose existing compounds with Glyph > Make Component Glyph (Cmd-Opt-Shift-C).

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. This is how the smart kids do it these days: You first create your combining marks with the anchors described above, then you choose Glyph > Add Glyphs... (Cmd-Shift-G), paste these lines into the dialog sheet that appears, and press Generate:

acutecomb=acute
brevecomb=breve
caroncomb=caron
cedillacomb=cedilla
circumflexcomb=circumflex
dieresiscomb=dieresis
dotaccentcomb=dotaccent
gravecomb=grave
hungarumlautcomb=hungarumlaut
macroncomb=macron
ogonekcomb=ogonek
ringcomb=ring
tildecomb=tilde
caroncomb.alt=caron.alt

This creates spacing accents as component copies of the combining accents. This means that they always stay in sync. And now you are backwards compatible, yay!

markattachment4

Typing combining accents

In order to test mark attachment 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 Character Viewer 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:

markattachment5

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:

markattachment6

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

markattachment7

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:

markattachment8

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

markattachment9

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


Viewing all articles
Browse latest Browse all 569

Trending Articles