Smart Sets ↩
- Types of Smart Sets
- Smart Set locations
- Smart Set data format
- Editing Smart Sets
- Query strings
- Smart Sets vs. Groups
This page explains what Smart Sets are and how to use them.
Smart Sets are an interface for visualizing collections of glyphs in the Font Overview.
They can be selected and edited using the Smart Sets panel.
Types of Smart Sets
Smart Sets can be of two different types:
- List-based Smart Sets
-
Static sets defined by a list of glyph names.
Identified by a list icon. - Query-based Smart Sets
-
Dynamic sets defined by a query.
Identified by a gear icon.
Smart Set locations
Smart Sets can be stored in two different places:
- Default Sets
-
Stored in the application defaults.
Available for all open fonts. - Font Sets
-
Stored in the font lib under a custom key:
com.typemytype.robofont.smartSets
Available only for this font.
Smart Set data format
A Smart Set is defined as a list of dicts.
Each dict in the list must follow the format below:
key | description |
---|---|
smartsetName |
The name of the smart set as a string. required |
query |
The query as a string. required |
glyphNames |
Indicates that the Smart Set contains a list of glyph names (a string). The query is still required. optional |
group |
Indicates that the Smart Set is a folder (a list of Smart Sets dicts). optional |
uniqueKey |
Each set needs a unique key, which is stored in the Smart Set. autogenerated if not present |
Editing Smart Sets
There are multiple ways to edit Smart Sets data:
-
By double-clicking a set in the Smart Sets panel. This will open a sheet with a list of glyph names (for list-based sets) or the Search Glyphs panel (for query-based sets).
-
By importing/exporting
.robofontSets
files using the options menu, or by dropping a.robofontSets
file on top of one of the headers (Defaults Sets or Font Sets). -
By manipulating the data with code using the
mojo.smartSet
API. -
By manipulating the Smart Sets data directly in the
ufo.lib
or in the application defaults. (not recommended)
Query strings
Query strings in query-based Smart Sets are defined using Apple’s Predicate Format String Syntax, which is also implemented in the Search Glyphs panel.
The attribute names used to build the queries are the same as the names displayed in the Search Glyph panel’s glyph attributes menu, without spaces.
Here is an example query string:
Name CONTAINS ‘foo’ OR Contours >= 5 AND Unicode > 1234
This query will return all glyphs with a name containing foo
or all glyphs with more than 4 contours and a unicode value bigger than 4D2
.
Smart Sets vs. Groups
Smart Sets are similar in concept to groups: both represent collections of glyphs.
The table below outlines the main differences between groups and Smart Sets:
groups | Smart Sets | |
---|---|---|
implementation | defined in the UFO format and in the FontParts Object map | a special feature provided by RoboFont |
data storage | stored in font.groups |
stored in the application or in the font.lib |
glyphs | defined as a list of glyph names | defined as a list of glyph names or as a search query |
interface | edited using the Groups sheet, which is modal | edited within the Font Overview, works like a search performed with the Search Glyphs panel |
To convert a Smart Set into a group, choose Export to a Font Group from the options menu at the bottom left of the Smart Sets panel.