Font filters, components and glyph metrics in FontLab VI 6.1
FontLab VI 6.1 is a major free update to FontLab VI that brings a large number of improvements. This article gives a detailed description of the improvements in these areas:
- Components as a standards-compliant way to build glyphs from other glyphs
- Font filters and Font window sidebar for better filtering of and navigating within your glyph set
- Nonspacing components and elements for a more intuitive spacing experience of composite glyphs
- Metrics expressions for faster and easier linking of glyph metrics across glyphs and layers
Additional reading:
- For a general overview of the FontLab VI 6.1 improvements, see the FontLab VI 6.1 blog post.
- For a complete description of the improvements and bug fixes in FontLab VI 6.1, see the Release Notes.
Components in FontLab VI 6.1»
FontLab VI 6.1 (re-)introduces Components as a standards-compliant way to build glyphs from other glyphs.
Components in FontLab VI 6.1 work very much like components in FontLab Studio 5, UFO or in TrueType-flavored OpenType fonts. They point to a source glyph and have a transformation (usually shift, optionally also scale, rotation or slant). That’s it. If you’ve used Components any other font editor, you’ll find yourself at home easily.
To start using Components:
- Open a TTF, VFB or UFO if Preferences > Open Fonts > Use Components is on.
- Open a VFC or VFJ, select all glyphs in the Font window, and choose Element > Element Reference > References to Components. Repeat this for each master.
In previous versions of FontLab VI, you could use Element References to work with repeatable shapes across a font. Element References work great when you want to re-use a design pieces such as a stem, a serif or other glyph fragments (contours or images) across multiple glyphs in the same layer, and maintain a link between all the places where you’ve placed it. All Element References are equal. There is no source glyph to which they point to — they all link to each other. Element References have no knowledge about glyph metrics or anchors. In a way, they’re very similar to subroutines used in PostScript-flavored (CFF) OpenType fonts.
Previous versions of FontLab VI simulated components using Element References, by locking some references and dynamically finding the best candidate glyph for a component source. But this was never a fully satisfying experience, so we’ve decided to add support for real Components.
Element References are great if you link between pieces of glyphs, or even between pieces within the same glyph. Components are great if you build composite glyphs from other glyphs. So FontLab VI 6.1 has both mechanisms, each to fit its purpose.
You can build composite glyphs from Components in one or all masters — via Generate Glyphs, Add Component, Copy-Paste or Auto Layers. You can mix Components and simple contours in one layer. You can use nested Components that point to glyphs that are made of Components (for example, you can build a dieresiscomb
glyph from two dotaccentcomb
Components, and then build Adieresis
from the Components A
and dieresiscomb
).
FontLab VI will keep your Component structure when it exports your font to a format that supports components (TTF, VFB, UFO), and will decompose Components as needed when a format does not support components at all, or does not support some aspects such as rotated Components or Components mixed with contours.
Start using Components»
You can decide to use Components or keep using Element References in FontLab VI. For that, in Preferences > Open Fonts > Composite glyphs, choose:
- Use components and FontLab VI will prefer to use Components.
- Convert components to element references and FontLab VI will prefer to use Element References.
Opening fonts»
Opening FontLab VI files (VFC, VFJ)»
When you open a font in the .vfc
or .vfj
format, FontLab will keep your Element References as Element References, and will keep your Components as Components. If you wish, you can convert Element References to Components at any time (see below).
The exception is Auto Layers, since FontLab builds them dynamically: if Use components is on, FontLab will use Components, and if Convert components to element references is on, FontLab will use Element References to dynamically build your Auto Layers.
Opening font formats that support components»
When you open a font in a format that supports components (.ttf
, .vfb
, .ufo
, .fog
, .glyphs
, and their derivatives such as .woff
):
- if Use components is on, FontLab will import the Components exactly as they are in the font
- if Convert components to element references is on, FontLab will convert the components to Element References
Opening font formats that don’t support components»
If you turn on Preferences > Open Fonts > Detect composites and open a font in a format that does not support components (e.g. .otf
or Type 1), FontLab will build Element References between repeating contours across the font. If Use components is on, FontLab will then convert Element References to Components (see below).
Converting Element References to Components»
To convert existing Element References to Components, select all (or some) glyphs in the Font window, and choose Element > Element Reference > References to Components. Repeat this for each master.
- If the font has a glyph where a referenced Element is used by itself, FontLab will use it as the source glyph for the Components, and will convert all other Element References into Components.
- If the font has is more than one glyph where a referenced Element is used by itself, FontLab will use the glyph as source where the referenced Element is unlocked and is “least transformed”, i.e. it is placed closest to the origin point (0, 0) and has no other transformations applied.
- If the font does not have a glyph that can be used as the source glyph for the Components, FontLab will keep Element References as they were.
If you’ve created some “helper glyphs” that hold your design parts like serifs or stems, then Element References to those glyphs will be converted to Components.
If you use Element > Element Reference > References to Components in the Glyph window, FontLab will attempt to convert all Element References in the current layer into Components using the just-described mechanism.
Automatically adding components»
If Use components is on, FontLab will use Components:
- when you use Font > Generate Glyphs
- when you turn on Glyph > Auto Layer for a glyph layer or turn on the Auto layer button in the Layers & Masters panel
- when you have Preferences > Operations > New glyphs > fill created glyphs with content when available turned on and you double-click on an empty glyph cell in the Font window
- when you perform Font > Detect Composites (will use them if it can)
If Convert components to element references is on, FontLab will use Element References instead (and the menu item will be Font > Detect Element References).
Tip: To quickly replace your manually-constructed composite glyph master with an automatically generated glyph master that will use the “correct” components (if it’s in FontLab’s alias.dat
database), turn on Glyph > Auto Layer. If you want to correct the placement of the components, turn Glyph > Auto Layer off.
Manually adding components»
Glyph > Add Component…»
Choose Glyph > Add Component… in the Glyph window (or right-click and choose it from the context menu) to add a component to the current master or all masters of your current glyph. Or use it in the Font window to add the same component to multiple glyphs at once.
In the Add Component dialog, start typing the glyph name of the component you want to add, and you’ll see a list of results. When the Find glyph name synonyms toggle is on, FontLab will also find Decyr
if you type in uni0414
or vice-versa. By default, FontLab will insert the first glyph on the list but you can pick a different one.
At the bottom of the dialog, you can decide where to place the inserted component:
- If you leave the X and Y fields empty, FontLab will:
- use matching anchors if available (e.g.
top
in the current glyph and_top
in the component glyph) - otherwise it will center the inserted component horizontally, and will shift the component upwards by the difference of caps height and x‑height if you’re adding a mark component to an uppercase letter, but will do no vertical shift if the mark’s name ends with
.case
or.cap
or if you’re adding a component that isn’t a mark
- use matching anchors if available (e.g.
- You can enter a numeric value into either X or Y or both, then FontLab will use the value for the specified coordinate, but if a field is blank, FontLab will use the above procedure for that coordinate (so you can enter
0
in Y and leave X blank, and you’ll get a horizontally centered component with no vertical shift) - You can enter an anchor name into either field — if the current glyph and the component have several matching anchors, the specified anchor will be used
- You can also mix anchor-based and absolute positioning, e.g. enter
0
into X andtop
into Y will place the component at the origin point horizontally but use the specified anchor for vertical positioning
Use the Flip horizontally and Flip vertically buttons to mirror the inserted component.
Choose whether the current glyph should keep its metrics, or whether the advance width should be replaced by the width of the inserted component.
Use the Apply to all masters toggle to insert the component into the current master or to all masters.
Copy-Paste»
In Font window, select one glyph cell and choose Edit > Copy. Then select one or more glyph cells and choose Edit > Paste Components, and FontLab will insert the copied glyph as a component into all selected glyphs in all masters.
In Font window, select more than one glyph cells and choose Edit > Copy. Then select one ore more glyph cells and choose Edit > Paste Components, and then FontLab will insert the first copied glyph as a component into the first selected glyph, the second copied glyph as a component into the second selected glyph, and so on — again, in all masters.
Using Components»
Components in FontLab VI 6.1 are special Elements which are “glyph filters”. So you can use the Element tool to move components (but you can also use the Contour tool). You can use most of the Element menu and the Elements panel to work with Components. For example:
- Use the
<
and>
keys to switch between Components in the current glyph. - To open the Component’s source glyph for editing next to your current glyph, double-click a Component, or when a Component is active, press CtrlE, or right-click and choose Edit Element, or choose Element > Element Reference > Edit Element.
- To make a Component “first”, choose Element > Arrange > Send to Back or drag the Component to the bottom of the components list in the Elements panel.
- Align components and other elements within the glyph layer with the the Element > Align menu items.
- Use Element > Group if you want to always move several components in a glyph together, and Ungroup them if you don’t.
Replace a Component»
When you use the Contour or the Element tool and a Component is active, the Glyph window property bar will show an underlined C: icon, and a text field that shows the name of the component’s source glyph.
Type a different glyph name (or a synonym) into the text field, or click on the C: icon and type it in the Replace Component dialog, and press Enter — and the current component will be replaced in the current master with a component that points to a different glyph.
You can also replace a component in the current master by typing a new glyph name in the Glyph name field of the Elements panel (use the Show element properties to show the field).
To replace a component in all layers, you need to perform the replacement in each layer.
Decompose»
When a Component is active in the Glyph window, you can click on the Decompose button in the Glyph window property bar on in the Elements panel, and the component will be decomposed in the current layer, i.e. its contours and guidelines will be inserted into the current glyph.
To Decompose all components in the current layer, choose Glyph > Decompose or right-click in the Glyph window and choose Decompose from the context menu. However, if you’re in the Element tool and you Shift-click one or more Components, Glyph > Decompose and Decompose context menu item will decompose only the selected component(s).
When decomposing Components, FontLab will combine the contours of the decomposed Components and contours that pre-existed in the glyph into one single element — unless the source glyphs used different strokes or color fills.
Note:
- Element > Expand Filters will decompose a Component and remove any other Filters that exist in the source glyphs (for example Power Brush)
- Glyph > Flatten Glyph will decompose, remove filters and combine the decomposed elements into a single Element if possible
- Element > Separate Contours to Elements and Element > Optically Separate will also decompose, and then perform the separation
Convert Component to Element Reference»
Use Element > Element Reference > Component to Reference to convert a Component to an Element Reference. This is useful, for example, if you wish to apply some filters or change the fill color.
When you delete a glyph that is used as a source of Components in other glyphs, FontLab will convert the affected Components into Element References.
Nonspacing components and elements in FontLab VI 6.1»
FontLab VI now lets you declare some components or elements as nonspacing. Nonspacing components/elements don’t change the advance width of the glyph, but they change the way FontLab calculates and shows sidebearing values inside the app.
Unicode has a concept of “nonspacing characters” and OpenType fonts have “nonspacing glyphs”. During typesetting, nonspacing glyphs don’t contribute to the metrics of a line. They are positioned in relation to the preceding glyphs (the spacing glyphs) but their own metrics are ignored — so in the typesetting process, nonspacing glyphs have “invisible” metrics.
FontLab’s new Nonspacing components and elements perform a similar function when you build a glyph: they are visible, they are exported into the final font, and they don’t change the advance width of the glyph in any way, but inside FontLab VI they are “invisible” to the metrics engine. FontLab will ignore the Nonspacing components or elements when it shows the numerical values for the width and the sidebearings, when you copy metrics across glyphs using Paste Special, or when linked metrics are calculated using metrics expressions.
FontLab has a special guide called the “Measurement Line”. When you turn on View > Measurement Line, FontLab shows sidebearing values calculated at the intersection of the Measurement Line and glyph’s “ink”. This still works the same way. When you turn the Measurement Line off, the sidebearing values are calculated based on the bounding box of the entire glyph layer. With Nonspacing elements, you can exclude certain elements or components from that bounding box for the purposes of calculating the sidebearings. Of course when you export your font into a final format, FontLab will write the correct “absolute” metrics into the font.
Example: in the “ī” (imacron
) glyph, you can make the macron
component Nonspacing and then set the LSB and RSB to =dotlessi
. The macron
component will be ignored when the final imacron
sidebearings are calculated, so it’s easier to link the imacron
metrics to those of dotlessi
.
Using Nonspacing components and elements»
When you click a component using the Contour or Element tool in the Glyph window, or you click an element using the Element tool, a Nonspacing toggle appears in the Property bar. Use that toggle to set or unset the Nonspacing property of a component or element, or use the toggles in the Nonspacing column in the Elements panel.
When you turn on Preferences > Open Fonts > Automatically assign nonspacing property to accent components and you open any font, FontLab will assign the Nonspacing property to those components where their source glyph or its default variant (without glyph name suffix):
- has the glyph name
circumflex
orcaron
, - or has the Unicode U+02B9 – 02BD, U+02C6 – 02CF, U+02EC,
- or is in the Unicode “Nonspacing Mark” or “Modifier Symbol” category,
- or has the OT Glyph Definition Class “Mark”
When this preference is on, FontLab will also use the above method to assign the Nonspacing property to components in Auto layers.
When you use Element > Nonspacing > Detect Nonspacing in the Font window, FontLab will use the above method to assign the Nonspacing property to components in the current layer of the selected glyphs. To do it for all layers, use Tools > Actions > Metrics > Nonspacing > Detect nonspacing.
If you use Element > Nonspacing > Detect Nonspacing in the glyph window, FontLab will use the above method to assign the Nonspacing property to the current element or to selected elements (so only the components that fit the criteria will become Nonspacing).
To unset the Nonspacing property in all masters, i.e. make all components and elements spacing, use Tools > Actions > Metrics > Nonspacing > Clear nonspacing. To do it in current layer only, use Element > Nonspacing > Clear Nonspacing.
If you do not want to use Nonspacing components or elements, use Tools > Actions > Metrics > Nonspacing > Clear nonspacing on All Masters and entire font, and turn off Preferences > Open Fonts > Automatically assign nonspacing property to accent components.
Metrics expressions (linked metrics) in FontLab VI 6.1»
FontLab VI 6.1 brings several improvements to metrics expressions that you can use to link glyph metrics across different glyphs and layers. Updating linked metrics is now much faster, metrics expressions consistently take precedence over static numerical values, you can link metrics to other glyphs on other font masters, and you can use additional functions (and straight quotes) in metrics expressions.
Faster updating of linked metrics»
FontLab now updates expressions much faster, so Preferences > Spacing > Automatically update linked metrics is now on by default. If you have a font with thousands of glyphs that use linked metrics, you may want to turn it off, and instead trigger Font > Update Metrics manually.
Metrics expressions take precedence»
The interaction between expressions and explicit numerical values in the three metrics fields (left sidebearing (LSB), right sidebearing (RSB), advance width) is now more logical: expressions take precedence over simple number values; and for conflicting expressions, the last expression you entered takes precedence.
- If you use just one expression in any of the three fields, the other fields will adjust. So if you enter
i
into the RSB field of “j” and change the RSB of “i”, the spacing of “j” will update correctly. - If you use expressions in any two of the fields, the third field will adjust. So if you link the RSB and the width of “j” to
i
, the LSB of “j” will adjust. - If you use expressions in all three fields (a bad idea, which will likely lead to future problems/inconsistencies), the last expression you enter will take precedence, and one of the others will be adjusted by adding a constant.
Additional notation and functions in metrics expressions»
Whenever you specify a glyph in a metrics expression, you can use the glyph name (e.g. aogonek
) to refer to the current layer of that glyph. This works inside functions, in simple expressions and as a constant in extended expressions.
In addition, you can specify a glyph and layer using the following methods (but these won’t work as constants in extended expressions):
ą
: a single Unicode character. Specifies the current layer of the glyph that has the Unicode codepoint of that character.:Thin
: the layer name after a colon, without a glyph name. Specifies a different layer of the current glyphą:Bold
oraogonek:Regular
: the layer name after a colon, following a character or glyph name. Specifies a different layer of that glyph
The following table lists FontLab-specific functions that you can use inside expressions. Note: glyphspec
portion stands for a glyph and/or layer specified as above. New: You can now surround glyphspec
and guidename
with single quotes ('
), or, as previously, with double quotes ("
).
Function | Description |
---|---|
l() |
LSB of the current glyph and layer |
r() |
RSB of the current glyph and layer |
b() |
new: bounding box width of the current glyph and layer |
w() |
advance width of the current glyph and layer (l()+b()+r() ) |
lsb("glyphspec") |
LSB of the specified glyph and/or layer |
rsb("glyphspec") |
RSB of the specified glyph and/or layer |
width("glyphspec") |
advance width of the specified glyph and/or layer |
g("guidename") |
x position of a vertical guideline named guidename within the current glyph and layer |
For example, if you enter :Regular+10
or =width(':Regular') + 10
into the advance width field of the space
glyph in the Bold layer, the width will be 10 units larger than the width of the same glyph’s Regular
layer.
In addition, you can use all built-in functions and operators built into the muParser library that FontLab VI uses. This includes:
- conditional expressions that use the syntax
(condition) ? value_if_true : value_if_false
. If you enter=(d>0) ? d : o
into the LSB field of “q”, then its LSB will be equal to LSB of “d” if the LSB of “d” is larger than 0, but if the LSB of “d” is 0 (which would be the case if it has no contours), the LSB of “q” will be equal to LSB of “o”. - statistical expressions such as
=max(i, w, m)
or=avg(width(':Thin'), width(':Bold'))
Other improvements in linked metrics»
- Metrics resulting from expressions are now always rounded to integers. For example, when
H
has the width100
, andI
has the width expression= H / 3
, it results in33
, and whenK
has the width expression= I * 2
, it results in66
. Inside expressions, fractional values are still used, so an expression like= H / 3 + 0.18
will result in34
. - When you use an expression in a metrics field of a glyph and then manually adjust that glyph’s metrics (by using Ctrl or ++Alt+ with the arrow keys, or by dragging the spacing controls), your adjustment modifies the expression (by adding or subtracting the value). So when you enter
i
into the RSB field of “j” and then drag the RSB control of “j” by 10 units to the right, the RSB field will have the expressioni+10
. Previously, any manual edits caused the expression to be replaced by an explicit numerical value.
Note: For a detailed description of other improvements and bug fixes in FontLab VI 6.1, see the Release Notes.