Quantcast
Channel: Glyphs Tutorials
Viewing all 88 articles
Browse latest View live

Small-cap figures

$
0
0

Since neither lining nor old-style figures really go well together with small caps, you may want to make a typographer happy by adding small-cap figures to your font. It is easy in Glyphs. Simply create copies of your lining figures, edit them to match the small-cap height, and make sure they all carry a .sc suffix:

That’s it. Glyphs will add the appropriate substitutions to your smcp and c2sc features once you push the Refresh button in File > Font Info > Features.

Multiple suffixes should be added in the order of the features as displayed in the Font Info. Then, Glyphs can still auto-generate the features for you. So, if you have a zero.zero in your font and want to have a small-cap variation of that one as well, then you simply call it zero.sc.zero.

Likewise, if you have a three.ss01, then the corresponding small-cap numeral is called three.sc.ss01, because stylistic sets are applied after the small caps. That is, unless you changed the order of the features. Then you will also have to adapt the order of the suffixes.

Tabular vs. proportional small-cap numerals

This one is exclusively for the überfontgeeks among you. Here’s how the story goes: Since small-cap variations only offer a vertical differentiation, additional to lining and old-style figures, the question is, what happens to the differentiation between tabular and proportional? We have both tab and proportional old-style figures, as well as both tab and proportional lining figures. Why not tab and proportional small-cap figures?

Okay, all the normal people will rightfully ask, ‘Who the heck needs this?!’ After all, the sole purpose of small-cap numerals is to accompany small-cap letters. So, it most likely won’t be a table you will need them in. Thus, we can safely cut out those tab numerals. If this seems logical to you, stop reading right here. Otherwise, you’ll go crazy in about a minute.

To finally enable our secret deep wish to have small-cap number tables, we need to add variations of the .sc numerals we already have. Again, we need to add a suffix, but which one?

The answer is, it depends on your default figures. Your tabular small-cap figures need to be the .sc variation of your primary tab figures, so they will take their suffix plus .sc. And since your proportional small-cap figures are variations of your primary proportional figures, they inherit their suffix plus .sc. Primary (tab or proportional) figures are either the default figures or the ones they get turned into in the tnum and pnum features, respectively.

Again, once you refresh the features in File > Font Info > Features, Glyphs will automatically add appropriate substitutions in the two small-cap features.

An example. Let’s assume your default figures (i.e., one, two, three, etc.) are proportional lining figures. That means, your primary proportional figures are the default figures, and your primary tabular figures are the ones with the .tf suffix. Thus, your proportional small-cap numerals will carry merely the .sc suffix, whereas the tabular small-cap features will sport a .tf.sc suffix. Just to make sure, you can even add .tosf.sc copies, in order to cover the possible case where a user selects both ‘tabular old-style figures’ and ‘small caps’ in the layout application of his or her choice.

If this doesn’t sound too complicated to you, then you officially are a type geek. Welcome to the club.


Fractions

$
0
0

So you have nicely done all your figures. Now it is time to add fraction figures. The good thing is, you only have to draw the numerators once, and you can re-use them as your denominators. Just shift them down a bit. Let’s go through that step-by-step.

Add denominators

First, you make copies of your lining figures, e.g., by simply duplicating them with the Font > Duplicate command, and then changing their suffix from .001 to .dnom with Edit > Find > Find and Replace while they are still selected. Then, scale them down. But don’t scale them down too much. Fraction figures do not need to be super-tiny. Approximately two thirds will do nicely in most cases.

If you have a Multiple Master set-up, you can make use of tools like the Scaler in Tim Ahrens’ Remix Tools for Glyphs. If you have a single-master set-up, then you can scale them down with Filter > Transformations > Transform, and then compensate for the loss of stroke thickness with Filter > Offset Path.

This will get you pretty far. Don’t forget to go through all of them, and fix manually what needs to be fixed. Repeat until you are satisfied.

Congratulations! Now, we have an additional set of figures: denominators!

Add numerators

On to the numerators. They should look the same as your denominators, just placed higher, usually bumped against the height of your lining figures. To achieve that, all we need to do is to create compound copies of the denominators. Choose Font > Add Glyphs (Cmd-Shift-G) and type (or copy and paste) this into the dialog that appears on the screen:

zero.dnom=zero.numr
one.dnom=one.numr
two.dnom=two.numr
three.dnom=three.numr
four.dnom=four.numr
five.dnom=five.numr
six.dnom=six.numr
seven.dnom=seven.numr
eight.dnom=eight.numr
nine.dnom=nine.numr

Press the Generate button, and you have numerator glyphs in your font! The only problem is, they are still hanging too low. So let’s push them upwards a bit. Make sure your numerators are selected and choose Filter > Transformations > Transform and shift them up along the y axis:

You can see a live preview in the main window, so you should be able to check right away if you have already reached an appropriate height.

Add a fraction glyph

The fraction glyph (Unicode U+2044) is different from the slash. For one thing, it has negative sidebearings. So the numr and dnom figures can space nicely into it. Also, the thickness of the stroke is tuned towards the small figures. In most cases, that implies that the fraction is thinner than the slash. Finally, the fraction usually has a much flatter angle, i.e. it is not as steep as a slash.

Type a string like /zero.numr/zero.numr/zero.numr/fraction/zero.dnom/zero.dnom/zero.dnom and adjust your fraction glyph to nicely reach below the numerators and above the denominators:

You may need to kern seven.numr with fraction, and fraction with four.dnom. Some designs also need a little tweaking between nine.numr and fraction, and fraction and six.dnom. Your mileage may vary.

Precomposed fractions

For backwards compatibility, you can also add precomposed fractions because some of them happen to have a Unicode. While you’re at it, you can generate them easily via the sidebar or by adding these glyphs:

onefraction onehalf zerothird onethird twothirds onequarter threequarters onefifth twofifths threefifths fourfifths onesixth fivesixths oneseventh oneeighth threeeighths fiveeighths seveneighths oneninth onetenth

Generate the feature

Now, go to File > Font Info > Features and press the Refresh button, i.e., the one with the circled arrow in the lower left corner of the window. You will notice that Glyphs automatically adds numr, dnom and frac to your list of OpenType features:

Press Compile to see if your feature code is alright. If it is, you can export it to the Adobe Fonts folder and try the Fraction function in InDesign. FTW!

In a nutshell, the fraction feature does this: First, it changes all figures into numerators and slash into fraction. Then, it replaces any numerator following a fraction by a denominator. Finally, it replaces any numerator following a denominator by a denominator.

The downside of this approach is that the user must specifically select the number/slash combos and activate the fraction feature. If he or she just turns it on and starts typing, all numbers are indiscriminately turned into numerators. But hey, that’s how it is implemented in most fonts.

Tal Leming’s Fraction Fever

There’s still one more thing I’d like to point you to. If you want to overcome the shortcomings of the standard implementation with a more sophisticated frac feature, try Tal Leming’s Fraction Fever 2, which, amongst other things, recognizes dates like ‘2012/4/12’ and excludes them from the fraction feature, and nicely renders number/fraction combos like two and a half. So, a user can always leave on the Fraction option in InDesign and just type away. The feature will figure out what to turn into a fraction and what to leave as it is.

To use the code in your font, follow these steps:

  • Make sure you have these glyphs in your font: thinspace (like space, but much thinner), hyphen, slash
  • Uncheck automatic feature generation for frac and delete the code that is still there
  • Insert Tal’s code in the feature
  • Replace (Cmd-F) the suffixes .numerator and .denominator by .numr and .dnom
  • Remove the two lines feature frac { and } frac; from the feature code

Now your fraction feature does stuff like this:

The only downside is that you can only have a pre-specified maximum number of numerators. By default, that number is ten, so you cannot type a quadrillion quintillionths. Bummer. If you didn’t understand these last sentences, or you do not care, well, never mind.

SAMPLE FONT: MARTHA, COURTESY OF LISA SCHULTZ.
Update 2013-11-13: Updated the link to Tal Leming’s blogpost about Fraction Fever 2.

Superscript and subscript figures

$
0
0

I assume you already have fractions. We will re-use them for the superscript and subscript figures.

Superscript: the sups feature

Imagine m squared for square meter, imagine x to the third power. This is the height the superscript figures ought to have. Depending on your design, exact copies of the numerators may do. Many designs need them shifted a little higher, though:

So, how do we do that? Bring up your numerators: Go to the Font tab and search for the .numr suffix. Select them and duplicate them with Font > Duplicate, and you will receive glyphs called zero.numr.001, one.numr.001 and so on. With Edit > Find > Find and Replace, replace .numr.001 by superior (without a period). If you do want to shift them up, you can push them all up in one go with Filter > Transformations > Transform. In File > Font Info > Features, push the Refresh button, and Glyphs will generate the sups (superscript) feature.

Please note that with this method, the superior glyphs will receive separate Unicode values. Thus, the feature will mess with the characters. If you want to avoid that, use the .sups suffix. Glyphs with dot suffixes do not get Unicode values.

Subscript: subs vs. sinf

What? Two different OpenType features for subscripts? In the official wording, subs (subscript) is for:

The ‘subs’ feature may replace a default glyph with a subscript glyph, or it may combine a glyph substitution with positioning adjustments for proper placement. […] Note: This is a change of semantic value. Besides the original character codes, the application should store the code for the new character.

The point is that subs can trigger a ‘change of semantic value’, i.e. fiddle around on the character level. Theoretically, OpenType features are not supposed to do that, but in this case, Unicode already had subscript figures encoded, so we might as well re-use them for the feature.

And sinf (scientific inferiors) is intended for scientific use:

Replaces lining or oldstyle figures with inferior figures (smaller glyphs which sit lower than the standard baseline, primarily for chemical or mathematical notation). May also replace lowercase characters with alphabetic inferiors.

So, when the chemical formulae for carbon-dioxide and water need inferior twos, this is a job for sinf:

It is totally legit that you want your subs figures to be identical to your sinf figures. You can achieve that if you employ the .subs suffix. Glyphs will then generate both the subs and the sinf feature with them. In that case, we can make compound copies of the numerators and, if necessary, push them down with the Transformations filter. But first, paste this in the dialog that appears after you call Font > Add Glyphs…:

zero.numr=zero.subs
one.numr=one.subs
two.numr=two.subs
three.numr=three.subs
four.numr=four.subs
five.numr=five.subs
six.numr=six.subs
seven.numr=seven.subs
eight.numr=eight.subs
nine.numr=nine.subs

If you do want to differentiate between subs and sinf, then use the inferior suffix (without a period) for subs, so it can apply its semantic changes alright. Likewise, you can use the .sinf suffix for the sinf feature. To get the party started, here is the glyph recipe for Font > Add Glyphs…:

zero.numr=zero.sinf
one.numr=one.sinf
two.numr=two.sinf
three.numr=three.sinf
four.numr=four.sinf
five.numr=five.sinf
six.numr=six.sinf
seven.numr=seven.sinf
eight.numr=eight.sinf
nine.numr=nine.sinf
zero.numr=zeroinferior
one.numr=oneinferior
two.numr=twoinferior
three.numr=threeinferior
four.numr=fourinferior
five.numr=fiveinferior
six.numr=sixinferior
seven.numr=seveninferior
eight.numr=eightinferior
nine.numr=nineinferior

Again, Filter > Transformations > Transform will help you move the figures into the right position.

SAMPLE FONT: MARTHA, COURTESY OF LISA SCHULTZ.

Multiple Masters, part 1: Setting up masters

$
0
0

The Adobe technology involved in interpolation is called ‘Multiple Masters’. That’s because we need at least two masters in order to calculate steps between them. To be precise, Multiple Master used to be a font format that would allow the user to interpolate his own fonts. Probably due to its complexity, it never really gained much traction, and was discontinued in the late nineties.

However, for making large font families, the Multiple Master interpolation technique still plays a significant role in modern typeface design. Needless to say, it is built into Glyphs. But before dealing with Multiple Masters, you must understand the difference between masters and instances.

Masters vs. Instances

Masters are what you draw. They are the input for the ensuing interpolation. Masters are organized in the Masters tab of the Font Info. You draw them on different layers of each glyph. When you are working on a family, you constantly jump back and forth between masters to make sure they will interpolate nicely.

Instances are what the computer calculates. They are the output, the result of the interpolation. Instances are organized in the Instances tab of the Font Info. In the case of Glyphs, they are spit out as prêt-à-porter OpenType fonts right away. If everything works the way it should, you should never get to fiddle with the points or paths of an interpolated instance.

Setting up Masters

Alright, let’s get the party started. Once you have created a new Glyphs file, you pick File > Font Info and navigate to the Masters tab. One Master is already there:

It is defined as a regular weight and regular width master. Attention: this does not imply anything about the design of the master. As a matter of fact, the regular master may look very thin or even very fat. Rather, it says something about the relative position towards other masters on the same axis.

‘What is an axis?’, I hear you say. Easy: Axes are your interpolation dimensions. Glyphs lets you interpolate along the weight axis and the width axis. For instance, if you have a very thin and a very fat master, they will constitute a weight axis. If you add a medium master between them, you still only have one axis, since you will only be interpolating one-dimensionally.

If you then add a narrow master, you will open up a second axis, and be able to interpolate two-dimensionally. These are possible axis set-ups in Glyphs:

Whoa, wait a minute, let’s keep it simple for the moment, and just add one fat master. To do that, we simply click on the plus button in the lower left corner of the Masters tab in File > Font Info. Glyphs will add a second master called Regular.

Now, you will agree that you cannot interpolate between the middle of an axis and the middle of the same axis. So, we need to move the second master to one end of the axis. To do that, you activate it by clicking it in the sidebar and change its Weight entry to Bold:

Congratulations, now you have two masters on a weight axis!

Switching between Masters

Now, drawing is easy. Actually it is just like drawing anything else in Glyphs. The only difference is that you have to draw on two layers, corresponding to the two masters you have set up. To switch between the master layers, simply press Cmd-1 and Cmd-2, i.e. the command key and the number of the master. Alternatively, you can use the buttons in the top left corner of the main window:

Drawing the Masters

Okay, switch to the Regular master and draw a letter. Personally, I like to start with the n because you can recycle its shape for a lot of other letters. So here is my n:

Of course, it is much too light for what people would call a Regular in real life. But remember, here, the term ‘Regular’ only says something about its position on the axis, and nothing about the design of the letters.

Once you are finished with your n, select all and copy it to your clipboard. Then, press Cmd-2 to switch to the Bold master, and paste your n there. Then start moving the nodes and make the n super-fat. Usually, you want to reduce white space, so the letter can appear darker. After all, a bolder weight is supposed to achieve a darker color on the page. Thus, it is as important to make the counter smaller as it is to reduce the sidebearings a bit.

Pro tip: When moving a node or a segment, simultaneously holding down Ctrl and Opt may prove to be helpful, because it will proportionally adjust the surrounding handles while you are dragging or arrowing.

You can always switch between them with Cmd-1 and Cmd-2. But once you are finished with the bold n, you deserve to take a look at them both side-by-side. You can do that with Edit > Show all Masters. Here is what my two n masters look like, including a subtle reminder about the shortcuts for accessing the masters:

Setting the Master Values

Now is a good moment to find out how thick our stems are. The width of the stem is a useful key value for determining the weight of a type design. That is why we recommend using the stem width as master values on the weight axis.

To quickly determine the width of a stem, simultaneously hold down Ctrl, Cmd and Opt. This will temporarily bring up the Measurement Tool (L). Add the Shift key, if you still have a free finger, and you can drag a horizontal line across your stem to see what its width is. Do that for both masters. In my case, it is 70 and 190:

For each master in File > Font Info > Masters, you can now replace the default Weight value of 100 with the number you have just determined:

Entering other Values

Well, I suppose I couldn’t keep this a secret for long, because you have seen all the other entry fields in the Masters tab of the Font Info. Yes, as you would expect, all the number values there will be interpolated, as long as all entries are reciprocated in all masters. In other words, it will not suffice to enter alignment zones in only one master. You need to enter the corresponding zones in the same order in the other master as well. Now, Glyphs knows between which numbers it is supposed to interpolate. This also accounts for stem values, vertical metrics and all numbers entered in custom parameters.

Read on: Multiple Masters, part 2: Keeping your outlines compatible

Update 2014-06-20: Fixed typo in Interpolated Nudge pro tip. (Thx Jeff Kellem.)

Multiple Masters, part 2: Keeping your outlines compatible

$
0
0

Understanding Outline Compatibility

When interpolation happens, what actually is being interpolated are the x and y coordinates of each and every node and handle. These coordinates are stored in a specific order, which must be the same in every master.

In short, to interpolate, we need compatible outlines. To achieve outline compatibility, we must make sure:

  • all masters have the same amount of paths, nodes and handles,
  • all paths, nodes and handles are in the same order across all masters.

That’s it! That’s all we need to make the magic of interpolation possible.

Making Sure Outlines are Compatible

Glyphs helps you keep your outlines compatible. Glyphs with incompatible outlines are marked with a red triangle in Font View or a red stripe at the top in Edit View. However, the red indicator will only be shown if there is at least one instance set with interpolation values different from the master values. In other words, Glyphs will bug you about the incompatibility of your outlines only if you are actually trying to interpolate something.

So, until we have an instance, we can make use of the very handy View > Show Master Compatibility (Ctrl-Opt-Cmd-N). The Compatibility View indicates a couple of things:

  • Compatible outlines are marked green.
  • Compatible outlines with potentially troublesome deviating angles are marked in yellow.
  • Incompatible outlines are marked red.
  • Selected points show blue lines that connect them to their respective counterparts in the other masters.
  • Red numbers indicate the order of the paths and their starting points.

If everything is fine, it should look something like this:

You see, only green lines, and all the blue lines connect the right dots with each other. If you look closely, you can see the grey outline of the other master too, for better reference. In any event there is nothing to fix here, and we can move on to the next letter.

This case is already a different story:

The counter is yellow. This means that the shapes are compatible, so it will interpolate alright, but there might still be something wrong. Now, sometimes, this is just a false alarm, because Glyphs must do some guessing. But pretty often, it rightfully indicates an angle changing to much. In this case, the blue lines show that the vertical parts change into a horizontal position in the other master and vice versa.

Such situations are usually fixed by invoking Layers > Correct Path Direction (Cmd-Shift-R) and perhaps also Layers > Tidy Up Paths (Cmd-Opt-Shift-T) in all masters. Remember, you can quickly switch between masters with the Cmd key plus the number of the master. So, in our case, we would simply have to push Cmd-1 and Cmd-2.

Now, take a look at this hopeless case:

Oh no, the blue lines shoot across the picture in just any old way they please. And my goodness, there even is a completely incompatible red segment. Interpolations of this letter will not export. So, what do we do?

Well, all is not lost, since we can still switch between masters with Cmd-1 and Cmd-2. Our job is simply to make sure that all masters have the same number and order of nodes and handles, as well as the same number and order of paths. It should not be too hard to spot the excess point and remove it. Or spot the missing point and add it. Your mileage may vary greatly, though.

Be suspicious

One potential pitfall lurks in glyphs with two point-compatible shapes in each master, even when Glyphs marks the glyphs as compatible. Think of cases like the equal sign (=), the colon (:), quotedblbase („), or the divide sign (÷), just to name a few. If you take a look at these glyphs, with View > Show Master Compatibility enabled (Ctrl-Opt-Cmd-N), and you see the blue lines crossing or bypassing each other, well, you have a problem:

The masters are perfectly compatible, all outlines are green. But the vertical blue line indicates that the top dot is interpolating with the bottom one, and vice versa. Not good. Not good at all. Unless you want your divide sign to pingpong your dots around.

In this case, you can try going through all masters (Cmd-1, Cmd-2, etc.), and picking Layers > Correct Path Direction (Cmd-Shift-R). This should reorder your paths automatically. If that does not fix it, you can try and reorder the paths manually by selecting and cutting one path after the other to the clipboard (Cmd-X) and immediately pasting it back again (Cmd-V).

In order to find all glyphs that are in danger of being pingponged around, you can use the script Masters > Open Tab with Dangerous Glyphs for Interpolation on my Github.

Keep your Overlaps

Now, you may once have heard that all path overlaps must be removed in a font. Well, forget about it, because this is a technical problem that Glyphs can take care of nicely. Actually, for the purpose of interpolation, keeping overlaps in the paths is much smarter. Here is one typical example to understand why:

Look at the leg of the R. You can see it bypasses the lower node of the bowl. Keeping the leg and the bowl separate ensures easier interpolation. Besides, it also makes editing the R much easier, which is nice.

In case you have removed overlaps already, or you have been avoiding overlaps from the start, you can get them back by selecting a corner node, bringing up the context menu and choosing Open Corner. Or select two nodes and choosing Reconnect Nodes from the context menu:

Avoiding Kinks

There is one serious problem you should know about. It can only occur if you have a three points in line to form a smooth connection of some kind, like this:

Now, trust me on this. If this constellation meets both of the following criteria, you will run into problems: firstly, if the angles are different in the masters, and secondly, if the proportions between the points are different, i.e. the relation between the length between first and the middle point to the length between the middle and last point. Should all of this apply to one of your paths, a kink can happen in interpolation:

This means that either angle or proportions must be kept the same between masters, at least in the likely case that you want to avoid such kinks.

A good way to avoid running into these problems is to keep all your smooth curve connections either horizontal or vertical: Shift-click with the Pen tool (P) to add extremum points, then remove the diagonal points, one by one. That way, the angles are the same, and we do not need to worry about kinks anymore. Hurrah!

Sometimes, however, your design will require such a point constellation, and you will not be able to keep angles in sync in both masters. In this case, you will need to keep proportions in sync.

You have two options. You can either try to do that manually: select the middle point, and make sure it is green, i.e., defined as curve point rather than corner point. You can switch between curve (green) and corner (blue) by pressing the Return key. Then, hold down the Option key and move the point along the line between first and last point, either with the mouse or the arrow keys:

Or you use the Masters > Dekink Masters Script from the Mekkablue collection of Glyphs Scripts. The way you do that is as follows: you go to the Master where you think the proportions are best, select the middle point, and run the script from the Scripts menu. It will then find the corresponding constellation in all other masters, and push the middle point to the same relative position between the other two as in the visible master. Phew, sounds super-complicated, but it is not that difficult. Take a look at this short video and judge for yourself.

Now, ye all go forth and make your masters compatible!

Read on: Multiple Masters, part 3: Setting up instances

Update 2014-03-07: Added link to Python script in section ‘Be suspicious’.
Update 2014-08-23: Updated link for the Dekink demo video.

Multiple Masters, part 3: Setting up instances

$
0
0

Okay, so we have set up our masters for interpolation, and then, we made sure the paths in our glyphs are compatible. Now it is time to determine our instances. Each instance will be one font in the font family we are about to generate.

Setting up instances.

Okay, let’s get this done. Go to File > Font Info > Instances and push the Plus button at the bottom left. Glyphs will then insert a Regular instance:

Now, there are three super-important fields in an instance. Firstly, the Style Name must be unique for each font family. Choose your style name wisely, because a lot depends on it. You can use uppercase and lowercase letters, even space. But for better compatibility, it is a very good idea to only use ASCII characters for the style name.

Then, take a look at the Weight popup right below the name. At first sight, this may seem like a redundant repetition of the Style Name field. But it is not, because it determines the little grey number next to it, which in turn determines the font menu order, at least in Adobe applications.

And, most importantly, there’s the Interpolation value for Weight. Remember the stem widths we used as Master values? In our example, it was 70 and 190. The weight interpolation value must be a number in between. In other words, whatever number you put in here will be the stem width of this font! Cool.

So, let us add a few instances with the Plus button in the lower left corner of the window. Then, we should make sure, each of them has its own style name, weight setting, and an interpolation value between (and including) 70 and 190, or whatever your master stem values are.

Then go back to an Edit tab in the main window, open the Preview section by clicking on the eye icon in the lower left corner of the window, then pick an instance from the popup menu next to it. Resize the preview area by dragging the separator line. The preview will always center on the current glyph.

Or, even better, simply export into the Adobe Fonts folder, and all fonts will be available immediately in InDesign or any other running Adobe app. Cool.

Keep Your Style Name Short

One good piece of advice: Keep your style name short to avoid problems in Windows. How short? Well, you are on the safe side if the combined length of family and style name does not exceed 20 characters. If the name is too long, Windows may think the font is invalid.

But sometimes, you will not be able to keep it short enough. Imagine a style name like Condensed Ultralight. Unless you have a very, very short family name, you will run into problems.

In cases like this, use shortened versions of the parts that make up the style name. For instance, use Cd for Condensed, Xt for Extended, Lt for Light, Rg for Regular, Md for Medium, Sb for Semibold, Bd for Bold, Hv for Heavy, Bk for Black, Ultr for Ultra, etc.

Then, add a custom parameter called preferredSubfamilyName, and set its value to the long version of the name. This is going to be the name that will actually be displayed in the user interface. Speaking of which, you can also shorten the family name, and use a preferredFamilyName parameter for the unabridged version of the family name.

Take Complete Control of Font Menu Order

As I mentioned above, the Weight popup below the name determines the order in the font family submenu, at least in Adobe applications. But how? Well, it does so by changing the little grey number next to the popup menu. It is called the weight class. Look closely:

In a nutshell, smaller number equals lighter weight equals higher position in the font menu. On a side note, and to make things more complex, the width class one row below takes precedence over the weight class. But if we only employ a weight axis, that is not really important.

There is a potential pitfall here, though. Some of the options in the popup value lead to the same weight class number:

ExtraLight, Thin, UltraLight: 250
Light: 300
Normal, Regular: 400
Medium: 500
DemiBold, SemiBold: 600
Bold: 700
UltraBold, ExtraBold: 800
Black, Heavy: 900

So, what if we have two very light weights, and we want to differentiate between Thin and UltraLight? The weight class would be 250 in either case, so the font menu order is undetermined.

Fear not, there is a simple solution. In the Custom Parameters section, at the bottom of the window, add a new parameter by clicking the green plus button. Set the Property to weightClass and its Value to something a little larger or smaller, e.g., 255 or 245. Remember: the smaller the value, the higher up in the font family submenu it will end up.

Linear, Luc(as), and Pablo Distributions

Okay, we know how too pick a spot on the interpolation axis. But how do we know what is a good spot? Assuming we have a Light and a Bold Master, and we use their values for the Ultralight and Heavy instances, then where exactly between those two should we put the Light, Regular, the Medium, the Semibold, the Bold instances?

As a first step, it may appear to be a good start to distribute them evenly, so the difference between two subsequent weight values is always the same. E.g., your Light Master is at 20, your Bold Master is at 140. Then the instance values would be: 20, 40, 60, 80, 100, 120, and 140. The difference between two instances is always 20. We call this a linear distribution of stem weights, or simply, equal steps. But, alas, it doesn’t work that well:

There is too little difference between the instances in the middle of the spectrum. And unfortunately, this is where it counts most. They just look too similar, I couldn’t tell which one is supposed to be the Regular, the Book, or the Bold. Clearly, we need better interpolation values.

Enter interpolation theory. It was the great Luc(as) de Groot who noted that it is not the absolute difference that counts, but rather the stem growth percentage. In the above example the first step, between 20 and 40, is an increment of 100%. The the second step, between 40 and 60, only of 50% anymore. The precentages gradually decline until the end, where, between 120 and 140, we count an increment of merely 16.67%. In search of a better solution, De Groot himself suggested to keep that growth percentage constant (at least for vertical stems). This has become famous as the Luc(as) Formula or the Luc(as) distribution. According to this, the relative visual difference stays the same, whereas the absolute difference is small at first, but grows larger towards the end of the spectrum:

Certainly an improvement. The worst thing you can say about it is that there are too many light weights. Big deal, we’ll just leave out one, or we could just make one step less in total. And perhaps, the jump between the two boldest weights is a pretty big one, but still the last three weights would make a good set of Regular, Semibold, and Bold. Does it always work that well?

No, says the incomparable Pablo Impallari. He thinks that if you interpolate from very thin to very bold, the Luc(as) distribution causes steps to become too large at the bold end of the axis. In other words, from what looks like a Semibold, it immediately jumps to what most people would perceive as a Heavy. We could easily fit another instance in there.

In other words, if the interpolation spans from very much white and very little black (Light) all the way to very little white and very much black (Heavy), then we need smaller steps towards both ends of the axis. After all, a small step at the beginning may already cause the stem to double, and a small step at the end may cause the little white counters to be cut in half. So, at the beginning, we need a distribution that is more like the Luc(as) distribution, and at the end, we need something that looks more like a linear distribution. Mathematicians would calculate a so-called ogee curve between those two distributions. In type design land, this has become known as the Pablo distribution:

Pablo Impallari himself has come up with the wonderful Family Stem Weight Calculator. You can use it to calculate linear, Luc(as), and Pablo distributions.

Or you can use the Insert Instances script, which is part of the Masters scripts in the mekkablue script collection. The script will directly insert the instances in the Instances tab of your Font Info window.

Whichever method you choose, please see it as a starting point. The mileage varies greatly between different designs. In the end, let your eye decide the precise distribution of stem weights.

No Grid for Light Weights

Especially Hairlines, Thins, and Lights suffer from grid-snapping to integer coordinates. One unit may already be a lot for a thin weight, and cause distortions when the overlaps are removed and the resulting nodes are grid-fitted. So, if you do have very light instances in your interpolation, consider disabling forced integer coordinates by setting File > Font Info > Other Settings > Grid Step to zero:

Phew, now we deserve a coffee break.

Update 2013-12-14: Removed a usage note for the Insert Instances script, because it is not necessary anymore in its latest version.

Creating an Icon Webfont

$
0
0

Practically all recent web browsers have the possibility to display webfonts. So it is a good idea to save some bandwidth and put your icons into a font instead of converting them to JPEGs, PNGs, GIFs, or SVGs. What’s more, you get to avoid rasterization, and thus, keep resolution independence for your icons.

Creating a new icon font

So, start Glyphs, choose File > New, and save your working file to a location convenient to you with File > Save. Then, give your font a name by going to File > Font Info > Font. Fill in the Family Name, and if you want, the designer (the person who drew the icons) and his or her URL, the manufacturer (the person or company who produces the font) and his or her URL. Eventually, you can click on the Refresh button with the circled arrow to have Glyphs generate the Copyright notice for you.

Or, if you do it in Glyphs Mini, the Font Info is a tab of the main window:

The other stuff is not important to us. When you are done, close the Font Info window (or tab) to return to the Font window, and perhaps save your font again.

Creating PUA glyphs for your icons

The slots inside a font are called glyphs (hence the name of our favorite font editor), and those glyphs usually correspond to characters. In short, characters are what you type, glyphs are what you see. The character-glyph relationship is established through the Unicode value assigned to a glyph. Sometimes, glyphs do not have Unicode values, but in our icon font, each glyph will have one. If you want to know more about Unicode, glyphs, and characters, read the Unicode tutorial.

Into a Unicode-assigned glyph, you should only put pictures that match the meaning of the Unicode value. So, for instance, into U+0041 LATIN CAPITAL LETTER A, you should only ever put something that at least vaguely resembles an A. Why not an icon? Because it can confuse search engines, the search function of your website, or the person trying to make sense of what is displayed on the screen if, for some reason, our icon webfont cannot be loaded and is substituted with a fallback font.

So, the first thing we do in the Font window, is select all glyphs and click on the Minus button at the bottom of the window. When Glyphs asks you whether you know what you are doing, say Remove:

Fine, so we have no more letters in our font, but where do we put our icons now? Easy: In new glyphs associated with Unicode values in the Private Use Area (PUA).

Private what? Let me explain. In the long, long range of Unicode values, there are a few reserved for whatever you intend to use them for, or, in other words, for private use, as the nice folks from the Unicode Consortium call it.

The Unicode standard knows a few PUAs, but the one most convenient to us is the PUA inside the Basic Multilingual Plane (BMP, i.e., all Unicodes from U+0000 to U+FFFF). The PUA in the BMP ranges from U+E000 to U+F8FF.

So, how do we create a glyph there? Click on the Plus button, next to the Minus button you just pressed. A new glyph called newGlyph will appear. It will look something like this:

Now, you must know that Glyphs auto-sets the Unicode value of a glyph based on the name you assign to the glyph in question. So, should you call your glyph B, Glyphs will set its Unicode to U+0042, which is the Unicode for LATIN CAPITAL LETTER B. To put your glyph into the PUA of the BMP, you have to call it uni plus a four-digit hexadecimal code between E000 and F8FF. In other words, anything between uniE000 and uniF8FF is fine:

You will see that the category changes to Private Use. Also, both the placeholder image and the Unicode value of the glyph changed to reflect that this glyph now officially resides inside the Private Use Area. Cool.

Or wait, not so cool, actually. This is not a biggie if you only have two or three icons, but if you have, like twenty, a hundred, or even more icons, these names are not much of a help. Here’s a little trick. Once you have assigned a glyph to a Unicode value by changing its name to uniE000 or the like, you can change its name again, this time to something descriptive like twitterIcon or shoppingCartIcon, and the glyph will keep its Unicode value:

Keep an eye on that Unicode value after changing the glyph name. If it changes again to something outside the PUA, chances are you picked a name that is reserved for another glyph. Glyphs has a built-in list of glyph names it recognizes, and you can see it in Window > Glyph Info if you like. Or simply add Icon to the end of the glyph name and you will avoid all trouble.

One word about glyph names. Only use upper- and lowercase ASCII letters, i.e., A-Z and a-z, perhaps figures (0-9) at the end of the name. Spaces are not allowed, and the name must not start with a figure. So, homeIcon and loginIcon are okay, but names like home button and MäxIcon are not okay. If you want to know more about glyph names, read through the Getting your glyph names right tutorial.

Preparing your icons in other apps

Glyphs provides great drawing tools, but chances are you already have vector icons. From most vector apps, you can simply copy and paste into Glyphs. And since scaling in Glyphs can lead to rounding errors, it is best to scale your artwork to the right size before you bring it into the font.

Keep in mind that one point in Illustrator etc., will be one unit in Glyphs. And, usually, you will want your icons to be approximately the size of a capital letter. The average cap height is 70 percent of the UPM (units per em) size. And since by default, the UPM is set to 1000 units, the average cap height will be 700 units.

So, before you copy and paste your icons into Glyphs, scale them up to approximately 700 points in the originating application.

This is all you need to know for this tutorial. If you are curious and want to know more about moving vectors between Adobe Illustrator and Glyphs, you can read about it in the Importing from Illustrator tutorial.

Also, you can minimize rounding errors by setting File > Font Info > Other Settings > Grid Step to zero, or setting the Subdivision to ten or a hundred. All coordinates will be rounded according to these two settings.

Why is there rounding at all, you ask? Well, some font formats only support coordinates rounded to full units, and full units actually make editing easier.

Putting icons into your font

Alright, now we are ready for our first icon. Double click your glyph with the PUA code, and Glyphs will open a new Edit tab and insert that glyph for you. Your glyph will look something like this:

You see a set of lines, a grey placeholder image behind them, and a grey glyph info box below. Press Cmd-zero to scale the glyph to the size of the window.

The lines are called glyph metrics. The second line from below is the baseline. You want to put your icon on it. The second line from above is the cap height, by default at 700 units. You want your icon to reach that height. The other horizontal lines are the ascender (by default at 800), the x-height (500), and the descender (-200). You can change these values in File > Font Info > Masters (or simply File > Font Info in Glyphs Mini), but keep the values in the same ballpark. Changing them too much can cause headache later. You want further reading on this? You got it: the Vertical Metrics tutorial.

The two vertical lines denote the left and right sidebearings, often abbreviated as LSB and RSB. The distance between them is called the advance width or simply the width of the glyph. You can change those via the grey info box at the bottom.

The placeholder image will disappear as soon as there is any drawing in the glyph. So, let’s simply draw or paste our icon into it:

To optimize your paths for font rendering, select all paths (or deselect everything), and call these commands: Layers > Correct Path Direction (Cmd-Shift-R), then Layers > Add Extremes, and finally, Layers > Tidy Up Paths (Cmd-Opt-Shift-T). In Glyphs Mini, these commands reside in the Glyph menu. If you want to know more about what makes a good path good, please read the Drawing good paths tutorial.

Do not forget to adjust left and right sidebearings by putting numbers into the L and R fields of the grey glyph info box. If you do not know what a good value is, start with 50 for both LSB and RSB:

You can always change the sidebearings later, and even batch-set them for all selected glyphs in the Font tab. If you want to learn more about spacing (which is what type designers call the process of adjusting the sidebearings), read the Spacing tutorial.

Congratulations, you have your first icon in your icon font! This is a good time to save your font again (Cmd-S), and switch to the Text tool (T) to admire your creation in its full anti-aliased beauty:

You can edit your glyph again if you move your cursor before (i.e., to the left of) the glyph and choose the Edit tool (the pen symbol in the toolbar) or simply press the Esc key.

Pixel perfection

Pixel perfection is totally overrated. But if you really, really must, then please read the Pixel perfection tutorial.

Batch-creating glyphs

You can create more than one glyph via Font > Add Glyphs… (Cmd-Shift-G, not available in Glyphs Mini) and entering their names, separated by spaces or newlines, e.g.:

uniE000
uniE001
uniE002
uniE003
uniE004
uniE005
uniE006
uniE007
uniE008
uniE009
uniE00A

… and so on. Once you press the Generate button, the glyphs will be added to the font. If you have an Edit tab open, they will also be inserted in your sample string.

Testing your font

In theory, all you need to do, is export your font via File > Export (more on this further below), and you are ready to go. But…

There is one problem with test-driving an unfinished font, and it is called font caches. Seriously, read through these two tutorials before you decide to test your font: firstly, Eliminating font cache problems, and, if you happen to have Adobe apps on your Mac, Testing your fonts in Adobe apps.

Almost every other support issue we encounter is a font cache issue. So, trust me, your life will be much, much easier if you carefully read through those two articles. Grief and frustration await you if you don’t. Your choice, really, but don’t tell me I didn’t warn you.

Exporting a webfont

Currently, Glyphs can only export OpenType fonts (and UFO and PHF, but these are not relevant to us). So, once you have your icons together, choose File > Export (Cmd-E), select Use Production Glyph Names and Remove Overlaps, deselect the other options, click Next… and pick a saving location for your font:

Glyphs will save an OTF for you. But most web browsers don’t like OTFs. I recommend you convert it to both an EOT (for Internet Explorer, especially prior to version 9) and a WOFF (for all other browsers). You can do that with a web service like the Font Squirrel Generator, or free tools like FontPrep.

Putting the icons on your webpage

So, now that we have our webfonts, how do we put those icons on the webpage? I assume you know how to create a font-face for your EOT and your WOFF. If you don’t, well, read through this and this and this or whatever else you can find on Google about it.

Once you have the font-face declared, introduce a pseudo-selector like this in your CSS:

[data-icon]:before {
   font-family: "My Icon Font";
   content: attr(data-icon);
   speak: none;
}

The HTML5 data attribute keeps your CSS generic, so you do not need to declare extra classes for every icon, but can reuse data-icon. Insert an icon in your HTML code through an empty span with an aria-hidden attribute:

<span aria-hidden="true" data-icon= "&#xE000"></span>

You see the Unicode value E000 in the data-icon attribute? This way, your content stays semantically sound, and thus, screenreader-friendly. Or, more generally put, device-independent.

Nifty. Have fun with your webfonts! And enjoy the speed gain over pixel image (and SVG) solutions.

Thanks to Markus Greve for his great talk at tgm Webfontday 2012.

Features, part 4: Positional alternates

$
0
0

One of the main problems for script fonts and similar designs is that the letters adopt different shapes depending on their relative position inside a word. In total, we can differentiate four possible positions:

  • .init: initial forms at the beginning of a word
  • .medi: medial forms in the middle of a word
  • .fina: final forms at the end of a word
  • .isol: isolated forms for when a letter stands all by itself

The four-letter codes init, medi, fina, and isol are the names of the corresponding OpenType features. And you may have guessed it already: You can trigger the automatic creations of these four features by appending their names as suffix to the glyphs. E.g., if you have both adieresis and adieresis.init in your font, then Glyphs can automatically generate the init feature for you. All you need to do is click on the Refresh button (marked with a circled arrow) at the bottom left in File > Font Info > Features and re-export your font.

The trouble is only that very few applications make use of the features by default. For instance, in InDesign, you need to activate Automatic Positional Forms in the OpenType options. Many users still do not know how to handle OpenType fonts, and will send you support e-mails. After all, for them, the font they spent their hard-earned money on does not seem to work. The mere phrase ‘activate automatic positional forms’ can drive fear into the hearts of some people.

So, in order to save you a lot of time and nerves, we should find a way to have positional forms automatic by default. As it so happens, there is a way. Stay tuned.

Medial forms as defaults

Now, in this tutorial, I will make two assumptions: Firstly, I assume that your default glyphs are medial shapes. Secondly, I assume that there are all four variations for each letter. That means that there are default glyphs like a, b, c and so on, all with medial shapes, plus three variations with .isol, .init and .fina suffixes for each of them. If that does not apply to your design, you will have to adapt the code accordingly, but that will prove to be pretty easy after you have read through this tutorial.

Creating OpenType classes

I think it is pretty clear. We need four classes:

  • Isolated for isolated glyphs with a .isol suffix
  • Initial for initial variations with a .init suffix
  • Medial for the default medial letters without suffixes
  • Final for the final forms carrying a .fina suffix

Let’s start with Isol: This one is easy, we just need to type .isol into the search field in the bottom right corner in Font View. Glyphs will narrow down the selection to all letters that have .isol in their name. All we need to do now is select all displayed glyphs (Cmd-A), and choose Copy Glyph Names from the context menu.

Now, we have the glyph names of all .isol glyphs in our clipboard. So, we go to File > Font Info > Features, click and hold the Plus button in the lower left corner, and pick Class from the pop-up menu. A new OpenType class named xxxx will appear, and we simply change its name to Isolated. Then, we paste the the glyph names into the code field.

But there is one problem. The code looks like this:

/A.isol/B.isol/C.isol/D.isol/E.isol/F.isol/G.isol/H.isol/I.isol/J.isol/K.isol/L.isol/M.isol/N.isol/O.isol/P.isol/Q.isol/R.isol/S.isol/T.isol/U.isol/V.isol/W.isol/X.isol/Y.isol/Z.isol/a.isol/b.isol/c.isol/d.isol/e.isol/f.isol/g.isol/h.isol/i.isol/j.isol/k.isol/l.isol/m.isol/n.isol/o.isol/p.isol/q.isol/r.isol/s.isol/t.isol/u.isol/v.isol/w.isol/x.isol/y.isol/z.isol

I.e., the names of the glyphs with a preceding slash (/). But for the OpenType class, we need the names without slashes, and separated by wordspaces. So, press Cmd-Shift-F to bring up the search and replace function, and replace / (slash) with   (space):

bq.Note: This search and replace trick does not work in systems before OS X 10.7 Lion. If you are running an older system, please do the replacing in a plaintext editor of your choice, and paste the result back into the class definition in Glyphs.

Your class code should now look something like this:

A.isol B.isol C.isol D.isol E.isol F.isol G.isol H.isol I.isol J.isol K.isol L.isol M.isol N.isol O.isol P.isol Q.isol R.isol S.isol T.isol U.isol V.isol W.isol X.isol Y.isol Z.isol a.isol b.isol c.isol d.isol e.isol f.isol g.isol h.isol i.isol j.isol k.isol l.isol m.isol n.isol o.isol p.isol q.isol r.isol s.isol t.isol u.isol v.isol w.isol x.isol y.isol z.isol

Much better. For the remaining classes, our task is clear and easy: We copy and paste the Isolated class three times by clicking on the class name Isolated and pressing Cmd-c, then three times Cmd-V. You will see four classes named Isolated. Change the names of three of them to Initial, Medial, and Final. Then, click into the code of each new class, and replace the suffix .isol with the respective suffix, or with nothing in Medial.

This way, all classes are in sync, i.e., they have the same amount and order of glyphs stored in them. This is important for the substitution code we are going to write in a minute.

One class definition remains to be made. We also need a class called AnyLetter. Create it through the Plus menu in File > Font Info > Features. Why? Because, for instance, the initial feature will go something like this: Switch a default letter to its initial shape unless there is any letter in front of it.

Okay, but how do we get the complete list of names for all letters in our font? Easy. Go back to Font View, make sure the search field is empty, and click on the Letter category, almost all the way to the top of the sidebar. If you have a multi-script font, and you want to keep this, e.g., to the Latin part of your font, you can Cmd-click on the Latin languages category further below, and thus further narrow down your selection. Now, again, we can select all glyphs, choose Copy glyph names from their context menu, paste it into the code of the AnyLetter class, and replace the slashes with spaces.

And by the way, you can rearrange the classes by simply dragging their names in the sidebar. The order is not important for the features to work, but for you to keep your oversight.

Positional forms as contextual alternates

What we need now is a Contextual Alternates feature, or calt, because what we want to do is substitute glyphs depending on their context. So, our first step will be to create that feature. Again, in File > Font Info > Features, click and hold the Plus button at the bottom left. But this time, choose Feature from the pop-up menu. A new feature called xxxx appears, its name already selected, so we can conveniently change it to calt, in lowercase letters:

Press the Return key to confirm. If you already have other features in your font, you may also click on the Refresh button between the Minus and Compile buttons, so Glyphs can properly re-order the features. As opposed to classes, the order of features does indeed matter. And unless you have a good reason not to, I recommend you follow the default sort order that Glyphs suggests.

Writing the feature code

Remember how I summarized the initial feature: ‘Switch a default letter to its initial shape unless there is any letter in front of it.’

Okay, let’s build it bit by bit. ‘Switch default letter to initial shape’ translates to substituting the Medial class for the Initial class. So, we can start out by writing this line:

sub @Medial by @Initial;

Remember, in the feature code, sub...by stands for substitute…with, and class names need to be preceded by at signs in order to be recognized as classes. And every rule needs to be terminated by a semicolon, otherwise it does not count.

So far so good. But the problem is: this will substitute all default letters (Medial) with their initial forms. And we want to do that only when there is no letter in front of it, or in other words, unless there is any letter in front of it. Or, again in other words, ignore the case where there is any letter in front of it. Sounds great, because we have a class called AnyLetter and the AFDKO feature file syntax knows an ignore sub statement. And this is how we write it:

ignore sub @AnyLetter @Medial';
sub @Medial' by @Initial;

Click the Compile button to see if you got everything right.

I need to focus on two things here: Firstly, the ignore sub statement precedes the sub statements it is intended for. That means that all following sub statements only count if the ignore sub condition is not fulfilled. Tricky. We’re good for now, but it will cause us some headache later. Read on.

Secondly, look at the tick marks ‘. In the ignore sub rule, we state that the exception counts for all glyphs in the Medial class. And in the following sub rule, we need to mark it again. Well, I suppose, here it would be clear, because there is nothing else being substituted. But we still need to mark it because it doesn’t need to be the same class as in the ignore sub statement above. It could be two different classes sharing a few glyphs. Plus, it could be a more complex contextual substitution.

Let me stress that again: You need to tick-mark the respective glyph classes in both the ignore sub and the sub statement. If your ignore sub does not work for you, you probably forgot one or both markers. Don’t worry, happens to the best of us.

Let’s see if it works already. In a new Edit tab, just type n a couple of times, and from the Features pop-up menu in the lower left corner of the window, choose Contextual Alternates.

Yes! It works! So, in theory, we just need to do the same thing for Isolated and Final, right? Right?!

No, not quite. Being the smart girls and boys that we are, we remember that the ignore sub statement counts for everything that follows. And three ignore sub statements would definitely get in each other’s way. So what do we do?

Lookups to the rescue!

Actually, I did not tell you the whole truth before. An ignore sub does not count for everything that follows, but just for everything that follows in the same lookup.

Huh? Lookup? What’s a lookup? Well, within a lookup, you can summarize a couple of rules under a name, and if you like, conjure them up again later. So, we need to put everything we wrote so far into a lookup, and give it a name. This is how we do it:

lookup INITIAL {
   ignore sub @AnyLetter @Medial';
   sub @Medial' by @Initial;
} INITIAL;

I chose to call this one INITIAL, for obvious reasons. The syntax is clear: lookup, followed by a name, followed by an open curly brace. Then, all the rules that need to be inside the lookup. You do not need to do it, but you can indent them with Cmd-] if you find it prettier that way. And unindent with Cmd-[ if you change your mind again. At the end, we need to close the curly brace again, repeat the lookup name, and terminate the lookup with a semicolon.

Now, I need to tell you another important thing: between lookup blocks, order counts. Just like it does between features. The font will go through this feature until it finds something appropriate for the current glyph, and it will not look any further than that.

This is why we need to put the lookup with the largest ignore sub first. In our case, this is the one for the isolated variations, because there we need to ignore the case that there is anything in front of it, as well as the case that there is anything behind it. That makes two ignore sub rules. So, do we write two ignore sub statements?

lookup ISOLATED {
	ignore sub @Medial' @AnyLetter;
	ignore sub @AnyLetter @Medial';
	sub @Medial' by @Isolated;
} ISOLATED;

Sure, we could, and it would work that way. Some people, however, prefer to line up the ignored substitution chains between commas, like this:

lookup ISOLATED {
   ignore sub @Medial' @AnyLetter, @AnyLetter @Medial';
   sub @Medial' by @Isolated;
} ISOLATED;

And I am one of those people. So, I will keep it like this, har har.

While we are at it, we might as well add the Final substitutions. This time, the lookup goes to the end:

lookup ISOLATED {
   ignore sub @Medial' @AnyLetter, @AnyLetter @Medial';
   sub @Medial' by @Isolated;
} ISOLATED;
 
lookup INITIAL {
   ignore sub @AnyLetter @Medial';
   sub @Medial' by @Initial;
} INITIAL;
 
lookup FINAL {
   ignore sub @Medial' @AnyLetter;
   sub @Medial' by @Final;
} FINAL;

Again, make super-sure you get all the tick marks right. We always want to mark the Medial class, both in the ignore sub and sub rules. After all, the Medial class contains our default glyphs, and it is them that need to be substituted whenever the occasion demands it.

Okay, push the Compile button. If you get an error, read carefully what the error message is. Did you forget a semicolon? Mistype a class name? Forget an at sign? If you cannot figure it out, there is a lengthy troubleshooting section in the Glyphs Handbook: look for the OpenType Feature Code section in the Error Handling chapter.

If your features do compile, we can test-run them in an Edit tab again. Here is what happens when I type n a few times again:

See the isolated n at the left, and three times after each other on the right, each time in a different shape: initial, medial, final. Cool, high five, for the win!

There’s a script for that!

So you have read through all of this, and you understand the nature of lookup blocks and ignore sub statements. I guess you need a break now.

And here it is: I wrote a script that injects positional code into calt. It analyzes your glyph structure, checks for the suffixes .init, .medi, .fina, and .isol. The best thing about it: It does not assume that your four positional groups are in sync. So the class and code structure will look slightly different, but the basic ideas are the same. If you run the script again, it will update classes and feature code.

Download the Glyphs Scripts repository from my GitHub page. Place the scripts in the Scripts folder (Script > Open Scripts Folder, Cmd-Shift-Y), and reload scripts (with Opt key: Script > Reload Scripts, Cmd-Opt-Shift-Y). You will then find OpenType > Build positional calt feature somewhere in the Scripts menu. Have fun.


Sketching

$
0
0

There are many, many ways for achieving certain letterforms. Most methods, if not all, have in common that they trace the shapes back to the workings of a specific tool. In Latin type design theory, it is usually the broad-nib pen that plays the biggest role in the making of our letters. Other pens are possible, such as those with pointed nibs, or even completely different tools, like brushes. Or, you go the abstract way and try a completely geometric approach.

But many theorists will insist that even if you try to abstract by the means of different tools, it is still the broad nib you are abstracting from. So, in this tutorial, I will focus on the broad-nib pen.

Start with the n

Do not start with the a. Unless you have something special in mind, start with the n. It may not be the first letter in the alphabet, but its shapes reoccur a lot in other letters. It does not take a lot of imagination to turn an n into letters such as h, i, m, r, u etc., so the n is a great letter to start with.

Simulating a broad-nibbed pen

You can build your own broad-nib pen from a goose feather, or you can buy one. There are some modern variations to it, so you will not need to get your hands dirty with dripping ink. With some practice, you can learn to write pretty well with a broad nib.

But chances are, you will not have a broad-nib pen on you when you have that great idea for that letter. So, we will have to fake it. The characteristics of writing with a broad nib are simple: the width of the nib (the ‘front’) is fixed, and its angle in respect to the baseline hardly changes.

Sketching method 1: two pencils

Take two pencils into your writing hand, perhaps tie them together with a rubber band, and start writing. Make sure you keep them at more or less the same angle throughout making the strokes:

Sketching method 2: wiggling

If you only have one pencil available, then you can loosely wiggle left and right while you are leading your hand along the stroke:

The wiggling simulates the broad nib. You will receive a good nib angle if you put the paper in front of you and keep it straight, and just use the natural angle of your lower arm.

Adding details to your sketch

Whichever method you apply to get your first rough sketch, once you have the basic structure, you can see right away where the thicks and the thins need to go. Now, you can take a single pencil, and draw the outline, and add some detail:

Digitizing your sketch

Again, there are different approaches. Here is one that works well for most people. In a nutshell, you start out with straight lines, placing points only very roughly at first. We will add precision and curves later.

First, in your sketch, you mark your corners, your extremum points, and the points where curves change into straight lines. What are extremum points, you ask? These are all points on every curve that have a perfectly horizontal or vertical tangent. So, your sketch may now look something like this:

Approximate nodes

And now, go into Glyphs, and create a new font with File > New (Cmd-N). Double click the n, and pick the Draw tool (P). And now, click to add straight lines, one point at a time. You can do that just very roughly, you do not need to be precise at this stage. Actually going for precision now already is just a waste of time. Just approximately put the nodes between baseline (second line from below) and x-height (third line from below):

Approximate the relative positions of the nodes. For instance, the extremum point on the inner arch appears to be not exactly in the center between the two stems, but slightly to the right of it. Ask yourself questions like: ‘Is the top node above the right stem?’ Place your nodes accordingly. Again, it does not need to be very precise, an approximation will do.

Close paths by clicking in the first point again. Keep overlaps. Again: no curves, no precision yet. Finish this step with Layers > Correct Path Direction (Cmd-Shift-R). Path direction determines whether overlaps appear white or black. The command also reorders the paths and sets the start points (indicated by triangles).

Align and move points

Now, we will start adding precision by aligning points that need to be at the same x or y coordinate. With the Edit tool (V), select points that need to be aligned, and choose Layers > Align Selection (Cmd-Shift-A). You will use this a lot, so it is probably a good idea to memorize that keyboard shortcut:

Glyphs seems to be smart enough to figure out whether you want to align horizontally or vertically. What it does internally, is pick the alignment that is the smallest change.

Now, with the arrow keys on the keyboard, move the points into position. Add Shift for increments of 10 units, and Cmd for increments of 100 units. Put the lowest nodes of your n onto the baseline. Once they reach the line, they will be marked by a diamond indicator.

The extremum point of the top arch needs to be slightly above the x-height (by default at 500 units). We call this the overshoot, an optical compensation that makes sure the arch will later appear to be at the same height as horizontal things at the x-height. Most overshoots are between 10 and 15 units. Around 10 if your design is intended for display sizes, a little more if it is intended for smaller sizes.

Our n now looks like this:

Equalize stems

Then, we need to sync distances between nodes. In the case of our n, that means that we need to make sure both stems have the same width. One stem at a time, select the four nodes that make up the stem. Then, take a look at the grey info box (View > Show Info, Cmd-Shift-I), and make sure the lock is open. That way, we can edit width and height independently of each other.

Now find a good, round value for the stem width, controlled by the number next to the horizontal double arrow on the grey info box. Apply the same width to both stems.

Add curves

Enough of those straight lines already! Switch to the Edit tool (V), hold down the Option key, and click on the segments to add grey handles to the segments. In case you added too many handles, you can select a handle and delete it with the Backspace key, and your segment will be turned into a straight line again.

You can either have two handles on a path segment, making it a curve segment, or, no handles at all, making it a line segment. Perhaps you are used to other vector applications, such as Adobe Illustrator, that make you believe you can also have segments with just one handle. In that case, it may come as a disappointment, and I really hate to be the one that has to break it to you that all those apps have been lying to you for all those years, secretly hiding the second handle behind one of the surrounding nodes. Technically, that is a very bad thing to do, so that is why Glyphs handles handles differently. Read more about drawing good paths here.

Once you have handles on all your segments that need to become curvy, you can simply drag them into position. Handles snap as soon as they are horizontal or vertical, which is what they need to be anyway around extremum points.

Most likely, you will also have two handles inside the overlap in the left stem. Usually, these two do not need to be horizontal or vertical, but at an angle. Make sure they both have approximately the same angle. This will facilitate the next step.

Your n now may look something like this:

Adjust curvatures

Select some handles of the outer curve segment and bring up the Palette (Window > Palette or Cmd-Opt-P). In the Fit Curve section of the Palette, click on the buttons (or press Ctrl-Opt-1 through 8):

You may need to collapse the view from two dimensions to one, like in the screenshot. A curvature of 57% is approximately elliptical. In type design land, we usually need something higher than that. 100% is where the handles intersect. In most cases, we end up with curvatures between 60 and 80 percent.

Now select handles of the smaller inner curve, and give it a higher percentage than the outer curve. Experiment with the values until you are content.

Iron out curve bumps

Perhaps you see something that looks like a little bump in the curve, approximately where the two curve segments meet in the extremum node. That can happen if the actual curvature abruptly changes from one segment to the other. To one side of the point, the curve looks rather flat, towards the opposite side, it looks rather steep.

Select the node, hold down the Option key, and move the node towards the flatter part. You can do that with either the arrow keys or the mouse. By holding down the Option key, you keep the handles where they are, effectively moving the node between the neighboring handles:

If you have the full version of Glyphs, there are third-party plugins available that will help you turn bumpy curves into smooth outlines. Firstly, we can recommend Tim Ahrens’ Remix Tools which contains a filter called Harmonizer (after installation, choose Filter > Harmonizer) that tries to re-arrange nodes in a way that bumps like these get ironed out.

Then, there is Yanone’s psychedelic SpeedPunk tool, that helps you spot curvature problems. It only visualizes the curvatures, you stay in control of your curves.

Ta-daa!

Congratulations, you have finished your first n:

From here, you can either draw the next glyph, or adjust the sidebearings of your letters, or test your font in an Adobe app. Don’t forget to set a font family name in File > Font Info > Font.

Pencil sketches by Stefan Willerstorfer

Creating a Layered Color Font

$
0
0

Layer fonts are fun for the user, but always have been a lot of work for the creator. Well, it has just gotten a lot easier: Glyphs 2 has some major improvements for the layertype designers amongst you.

Create masters and instances

Masters are your layers. So you go into File > Font Info > Masters, and add as many font masters as you need layers. Make sure you give each of them a different Custom name and value, e.g., ‘Front’, ‘Side’, ‘Bottom’, and 1, 2, and 3.

And, while we are at it, you can assign different preview colors to your master layers. That is because layer fonts are no fun if all the layers have the same color. This is how you do it: Add a new custom parameter by clicking the little green plus button just above the Custom Parameters section. In the Property pop-up, you pick Master Color, and in the Value field, a color swatch will appear. Click on the swatch to pick a different color:

Hint, hint: You can even choose a transparency, if you want to simulate an overprint effect.

When you are done, select the Master Color parameter, and copy it to the clipboard (Cmd-C). Then go into each of the other masters, and each time, click into the Custom Parameters section, and paste (Cmd-V). Then you can conveniently click on the swatch and change the color for each layer. The power users amongst you can Cmd-select more than one master in the sidebar, and add or paste the parameter for all master layers at once.

Now, in the Font Info window, switch to the Instances tab. There, you create instances with the exact same weight values we used before. To do that, click on the Plus button in the bottom left, and choose Add Instance for each Master from the menu that pops up.

Using the exact same values makes sure we are not interpolating. That is good because we do not want to interpolate, we just want to draw and export different layers.

Edit the layer glyphs

Once you close the Font Info window, you are taken back to the Font window. Let’s double click the uppercase I, an easy letter, ideal for experimenting and trying some editing.

Using the Master buttons at the top of the window, or the shortcuts Cmd-1, Cmd-2, and Cmd-3, you can switch between the layers. In the Layers section of the sidebar palette (Cmd-Opt-P), the custom names should pop up, along with an indication of the layer color. To the left of each layer name, there is a little eye symbol. Click on all closed eyes to open them. So, all master layers are displayed at once while you edit them.

Press Cmd-1 to go to the ‘Front’ layer, and draw a rectangle from the cap height to the baseline, for the uppercase I:

Then, while the rectangle is still selected, copy it to the clipboard (Cmd-C), switch to the ‘Side’ layer (Cmd-2), and paste (Cmd-V). Select the two leftmost nodes with the Select tool (V), and move them to the bottom right, like this:

Select all (Cmd-A), copy to the clipboard (Cmd-C), switch to the ‘Bottom’ layer (Cmd-3), and paste. Now move the two top nodes to the bottom left position, so that the top of the ‘Bottom’ layer aligns with the base of the ‘Front’ layer:

Now is a good time to hold down your Option key, and choose Correct Path Direction for All Masters (Cmd-Opt-Shift-R) from the Paths menu. Hold down the space bar to temporarily see a Preview, or simply switch to the Text tool (T), and you can see if everything works out as expected:

Congratulations, you have your first layered glyph.

Multiple-layer editing

Speaking of editing, there is a new Select All Layers tool, which allows you to edit any points on any visible layer.

Some menu commands work for all layers at once. You can now Glyph > Update Metrics for All Masters (Cmd-Opt-Ctrl-M) and we have already used Paths > Correct Path Direction for All Masters (Cmd-Opt-Shift-R).

Applying layer fonts in InDesign

You export the fonts just as you would in any other font project. As always, it is a good idea to use the Adobe Fonts folder.

Now, what you need to do in InDesign, is to have multiple text frames with the exact same content exactly on to of each other, each of them with a different font style. You can use InDesign’s place-and-link tool to achieve that.

In any event, you can do pretty good stuff with this:

SAMPLE FONT: SAPPERLOT, COURTESY OF THOMAS MAIER.

Creating a Layered Color Font

$
0
0

Layer fonts are fun for the user, but always have been a lot of work for the creator. Well, it has just gotten a lot easier: Glyphs 2 has some major improvements for the layertype designers amongst you.

Create masters and instances

Masters are your layers. So you go into File > Font Info > Masters, and add as many font masters as you need layers. Make sure you give each of them a different Custom name and value, e.g., ‘Front’, ‘Side’, ‘Bottom’, and 1, 2, and 3.

And, while we are at it, you can assign different preview colors to your master layers. That is because layer fonts are no fun if all the layers have the same color. This is how you do it: Add a new custom parameter by clicking the little green plus button just above the Custom Parameters section. In the Property pop-up, you pick Master Color, and in the Value field, a color swatch will appear. Click on the swatch to pick a different color:

Hint, hint: You can even choose a transparency, if you want to simulate an overprint effect.

When you are done, select the Master Color parameter, and copy it to the clipboard (Cmd-C). Then go into each of the other masters, and each time, click into the Custom Parameters section, and paste (Cmd-V). Then you can conveniently click on the swatch and change the color for each layer. The power users amongst you can Cmd-select more than one master in the sidebar, and add or paste the parameter for all master layers at once.

Now, in the Font Info window, switch to the Instances tab. There, you create instances with the exact same weight values we used before. To do that, click on the Plus button in the bottom left, and choose Add Instance for each Master from the menu that pops up.

Using the exact same values makes sure we are not interpolating. That is good because we do not want to interpolate, we just want to draw and export different layers.

Edit the layer glyphs

Once you close the Font Info window, you are taken back to the Font window. Let’s double click the uppercase I, an easy letter, ideal for experimenting and trying some editing.

Using the Master buttons at the top of the window, or the shortcuts Cmd-1, Cmd-2, and Cmd-3, you can switch between the layers. In the Layers section of the sidebar palette (Cmd-Opt-P), the custom names should pop up, along with an indication of the layer color. To the left of each layer name, there is a little eye symbol. Click on all closed eyes to open them. So, all master layers are displayed at once while you edit them.

Press Cmd-1 to go to the ‘Front’ layer, and draw a rectangle from the cap height to the baseline, for the uppercase I:

Then, while the rectangle is still selected, copy it to the clipboard (Cmd-C), switch to the ‘Side’ layer (Cmd-2), and paste (Cmd-V). Select the two leftmost nodes with the Select tool (V), and move them to the bottom right, like this:

Select all (Cmd-A), copy to the clipboard (Cmd-C), switch to the ‘Bottom’ layer (Cmd-3), and paste. Now move the two top nodes to the bottom left position, so that the top of the ‘Bottom’ layer aligns with the base of the ‘Front’ layer:

Now is a good time to hold down your Option key, and choose Correct Path Direction for All Masters (Cmd-Opt-Shift-R) from the Paths menu. Hold down the space bar to temporarily see a Preview, or simply switch to the Text tool (T), and you can see if everything works out as expected:

Congratulations, you have your first layered glyph.

Multiple-layer editing

Speaking of editing, there is a new Select All Layers tool, which allows you to edit any points on any visible layer.

Some menu commands work for all layers at once. You can now Glyph > Update Metrics for All Masters (Cmd-Opt-Ctrl-M) and we have already used Paths > Correct Path Direction for All Masters (Cmd-Opt-Shift-R).

Applying layer fonts in InDesign

You export the fonts just as you would in any other font project. As always, it is a good idea to use the Adobe Fonts folder.

Now, what you need to do in InDesign, is to have multiple text frames with the exact same content exactly on to of each other, each of them with a different font style. You can use InDesign’s place-and-link tool to achieve that.

In any event, you can do pretty good stuff with this, like Thomas Maier (DrTypo) did with his font Sapperlot. Thomas open-sourced the .glyphs file, so head on over to his GitHub page and take a closer look:

SAMPLE FONT: SAPPERLOT, COURTESY OF THOMAS MAIER.

Creating a Microsoft Color Font

$
0
0

The Microsoft approach to color fonts employs two additional OpenType tables, CPAL and COLR. CPAL describes a palette of colors, and COLR defines how the colors from CPAL are used by which glyph. Technically, what appears to be multiple colors in a single glyph, is actually multiple glyphs stacked on top of each other, each of them displayed in its individual color. But you need not worry, Glyphs will take care of all that techy stuff.

Setting up a color palette

You start by adding a Custom Parameter called Color Palettes in File > Font Info > Master. For starters, we will add one palette with three colors. So, once you added your Color Palettes parameter, double click its Value field, and increase the Count of colors to three. Double clicking a color field brings up the OS X color picker:

You can pick any color from any color scheme, even with transparency. Eventually, it will be stored as RGBA (red, green, blue, alpha) in the font file. Note that the numbers 0, 1, and 2 have been assigned to the three colors we just created. Keep that in mind for later.

Once you are done, confirm the dialog sheet by clicking OK. If everything is alright, the Custom Parameter line should indicate the number of palettes and colors:

Creating the fallback glyph

So far, so good. There is one problem though. Support for Microsoft-style color fonts, like the one we are about to make right now, is not quite universal yet. So, for all non-compliant software, we need to have an old-style black and white glyph that can be displayed just in case. We call this a fallback glyph.

As it turns out, the fallback glyph is already set up: Anything on the master layer is considered to be the fallback. So, for instance, in the Regular master of the uppercase I, we can draw our sans-serif rectangle between cap height and baseline. The little diamond symbols indicate that the nodes are exactly on the metric lines:

Adding the color layers

Now, in the Layers palette in the sidebar (Cmd-Opt-P), create a duplicate of the Regular master. You can do so by clicking the Copy button. Rename the layer to Color 0, with an uppercase C and a space before the zero. You will notice a color indicator appear on the right, showing the first color, or Color number 0:

You can add the other two colors by duplicating the color layer we just created. But this time, you do not need to change the name of the layer. Instead, you can click on the color circle, and pick any other color from the palette we created before:

Now, all we need to do, is draw our layers. I will leave the Color 0 layer as it is, and make the Color 1 and Color 2 layers the side and bottom of a three-dimensional uppercase I:

You will notice that you get a color preview as soon as any of the color layers (Color 0, Color 1 or Color 2) is selected. Activate a Master layer (Regular in our case), and you will see the fallback glyph again. In Font View, Glyphs will preferably display the color glyph:

Export your font

It does not matter which format you pick, CFF/OTF, TTF, WOFF, WOFF 2, or EOT. Since all of them are OpenType-based, Glyphs will be able to insert the necessary tables for viewing. Because CPAL and COLR tables are a fairly recent technology, most apps will only display the fallback. But starting in Windows 8.1, Internet Explorer can display the color glyphs nicely:

Cool! Now, for all those other letters besides the uppercase I…

Additional masters for individual glyphs: the brace trick

$
0
0

For interpolation, two-master setups work surprisingly well. Well, except that sometimes you need an extra step in between. Sure, you could sort of fake it with the Bracket Trick, or an alternative glyph that kicks in in some instances only. But that can turn out to be complicated, as we may have to add (and redraw) many masters per glyph.

Create and name a brace Layer

In Glyphs 2 or later, you can employ something called the ‘Brace Trick’. Similar to the Bracket Trick, we copy one of the master layers, and adjust the name. You do that by opening the Palette sidebar (Window > Palette, Cmd-Opt-P), selecting your first master in the Layers palette, and clicking the Copy button.

Double click the name of the new layer, and type in a brace layer name. The name structure is as follows:

optionalDescription {weightValue, widthValue}

In short, it is curly braces containing a comma-separated list of interpolation values. If you like, you can use a descriptive prefix such as ‘Intermediate’. What it does is insert an intermediate master for this very glyph at that very position in the interpolation space. For instance, a layer called Intermediate {120, 100} will act as a master at 120 on the weight axis, and at 100 on the width axis.

All that rests to be done now, is actually draw the layer. You can get a head start if you choose Re-Interpolate from the gear menu in the bottom right of the Layers palette. This will put a new interpolation into the brace layer. Careful, it overwrites what is there.

By the way, you can temporarily deactivate the brace layer by deleting a curly brace or writing a suffix between braces, e.g. Intermediate {90, 100 off}. You can check if the layer is active or inactive by choosing Show all instances from the instance pop-up in the Preview section of the Edit tab.

Example

A typical use case would be the lowercase e, interpolating from Light to Heavy. While the stems can increase equally up until a medium weight, the horizontals cannot grow as quickly as the verticals in heavier weights. If we just have a Light and a Bold master, the horizontals thin out too soon. Pay attention to the middle bar of the e:

We can fix the wacky interpolations with an intermediate master for this glyph. Like described above, we add a brace layer with a sensible descriptive name and an appropriate weight value. We can leave the width value at its default. So, in our example, this happens to be Intermediate {90, 100}:

Now you have an extra master, just for this glyph, and the e interpolates much better. Look how well the middle bar behaves, while the outer masters remain the same:

That’s it. High five.

Working with UFO

$
0
0

The Unified Font Object is an XML-based file format for storing font data. It was developed by type designers and developers Tal Leming, Just van Rossum, and Erik van Blokland. While the specs for version 3 have been released, UFO 2 is currently in most widespread use.

While you can produce a font or font family in Glyphs alone, the UFO format makes the exchange with other tools possible. UFO gives you access to a variety of other tools. This is why Glyphs supports it out of the box. But why would you want to do that in the first place? Easy: Typically, UFO tools are highly specialized apps, entirely dedicated to a specific task. That means that those tools can pick up where the in-app functionality of Glyphs leaves off. Read on for a few examples.

UFO does not store everything

One thing to keep in mind is that many Glyphs-specific settings, like enabled or disabled automatic alignment of components, or things like the bracket trick, cannot be stored in UFO files. So take extra care and double-check your files where necessary.

Very important: UFOs are single masters. Multiple Master information cannot be stored within a single UFO file. This means that if you want to interpolate, you will need to use one UFO file per master.

Preferences and file settings

If you want to be prepared for tapping into a UFO workflow, you will find two important options in Glyphs > Preferences > User Settings. What they have in common is that they are applied to all non-native files opened in Glyphs, e.g. a file with a .ufo suffix.

Firstly, enabling the option Keep glyph names from imported files will prevent Glyphs from converting the names of the glyphs to its own naming scheme. In a pure Glyphs workflow, there are certain advantages if you stick to the internal naming scheme. But when you are moving a lot between applications, you will usually want to keep the names as set in the file.

Secondly, you may want to keep the placement of components in your file. In other words, you may want to keep Glyphs from enforcing automatic alignment of composite letters. In that case, selecting the option Disable automatic alignment in imported files is a good idea.

What these two settings do, is set the two corresponding options in File > Font Info > Other Settings, namely Use custom naming (or Don’t use nice names in older versions of Glyphs) and Disable automatic alignment. There, of course, you can also set these options manually.

Of course, if you go the opposite direction, i.e., take your .glyphs file for a UFO ride, you can keep the settings at their defaults, and take full advantage of automatic alignment and nice names.

Now that we are prepared, we can get down and dirty with UFO files!

Exporting UFOs

If you want to create a UFO copy of your current font project, pick File > Export > UFO. In the upcoming dialog, you can choose which masters you want to export, and in the following dialog, where you want to save the UFO files.

The option Convert Glyph Names to Production Names will convert the human-readable nice names, such as Zhe-cy, for Cyrillic uppercase Zhe, to their industry-standard counterparts, like uni0416. While these names may be hard to memorize, they are more compatible. Some tools may expect them to be in place. Our advise: Testrun your workflow with nice names, and if it does not work, you can still choose to convert the names.

Important: Please make sure you update to version 1.4.4, which fixes a bug in the UFO export of multiple masters.

UFO as saving format

If you already have a UFO file lying around, you can open it in Glyphs, and stay in UFO mode. Saving (Cmd-S) will save directly to the UFO.

You can also use File > Save As… (Cmd-Shift-S) to save a copy of your frontmost file as a UFO. In order to achieve that, you need to pick Unified Font Object as File Format in the export dialog. Glyphs will warn you if saving as UFO is not possible, e.g., when the file in question has more than one master. In that case, you would need to use File > Export (Cmd-E).

Once you have your UFO files ready, you are ready to work with a multitude of specialized applications and tools.

RoboFont

Belgian type designer Frederik Berlaen’s UFO editor RoboFont was built from the ground up for ultimate workflow flexibility. To achieve that, he made it very simple to build your own tools with the easy-to-learn programming language Python. No wonder that, for RoboFont, a wide variety of plugins and scripts are available on GitHub and other places across the web. Many extensions are listed on the RoboFont website itself. To get an idea of the power of the underlying API, take a look at Loïc Sander’s ‘An experiment in parametric type design’ video.

MetricsMachine

Tal Leming’s MetricsMachine is an app completely dedicated to kerning. With specialized tools for kerning group and kerning pair creation, stack views, automatically adapting contextual strings, a range of presets, etc., the app offers a more systematic and analytical approach to kerning than Glyphs can.

The app sports a Pair List Builder for creating all possible kerning pairs out of selected glyphs. Once you have your pairs set up, step through your kerning list with up and down arrows, adjust the kerning in steps of 10 units with left and right arrows, hold down the Shift key for steps of 5 units, the Option key for single-unit steps. Finally, the Spreadsheet function helps you get a grip on your kern table: filter and analyze to your heart’s content.

One little catch: What Glyphs calls a right group (based on the side of the glyph that is involved), MetricsMachine calls a left group (based on the side of the kern pair).

By the way, you can also incorporate MetricsMachine in a pure Glyphs workflow. All you need to do is export your UFOs, and kern them in MetricsMachine. Now, you can bring all the kerning info back into your Glyphs file by selecting all glyphs and choosing File > Import > Metrics… And in the upcoming dialog, pick whether you want to just import the kerning, or also the kerning groups.

Important: all glyphs that are supposed to be affected, need to be selected before you import. So, probably the best idea is to simply select all glyphs, and then import.

Superpolator

While you can do Multiple Masters in Glyphs alone, Erik van Blokland’s Superpolator opens up a whole new universe of inter- and extrapolation. Since the app is entirely dedicated to interpolation, you get things like immediate preview and live measuring options, any number of masters on any number of axes, individual interpolations for any number of glyphs, you name it. For a brief introduction, watch Erik’s Superpolator 3 presentation at Robothon 2012.

More UFO tools

Actually, these are just three examples for UFO-based applications. Keep your eyes open and you will find many tools, like RoboFont author Frederik Berlaen’s roundingUFO, which has proved very handy for creating ink traps. And if you want to go ahead and plunge into the Superpolator universe, Tal Leming’s Prepolator helps you prepare UFO files for interpolation.

Interestingly, also many command line tools work with UFO files. For instance, take a look at ufo2otf, which allows you to compile a ready-to-use webfonts and OTFs directly from a UFO. Speaking of OpenType, Adobe’s own Font Development Kit for OpenType can make use of UFO files. Tal Leming’s ufo2fdk can prove helpful if you make use of it.

Don’t use UFO for FontLab

If you want to move your font project between Glyphs and FontLab Studio, however, it is a bad idea to use UFO as exchange format, because too many things may get lost on the way. In this case, it is better to use the Glyphs Import and Glyphs Export macros for FontLab Studio, provided by Georg on his GitHub repository.

Creating a Layered Color Font

$
0
0

Layer fonts are fun for the user, but always have been a lot of work for the creator. Well, it has just gotten a lot easier: Glyphs 2 has some major improvements for the layertype designers amongst you.

Create masters and instances

Masters are your layers. So you go into File > Font Info > Masters, and add as many font masters as you need layers. Make sure you give each of them a different Custom name and value, e.g., ‘Front’, ‘Side’, ‘Bottom’, and 1, 2, and 3.

And, while we are at it, you can assign different preview colors to your master layers. That is because layer fonts are no fun if all the layers have the same color. This is how you do it: Add a new custom parameter by clicking the little green plus button just above the Custom Parameters section. In the Property pop-up, you pick Master Color, and in the Value field, a color swatch will appear. Click on the swatch to pick a different color:

Hint, hint: You can even choose a transparency, if you want to simulate an overprint effect.

When you are done, select the Master Color parameter, and copy it to the clipboard (Cmd-C). Then go into each of the other masters, and each time, click into the Custom Parameters section, and paste (Cmd-V). Then you can conveniently click on the swatch and change the color for each layer. The power users amongst you can Cmd-select more than one master in the sidebar, and add or paste the parameter for all master layers at once.

Now, in the Font Info window, switch to the Instances tab. There, you create instances with the exact same weight values we used before. To do that, click on the Plus button in the bottom left, and choose Add Instance for each Master from the menu that pops up.

Using the exact same values makes sure we are not interpolating. That is good because we do not want to interpolate, we just want to draw and export different layers.

Edit the layer glyphs

Once you close the Font Info window, you are taken back to the Font window. Let’s double click the uppercase I, an easy letter, ideal for experimenting and trying some editing.

Using the Master buttons at the top of the window, or the shortcuts Cmd-1, Cmd-2, and Cmd-3, you can switch between the layers. In the Layers section of the sidebar palette (Cmd-Opt-P), the custom names should pop up, along with an indication of the layer color. To the left of each layer name, there is a little eye symbol. Click on all closed eyes to open them. So, all master layers are displayed at once while you edit them.

Press Cmd-1 to go to the ‘Front’ layer, and draw a rectangle from the cap height to the baseline, for the uppercase I:

Then, while the rectangle is still selected, copy it to the clipboard (Cmd-C), switch to the ‘Side’ layer (Cmd-2), and paste (Cmd-V). Select the two leftmost nodes with the Select tool (V), and move them to the bottom right, like this:

Select all (Cmd-A), copy to the clipboard (Cmd-C), switch to the ‘Bottom’ layer (Cmd-3), and paste. Now move the two top nodes to the bottom left position, so that the top of the ‘Bottom’ layer aligns with the base of the ‘Front’ layer:

Now is a good time to hold down your Option key, and choose Correct Path Direction for All Masters (Cmd-Opt-Shift-R) from the Paths menu. Hold down the space bar to temporarily see a Preview, or simply switch to the Text tool (T), and you can see if everything works out as expected:

Congratulations, you have your first layered glyph.

Multiple-layer editing

Speaking of editing, there is a new Select All Layers tool, which allows you to edit any points on any visible layer.

Some menu commands work for all layers at once. You can now Glyph > Update Metrics for All Masters (Cmd-Opt-Ctrl-M) and we have already used Paths > Correct Path Direction for All Masters (Cmd-Opt-Shift-R).

Applying layer fonts in InDesign

You export the fonts just as you would in any other font project. As always, it is a good idea to use the Adobe Fonts folder.

Now, what you need to do in InDesign, is to have multiple text frames with the exact same content exactly on to of each other, each of them with a different font style. You can use InDesign’s place-and-link tool to achieve that.

Layering fonts in Illustrator

There is one problem with aligning area type objects (i.e., text in text boxes) in Adobe Illustrator. By default, the app tries to be smart about finding a good offset for the first baseline in your text box. To do that, Illustrator measures your lowercase letter d, and uses its ascender height as offset for the first line. I am not kidding, AI really does that.

The problem is that, in the color layers, it is rather unlikely for all of them to happen to have the same vertical maximum in the lowercase d. So, as a consequence, the layers will not align, and you may receive a large number of support requests by e-mail from the people who bought your color font.

There are two things you can do. Firstly, you can try to educate your customers about how to change the baseline offset setting for all area type objects in Adobe Illustrator: Select all text boxes you want to align, go to Type > Area Type Options, and choose Fixed or Leading as the First Baseline option. Keep in mind though, that even experienced users often do not know about this setting. And you risk that they publish an angry Instagram posting about your font before they contact you.

Or, secondly, you can add a tiny square, maybe just one unit wide, at the top of all layers in your lowercase d. Copy and paste it at the same height in all color layers, and make sure it is the highest path object in this letter. Make sure you find a good spot in your design, so it does not show too much. Then, when Illustrator measures your lowercase d, it will find all of them to be of the same height, and align them all by default. And your inbox will not overfill with support requests.

And again, also for testing the font in AI, make sure you use the Adobe Fonts folder.

Sapperlot sources

In any event, you can do pretty good stuff with this, like Thomas Maier (DrTypo) did with his font Sapperlot. Thomas open-sourced the .glyphs file, so head on over to his GitHub page and take a closer look:

SAMPLE FONT: SAPPERLOT, COURTESY OF THOMAS MAIER.

Update 2014-12-24: Added the paragraphs about layering fonts in Illustrator.


Features, part 4: Positional alternates

$
0
0

One of the main problems for script fonts and similar designs is that the letters adopt different shapes depending on their relative position inside a word. In total, we can differentiate four possible positions:

  • .init: initial forms at the beginning of a word
  • .medi: medial forms in the middle of a word
  • .fina: final forms at the end of a word
  • .isol: isolated forms for when a letter stands all by itself

The four-letter codes init, medi, fina, and isol are the names of the corresponding OpenType features. And you may have guessed it already: You can trigger the automatic creations of these four features by appending their names as suffix to the glyphs. E.g., if you have both adieresis and adieresis.init in your font, then Glyphs can automatically generate the init feature for you. All you need to do is click on the Refresh button (marked with a circled arrow) at the bottom left in File > Font Info > Features and re-export your font.

The trouble is only that very few applications make use of the features by default. For instance, in InDesign, you need to activate Automatic Positional Forms in the OpenType options. Many users still do not know how to handle OpenType fonts, and will send you support e-mails. After all, for them, the font they spent their hard-earned money on does not seem to work. The mere phrase ‘activate automatic positional forms’ can drive fear into the hearts of some people.

So, in order to save you a lot of time and nerves, we should find a way to have positional forms automatic by default. As it so happens, there is a way. Stay tuned.

Medial forms as defaults

Now, in this tutorial, I will make two assumptions: Firstly, I assume that your default glyphs are medial shapes. Secondly, I assume that there are all four variations for each letter. That means that there are default glyphs like a, b, c and so on, all with medial shapes, plus three variations with .isol, .init and .fina suffixes for each of them. If that does not apply to your design, you will have to adapt the code accordingly, but that will prove to be pretty easy after you have read through this tutorial.

Creating OpenType classes

I think it is pretty clear. We need four classes:

  • Isolated for isolated glyphs with a .isol suffix
  • Initial for initial variations with a .init suffix
  • Medial for the default medial letters without suffixes
  • Final for the final forms carrying a .fina suffix

Let’s start with Isol: This one is easy, we just need to type .isol into the search field in the bottom right corner in Font View. Glyphs will narrow down the selection to all letters that have .isol in their name. All we need to do now is select all displayed glyphs (Cmd-A), and choose Copy Glyph Names from the context menu.

positional-1

Now, we have the glyph names of all .isol glyphs in our clipboard. So, we go to File > Font Info > Features, click and hold the Plus button in the lower left corner, and pick Class from the pop-up menu. A new OpenType class named xxxx will appear, and we simply change its name to Isolated. Then, we paste the the glyph names into the code field.

But there is one problem. The code looks like this:

/A.isol/B.isol/C.isol/D.isol/E.isol/F.isol/G.isol/H.isol/I.isol/J.isol/K.isol/L.isol/M.isol/N.isol/O.isol/P.isol/Q.isol/R.isol/S.isol/T.isol/U.isol/V.isol/W.isol/X.isol/Y.isol/Z.isol/a.isol/b.isol/c.isol/d.isol/e.isol/f.isol/g.isol/h.isol/i.isol/j.isol/k.isol/l.isol/m.isol/n.isol/o.isol/p.isol/q.isol/r.isol/s.isol/t.isol/u.isol/v.isol/w.isol/x.isol/y.isol/z.isol

I.e., the names of the glyphs with a preceding slash (/). But for the OpenType class, we need the names without slashes, and separated by wordspaces. So, press Cmd-Shift-F to bring up the search and replace function, and replace / (slash) with (space):

positional-2

bq.Note: This search and replace trick does not work in systems before OS X 10.7 Lion. If you are running an older system, please do the replacing in a plaintext editor of your choice, and paste the result back into the class definition in Glyphs.

Your class code should now look something like this:

A.isol B.isol C.isol D.isol E.isol F.isol G.isol H.isol I.isol J.isol K.isol L.isol M.isol N.isol O.isol P.isol Q.isol R.isol S.isol T.isol U.isol V.isol W.isol X.isol Y.isol Z.isol a.isol b.isol c.isol d.isol e.isol f.isol g.isol h.isol i.isol j.isol k.isol l.isol m.isol n.isol o.isol p.isol q.isol r.isol s.isol t.isol u.isol v.isol w.isol x.isol y.isol z.isol

Much better. For the remaining classes, our task is clear and easy: We copy and paste the Isolated class three times by clicking on the class name Isolated and pressing Cmd-c, then three times Cmd-V. You will see four classes named Isolated. Change the names of three of them to Initial, Medial, and Final. Then, click into the code of each new class, and replace the suffix .isol with the respective suffix, or with nothing in Medial.

positional-3

This way, all classes are in sync, i.e., they have the same amount and order of glyphs stored in them. This is important for the substitution code we are going to write in a minute.

One class definition remains to be made. We also need a class called AnyLetter. Create it through the Plus menu in File > Font Info > Features. Why? Because, for instance, the initial feature will go something like this: Switch a default letter to its initial shape unless there is any letter in front of it.

Okay, but how do we get the complete list of names for all letters in our font? Easy. Go back to Font View, make sure the search field is empty, and click on the Letter category, almost all the way to the top of the sidebar. If you have a multi-script font, and you want to keep this, e.g., to the Latin part of your font, you can Cmd-click on the Latin languages category further below, and thus further narrow down your selection. Now, again, we can select all glyphs, choose Copy glyph names from their context menu, paste it into the code of the AnyLetter class, and replace the slashes with spaces.

And by the way, you can rearrange the classes by simply dragging their names in the sidebar. The order is not important for the features to work, but for you to keep your oversight.

Positional forms as contextual alternates

What we need now is a Contextual Alternates feature, or calt, because what we want to do is substitute glyphs depending on their context. So, our first step will be to create that feature. Again, in File > Font Info > Features, click and hold the Plus button at the bottom left. But this time, choose Feature from the pop-up menu. A new feature called xxxx appears, its name already selected, so we can conveniently change it to calt, in lowercase letters:

positional-4

Press the Return key to confirm. If you already have other features in your font, you may also click on the Refresh button between the Minus and Compile buttons, so Glyphs can properly re-order the features. As opposed to classes, the order of features does indeed matter. And unless you have a good reason not to, I recommend you follow the default sort order that Glyphs suggests.

Writing the feature code

Remember how I summarized the initial feature: ‘Switch a default letter to its initial shape unless there is any letter in front of it.’

Okay, let’s build it bit by bit. ‘Switch default letter to initial shape’ translates to substituting the Medial class for the Initial class. So, we can start out by writing this line:

sub @Medial by @Initial;

Remember, in the feature code, sub...by stands for substitute…with, and class names need to be preceded by at signs in order to be recognized as classes. And every rule needs to be terminated by a semicolon, otherwise it does not count.

So far so good. But the problem is: this will substitute all default letters (Medial) with their initial forms. And we want to do that only when there is no letter in front of it, or in other words, unless there is any letter in front of it. Or, again in other words, ignore the case where there is any letter in front of it. Sounds great, because we have a class called AnyLetter and the AFDKO feature file syntax knows an ignore sub statement. And this is how we write it:

ignore sub @AnyLetter @Medial';
sub @Medial' by @Initial;

Click the Compile button to see if you got everything right.

I need to focus on two things here: Firstly, the ignore sub statement precedes the sub statements it is intended for. That means that all following sub statements only count if the ignore sub condition is not fulfilled. Tricky. We’re good for now, but it will cause us some headache later. Read on.

Secondly, look at the tick marks ‘. In the ignore sub rule, we state that the exception counts for all glyphs in the Medial class. And in the following sub rule, we need to mark it again. Well, I suppose, here it would be clear, because there is nothing else being substituted. But we still need to mark it because it doesn’t need to be the same class as in the ignore sub statement above. It could be two different classes sharing a few glyphs. Plus, it could be a more complex contextual substitution.

Let me stress that again: You need to tick-mark the respective glyph classes in both the ignore sub and the sub statement. If your ignore sub does not work for you, you probably forgot one or both markers. Don’t worry, happens to the best of us.

Let’s see if it works already. In a new Edit tab, just type n a couple of times, and from the Features pop-up menu in the lower left corner of the window, choose Contextual Alternates.

positional-5

Yes! It works! So, in theory, we just need to do the same thing for Isolated and Final, right? Right?!

No, not quite. Being the smart girls and boys that we are, we remember that the ignore sub statement counts for everything that follows. And three ignore sub statements would definitely get in each other’s way. So what do we do?

Lookups to the rescue!

Actually, I did not tell you the whole truth before. An ignore sub does not count for everything that follows, but just for everything that follows in the same lookup.

Huh? Lookup? What’s a lookup? Well, within a lookup, you can summarize a couple of rules under a name, and if you like, conjure them up again later. So, we need to put everything we wrote so far into a lookup, and give it a name. This is how we do it:

lookup INITIAL {
   ignore sub @AnyLetter @Medial';
   sub @Medial' by @Initial;
} INITIAL;

I chose to call this one INITIAL, for obvious reasons. The syntax is clear: lookup, followed by a name, followed by an open curly brace. Then, all the rules that need to be inside the lookup. You do not need to do it, but you can indent them with Cmd-] if you find it prettier that way. And unindent with Cmd-[ if you change your mind again. At the end, we need to close the curly brace again, repeat the lookup name, and terminate the lookup with a semicolon.

Now, I need to tell you another important thing: between lookup blocks, order counts. Just like it does between features. The font will go through this feature until it finds something appropriate for the current glyph, and it will not look any further than that.

This is why we need to put the lookup with the largest ignore sub first. In our case, this is the one for the isolated variations, because there we need to ignore the case that there is anything in front of it, as well as the case that there is anything behind it. That makes two ignore sub rules. So, do we write two ignore sub statements?

lookup ISOLATED {
  ignore sub @Medial' @AnyLetter;
  ignore sub @AnyLetter @Medial';
  sub @Medial' by @Isolated;
} ISOLATED;

Sure, we could, and it would work that way. Some people, however, prefer to line up the ignored substitution chains between commas, like this:

lookup ISOLATED {
   ignore sub @Medial' @AnyLetter, @AnyLetter @Medial';
   sub @Medial' by @Isolated;
} ISOLATED;

And I am one of those people. So, I will keep it like this, har har.

While we are at it, we might as well add the Final substitutions. This time, the lookup goes to the end:

lookup ISOLATED {
   ignore sub @Medial' @AnyLetter, @AnyLetter @Medial';
   sub @Medial' by @Isolated;
} ISOLATED;

lookup INITIAL {
   ignore sub @AnyLetter @Medial';
   sub @Medial' by @Initial;
} INITIAL;

lookup FINAL {
   ignore sub @Medial' @AnyLetter;
   sub @Medial' by @Final;
} FINAL;

Again, make super-sure you get all the tick marks right. We always want to mark the Medial class, both in the ignore sub and sub rules. After all, the Medial class contains our default glyphs, and it is them that need to be substituted whenever the occasion demands it.

Okay, push the Compile button. If you get an error, read carefully what the error message is. Did you forget a semicolon? Mistype a class name? Forget an at sign? If you cannot figure it out, there is a lengthy troubleshooting section in the Glyphs Handbook: look for the OpenType Feature Code section in the Error Handling chapter.

If your features do compile, we can test-run them in an Edit tab again. Here is what happens when I type n a few times again:

positional-6

See the isolated n at the left, and three times after each other on the right, each time in a different shape: initial, medial, final. Cool, high five, for the win!

There’s a script for that!

So you have read through all of this, and you understand the nature of lookup blocks and ignore sub statements. I guess you need a break now.

And here it is: I wrote a script that injects positional code into calt. It analyzes your glyph structure, checks for the suffixes .init, .medi, .fina, and .isol. The best thing about it: It does not assume that your four positional groups are in sync. So the class and code structure will look slightly different, but the basic ideas are the same. If you run the script again, it will update classes and feature code.

Download the Glyphs Scripts repository from my GitHub page. Place the scripts in the Scripts folder (Script > Open Scripts Folder, Cmd-Shift-Y), and reload scripts (with Opt key: Script > Reload Scripts, Cmd-Opt-Shift-Y). You will then find OpenType > Build positional calt feature somewhere in the Scripts menu. Have fun.

Sketching

$
0
0

There are many, many ways for achieving certain letterforms. Most methods, if not all, have in common that they trace the shapes back to the workings of a specific tool. In Latin type design theory, it is usually the broad-nib pen that plays the biggest role in the making of our letters. Other pens are possible, such as those with pointed nibs, or even completely different tools, like brushes. Or, you go the abstract way and try a completely geometric approach.

But many theorists will insist that even if you try to abstract by the means of different tools, it is still the broad nib you are abstracting from. So, in this tutorial, I will focus on the broad-nib pen.

Start with the n

Do not start with the a. Unless you have something special in mind, start with the n. It may not be the first letter in the alphabet, but its shapes reoccur a lot in other letters. It does not take a lot of imagination to turn an n into letters such as h, i, m, r, u etc., so the n is a great letter to start with.

Simulating a broad-nibbed pen

You can build your own broad-nib pen from a goose feather, or you can buy one. There are some modern variations to it, so you will not need to get your hands dirty with dripping ink. With some practice, you can learn to write pretty well with a broad nib.

But chances are, you will not have a broad-nib pen on you when you have that great idea for that letter. So, we will have to fake it. The characteristics of writing with a broad nib are simple: the width of the nib (the ‘front’) is fixed, and its angle in respect to the baseline hardly changes.

Sketching method 1: two pencils

Take two pencils into your writing hand, perhaps tie them together with a rubber band, and start writing. Make sure you keep them at more or less the same angle throughout making the strokes:

Sketching method 2: wiggling

If you only have one pencil available, then you can loosely wiggle left and right while you are leading your hand along the stroke:

The wiggling simulates the broad nib. You will receive a good nib angle if you put the paper in front of you and keep it straight, and just use the natural angle of your lower arm.

Adding details to your sketch

Whichever method you apply to get your first rough sketch, once you have the basic structure, you can see right away where the thicks and the thins need to go. Now, you can take a single pencil, and draw the outline, and add some detail:

Digitizing your sketch

Again, there are different approaches. Here is one that works well for most people. In a nutshell, you start out with straight lines, placing points only very roughly at first. We will add precision and curves later.

First, in your sketch, you mark your corners, your extremum points, and the points where curves change into straight lines. What are extremum points, you ask? These are all points on every curve that have a perfectly horizontal or vertical tangent. So, your sketch may now look something like this:

sketch-1

Approximate nodes

And now, go into Glyphs, and create a new font with File > New (Cmd-N). Double click the n, and pick the Draw tool (P). And now, click to add straight lines, one point at a time. You can do that just very roughly, you do not need to be precise at this stage. Actually going for precision now already is just a waste of time. Just approximately put the nodes between baseline (second line from below) and x-height (third line from below):

sketch-2

Approximate the relative positions of the nodes. For instance, the extremum point on the inner arch appears to be not exactly in the center between the two stems, but slightly to the right of it. Ask yourself questions like: ‘Is the top node above the right stem?’ Place your nodes accordingly. Again, it does not need to be very precise, an approximation will do.

Close paths by clicking in the first point again. Keep overlaps. Again: no curves, no precision yet. Finish this step with Paths > Correct Path Direction (Cmd-Shift-R). Path direction determines whether overlaps appear white or black. The command also reorders the paths and sets the start points (indicated by triangles).

Align and move points

Now, we will start adding precision by aligning points that need to be at the same x or y coordinate. With the Edit tool (V), select points that need to be aligned, and choose Paths > Align Selection (Cmd-Shift-A). You will use this a lot, so it is probably a good idea to memorize that keyboard shortcut:

sketch-3

Glyphs seems to be smart enough to figure out whether you want to align horizontally or vertically. What it does internally, is pick the alignment that is the smallest change.

Now, with the arrow keys on the keyboard, move the points into position. Add Shift for increments of 10 units, and Cmd for increments of 100 units. Put the lowest nodes of your n onto the baseline. Once they reach the line, they will be marked by a diamond indicator.

The extremum point of the top arch needs to be slightly above the x-height (by default at 500 units). We call this the overshoot, an optical compensation that makes sure the arch will later appear to be at the same height as horizontal things at the x-height. Most overshoots are between 10 and 15 units. Around 10 if your design is intended for display sizes, a little more if it is intended for smaller sizes.

Our n now looks like this:

sketch-4

Equalize stems

Then, we need to sync distances between nodes. In the case of our n, that means that we need to make sure both stems have the same width. One stem at a time, select the four nodes that make up the stem. Then, take a look at the grey info box (View > Show Info, Cmd-Shift-I), and make sure the lock is open. That way, we can edit width and height independently of each other.

Now find a good, round value for the stem width, controlled by the number next to the horizontal double arrow on the grey info box. Apply the same width to both stems.

sketch-5

Add curves

Enough of those straight lines already! Switch to the Edit tool (V), hold down the Option key, and click on the segments to add grey handles to the segments. In case you added too many handles, you can select a handle and delete it with the Backspace key, and your segment will be turned into a straight line again.

sketch-6

You can either have two handles on a path segment, making it a curve segment, or, no handles at all, making it a line segment. Perhaps you are used to other vector applications, such as Adobe Illustrator, that make you believe you can also have segments with just one handle. In that case, it may come as a disappointment, and I really hate to be the one that has to break it to you that all those apps have been lying to you for all those years, secretly hiding the second handle behind one of the surrounding nodes. Technically, that is a very bad thing to do, so that is why Glyphs handles handles differently. Read more about drawing good paths here.

Once you have handles on all your segments that need to become curvy, you can simply drag them into position. Handles snap as soon as they are horizontal or vertical, which is what they need to be anyway around extremum points.

Most likely, you will also have two handles inside the overlap in the left stem. Usually, these two do not need to be horizontal or vertical, but at an angle. Make sure they both have approximately the same angle. This will facilitate the next step.

Your n now may look something like this:

sketch-7

Adjust curvatures

Select some handles of the outer curve segment and bring up the Palette (Window > Palette or Cmd-Opt-P). In the Fit Curve section of the Palette, click on the buttons (or press Ctrl-Opt-1 through 8):

sketch-8

You may need to collapse the view from two dimensions to one, like in the screenshot. A curvature of 57% is approximately elliptical. In type design land, we usually need something higher than that. 100% is where the handles intersect. In most cases, we end up with curvatures between 60 and 80 percent.

Now select handles of the smaller inner curve, and give it a higher percentage than the outer curve. Experiment with the values until you are content.

Iron out curve bumps

Perhaps you see something that looks like a little bump in the curve, approximately where the two curve segments meet in the extremum node. That can happen if the actual curvature abruptly changes from one segment to the other. To one side of the point, the curve looks rather flat, towards the opposite side, it looks rather steep.

sketch-9

Select the node, hold down the Option key, and move the node towards the flatter part. You can do that with either the arrow keys or the mouse. By holding down the Option key, you keep the handles where they are, effectively moving the node between the neighboring handles:

sketch-10

If you have the full version of Glyphs, there are third-party plugins available that will help you turn bumpy curves into smooth outlines. Firstly, we can recommend Tim Ahrens’ Remix Tools which contains a filter called Harmonizer (after installation, choose Filter > Harmonizer) that tries to re-arrange nodes in a way that bumps like these get ironed out.

sketch-11

Then, there is Yanone’s psychedelic SpeedPunk tool, that helps you spot curvature problems. It only visualizes the curvatures, you stay in control of your curves.

sketch-12

Ta-daa!

Congratulations, you have finished your first n:

sketch-13

From here, you can either draw the next glyph, or adjust the sidebearings of your letters, or test your font in an Adobe app. Don’t forget to set a font family name in File > Font Info > Font.

Pencil sketches by Stefan Willerstorfer

Creating a Layered Color Font

$
0
0
Sapperlot

Layer fonts are fun for the user, but always have been a lot of work for the creator. Well, it has just gotten a lot easier: Glyphs 2 has some major improvements for the layertype designers amongst you.

Create masters and instances

Masters are your layers. So you go into File > Font Info > Masters, and add as many font masters as you need layers. Make sure you give each of them a different Custom name and value, e.g., ‘Front’, ‘Side’, ‘Bottom’, and 1, 2, and 3.

colorfont-1

And, while we are at it, you can assign different preview colors to your master layers. That is because layer fonts are no fun if all the layers have the same color. This is how you do it: Add a new custom parameter by clicking the little green plus button just above the Custom Parameters section. In the Property pop-up, you pick Master Color, and in the Value field, a color swatch will appear. Click on the swatch to pick a different color:

colorfont-2

Hint, hint: You can even choose a transparency, if you want to simulate an overprint effect.

When you are done, select the Master Color parameter, and copy it to the clipboard (Cmd-C). Then go into each of the other masters, and each time, click into the Custom Parameters section, and paste (Cmd-V). Then you can conveniently click on the swatch and change the color for each layer. The power users amongst you can Cmd-select more than one master in the sidebar, and add or paste the parameter for all master layers at once.

Now, in the Font Info window, switch to the Instances tab. There, you create instances with the exact same weight values we used before. To do that, click on the Plus button in the bottom left, and choose Add Instance for each Master from the menu that pops up.

colorfont-3

Using the exact same values makes sure we are not interpolating. That is good because we do not want to interpolate, we just want to draw and export different layers.

Edit the layer glyphs

Once you close the Font Info window, you are taken back to the Font window. Let’s double click the uppercase I, an easy letter, ideal for experimenting and trying some editing.

Using the Master buttons at the top of the window, or the shortcuts Cmd-1, Cmd-2, and Cmd-3, you can switch between the layers. In the Layers section of the sidebar palette (Cmd-Opt-P), the custom names should pop up, along with an indication of the layer color. To the left of each layer name, there is a little eye symbol. Click on all closed eyes to open them. So, all master layers are displayed at once while you edit them.

colorfont-4

Press Cmd-1 to go to the ‘Front’ layer, and draw a rectangle from the cap height to the baseline, for the uppercase I:

colorfont-5

Then, while the rectangle is still selected, copy it to the clipboard (Cmd-C), switch to the ‘Side’ layer (Cmd-2), and paste (Cmd-V). Select the two leftmost nodes with the Select tool (V), and move them to the bottom right, like this:

colorfont-6

Select all (Cmd-A), copy to the clipboard (Cmd-C), switch to the ‘Bottom’ layer (Cmd-3), and paste. Now move the two top nodes to the bottom left position, so that the top of the ‘Bottom’ layer aligns with the base of the ‘Front’ layer:

colorfont-7

Now is a good time to hold down your Option key, and choose Correct Path Direction for All Masters (Cmd-Opt-Shift-R) from the Paths menu. Hold down the space bar to temporarily see a Preview, or simply switch to the Text tool (T), and you can see if everything works out as expected:

colorfont-8

Congratulations, you have your first layered glyph.

Multiple-layer editing

Speaking of editing, there is a new Select All Layers tool, which allows you to edit any points on any visible layer.

colorfont-9

Some menu commands work for all layers at once. You can now Glyph > Update Metrics for All Masters (Cmd-Opt-Ctrl-M) and we have already used Paths > Correct Path Direction for All Masters (Cmd-Opt-Shift-R).

Applying layer fonts in InDesign

You export the fonts just as you would in any other font project. As always, it is a good idea to use the Adobe Fonts folder.

Now, what you need to do in InDesign, is to have multiple text frames with the exact same content exactly on to of each other, each of them with a different font style. You can use InDesign’s place-and-link tool to achieve that.

Layering fonts in Illustrator

There is one problem with aligning area type objects (i.e., text in text boxes) in Adobe Illustrator. By default, the app tries to be smart about finding a good offset for the first baseline in your text box. To do that, Illustrator measures your lowercase letter d, and uses its ascender height as offset for the first line. I am not kidding, AI really does that.

The problem is that, in the color layers, it is rather unlikely for all of them to happen to have the same vertical maximum in the lowercase d. So, as a consequence, the layers will not align, and you may receive a large number of support requests by e-mail from the people who bought your color font.

There are two things you can do. Firstly, you can try to educate your customers about how to change the baseline offset setting for all area type objects in Adobe Illustrator: Select all text boxes you want to align, go to Type > Area Type Options, and choose Fixed or Leading as the First Baseline option. Keep in mind though, that even experienced users often do not know about this setting. And you risk that they publish an angry Instagram posting about your font before they contact you.

Or, secondly, you can add a tiny square, maybe just one unit wide, at the top of all layers in your lowercase d. Copy and paste it at the same height in all color layers, and make sure it is the highest path object in this letter. Make sure you find a good spot in your design, so it does not show too much. Then, when Illustrator measures your lowercase d, it will find all of them to be of the same height, and align them all by default. And your inbox will not overfill with support requests.

And again, also for testing the font in AI, make sure you use the Adobe Fonts folder.

Sapperlot sources

In any event, you can do pretty good stuff with this, like Thomas Maier (DrTypo) did with his font Sapperlot. Thomas open-sourced the .glyphs file, so head on over to his GitHub page and take a closer look:

colorfont-10

SAMPLE FONT: SAPPERLOT, COURTESY OF THOMAS MAIER.

Update 2014-12-24: Added the paragraphs about layering fonts in Illustrator.

Creating a Microsoft Color Font

$
0
0

The Microsoft approach to color fonts employs two additional OpenType tables, CPAL and COLR. CPAL describes a palette of colors, and COLR defines how the colors from CPAL are used by which glyph. Technically, what appears to be multiple colors in a single glyph, is actually multiple glyphs stacked on top of each other, each of them displayed in its individual color. But you need not worry, Glyphs will take care of all that techy stuff.

Setting up a color palette

You start by adding a Custom Parameter called Color Palettes in File > Font Info > Master. For starters, we will add one palette with three colors. So, once you added your Color Palettes parameter, double click its Value field, and increase the Count of colors to three. Double clicking a color field brings up the OS X color picker:

cpal-1

You can pick any color from any color scheme, even with transparency. Eventually, it will be stored as RGBA (red, green, blue, alpha) in the font file. Note that the numbers 0, 1, and 2 have been assigned to the three colors we just created. Keep that in mind for later.

Once you are done, confirm the dialog sheet by clicking OK. If everything is alright, the Custom Parameter line should indicate the number of palettes and colors:

cpal-2

Creating the fallback glyph

So far, so good. There is one problem though. Support for Microsoft-style color fonts, like the one we are about to make right now, is not quite universal yet. So, for all non-compliant software, we need to have an old-style black and white glyph that can be displayed just in case. We call this a fallback glyph.

As it turns out, the fallback glyph is already set up: Anything on the master layer is considered to be the fallback. So, for instance, in the Regular master of the uppercase I, we can draw our sans-serif rectangle between cap height and baseline. The little diamond symbols indicate that the nodes are exactly on the metric lines:

cpal-3

Adding the color layers

Now, in the Layers palette in the sidebar (Cmd-Opt-P), create a duplicate of the Regular master. You can do so by clicking the Copy button. Rename the layer to Color 0, with an uppercase C and a space before the zero. You will notice a color indicator appear on the right, showing the first color, or Color number 0:

cpal-4

You can add the other two colors by duplicating the color layer we just created. But this time, you do not need to change the name of the layer. Instead, you can click on the color circle, and pick any other color from the palette we created before:

cpal-5

Now, all we need to do, is draw our layers. I will leave the Color 0 layer as it is, and make the Color 1 and Color 2 layers the side and bottom of a three-dimensional uppercase I:

cpal-6

You will notice that you get a color preview as soon as any of the color layers (Color 0, Color 1 or Color 2) is selected. Activate a Master layer (Regular in our case), and you will see the fallback glyph again. In Font View, Glyphs will preferably display the color glyph:

cpal-7

Export your font

It does not matter which format you pick, CFF/OTF, TTF, WOFF, WOFF 2, or EOT. Since all of them are OpenType-based, Glyphs will be able to insert the necessary tables for viewing. Because CPAL and COLR tables are a fairly recent technology, most apps will only display the fallback. But starting in Windows 8.1, Internet Explorer can display the color glyphs nicely:

cpal-8

Cool! Now, for all those other letters besides the uppercase I…

Creating an Apple Color Font

$
0
0

In Apple-style color fonts, bitmap images are embedded in a so-called sbix table inside the font file. Multiple images at various sizes can be assigned to each glyph. Thus the Apple device displaying it can pick the most appropriate resolution.

Prepare size variations

Usually, Apple-style color fonts make use of Portable Network Graphic (PNG) format. JPEG and TIFF also work fine. The specification even allows for PDFs, but they are not (yet) supported by iOS or OS X. Whichever format we choose, we need to prepare those images outside of Glyphs.

sbix-1

Let’s say I want to take the Glyphs icon and put it into the uppercase G of a font. It is a good idea to prepare image files at several resolutions in an image editing application like Pixelmator or Preview. If you already have the pictures, then all you need to do is produce the size variations. Note that simple downscaling can even be done with an Automator workflow, which can be triggered via the contextual menu in Finder, when installed as an OS X service.

Hint: Create at least one small variation below 100 pixels, because it can significantly boost display performance at low resolutions, especially on older devices.

In any event, we strongly recommend to keep your images in a subfolder next to the .glyphs file. That is because Glyphs only stores their relative path in the file, not the binary itself.

sbix-2

Of course, whenever you move your .glyphs file, move the subfolder along with it. Otherwise, you risk Glyphs complaining about missing image files. Should that happen to you, you may find the Set New Path for Images script useful. Find it in the Images folder in my Glyphs-Scripts repository on GitHub.

Set the width

Now, let’s start Glyphs and create a new font. I bring up my uppercase G and change its width. The master layer is only for determining the metrics of the glyph, and will stay empty.

The width should reflect the ratio of the image in relationship to the Units Per Em (UPM). You can check on your UPM value in File > Font Info > Font.

In my case, I set its width to 1000, because my icon is square and my UPM is 1000, the recommended value for CFF OpenType Fonts and the app default in Glyphs. If your graphic is only half as wide as it is high, set it to half its UPM, i.e. 500. If it is twice as wide, set it to 2000. You get the idea.

Create sublayers

Now, with the G still open, open the Palette (Window > Palette, Cmd-Opt-P), and go to the Layers section. Select your Regular master, and create sublayers by clicking the Copy button as often as necessary. You need as many sublayers as you have PNG files.

Rename the layers to iColor, followed by a wordspace and a number indicating the image resolution. For instance, iColor 512, iColor 256, iColor 128, and iColor 96.

The rest is easy. Simply drag the PNG files from the Finder into the respective iColor layers. If you have done everything right, your setup could look similar to this:

sbix-3

The width of the iColor sublayers, as well as any image manipulations (scaling or placement), will be ignored. So, you do not need to bother to readjust the PNGs in the glyph metrics.

Export

Now when you go to File > Export, pick OTF, TTF or any Webfont format as export format. Glyphs will create a font containing the sbix table, which can be viewed and used on both iOS and Mac OS X. Have fun!

sbix-4
Viewing all 88 articles
Browse latest View live




Latest Images