ftcli assistant¶
Helps the user to correctly compile ‘name’ table and to set the proper values for usWeightClass, usWidthClass, bold, italic and oblique flags.
The first step consists in creating two files in a folder named ftCLI_files under the current directory:
1) styles_mapping.json
: contains the default Style Names to pair with usWidthClass,
usWeightClass and Slope class (e.g.: 500: Md, Medium; 3: Cnd, Condensed; It, Italic; Obl, Oblique).
fonts_data.csv
: is a CSV file containing the following columns:
‘file_name’: path the font file
‘family_name’: family name (read from the font)
‘is_bold’: bold flag (read from the font: “1” if the bold flag is set, “0” it the bold flag is
clear)
‘is_italic’: italic flag (read from the font: “1” if the italic flag is set, “0” it the italic
flag is clear)
‘is_oblique’: oblique flag (read from the font: “1” if the oblique flag is set, “0” it the oblique
flag is clear)
‘us_width_class’: usWidthClass value (read from the font)
‘wdt’: short word for width style name (read from styles_mapping.json, if usWidthClass is
present)
‘width’: long word for width style name (read from styles_mapping.json, if usWidthClass is
present)
‘us_weight_class’: usWeightClass value (read from the font)
‘wgt’: short word for weight style name (read from styles_mapping.json, if usWeightClass is
present)
‘weight’: long word for weight style name (read from styles_mapping.json, if usWeightClass is
present)
‘slp’: short word for slope class (read from styles_mapping.json. None if the font is not italic
nor oblique)
‘slope’: long word for slope class (read from styles_mapping.json. None if the font is not italic
nor oblique)
‘selected’: “1” to select the file, “0” to deselect (it will not be processed by ftcli assistant
commit)
Files can be created with ftcli assistant init INPUT_PATH
or ftcli assistant ui INPUT_PATH
.
The first command will create both files (if one or both already exist, user will be prompted for
overwrite). The second command will create the files (unless they already exist) and will open the
editor.
When the data in the ‘fonts_data.csv’ file are filled as desired by the user, fonts can be patched
running the ftcli assistant commit
command.
ftcli assistant [OPTIONS] COMMAND [ARGS]...
subcommands¶
commit¶
Writes data from CSV to fonts.
ftcli assistant commit [OPTIONS] INPUT_PATH
Options
- --width-elidable <width_elidable>¶
The width word to elide when building the namerecords.
- Default:
'Normal'
- --weight-elidable <weight_elidable>¶
The weight word to elide when building the namerecords.
- Default:
'Regular'
- -ls, --linked-styles <linked_styles>¶
Use this option to activate linked styles. If this option is active, linked styles must be specified. For example: -ls 400 700, or -ls 300 600.
- -x, --exclude-namerecords <exclude_namerecords>¶
Name IDs to skip. The specified name IDs won’t be recalculated. This option can be repeated (for example: -x 3 -x 5 -x 6…).
- Options:
1 | 2 | 3 | 4 | 5 | 6 | 16 | 17 | 18
- -swdt, --shorten-width <shorten_width>¶
Name IDs where to use the short word for width style name (for example, ‘Cn’ instead of ‘Condensed’). This option can be repeated (for example: -swdt 1 -swdt 5, -swdt 16…).
- Options:
1 | 4 | 6 | 16 | 17
- -swgt, --shorten-weight <shorten_weight>¶
Name IDs where to use the short word for weight style name (for example, ‘Md’ instead of ‘Medium’). This option can be repeated (for example: -swgt 1 -swgt 5 -swgt 6…).
- Options:
1 | 4 | 6 | 17
- -sslp, --shorten-slope <shorten_slope>¶
Name IDs where to use the short word for slope style name (for example, ‘It’ instead of ‘Italic’). This option can be repeated (for example: -sslp 3 -sslp 5 -sslp 6…).
- Options:
4 | 6 | 16 | 17
- -kwdt, --keep-width-elidable¶
Doesn’t remove the width elidable words (by default, “Nor” and “Normal”).
- -kwgt, --keep-weight-elidable¶
Doesn’t remove the weight elidable words (by default, “Rg” and “Regular”).
- -sf, --super-family¶
Superfamily mode. This option affects name IDs 3, 6, 16 and 17 in case of families with widths different than ‘Normal’. If this option is active, name ID 6 will be ‘FamilyName-WidthWeightSlope’ instead of ‘FamilyNameWidth-WeightSlope’. Mac and OT family/subfamily names will be FamilyName / Width Weight Slope’ instead of ‘Family Name Width / Weight Slope’.
- -aui, --alt-uid¶
Use alternate unique identifier. By default, nameID 3 (Unique identifier) is calculated according to the following scheme: ‘Version;Vendor code;PostscriptName’. The alternate unique identifier is calculated according to the following scheme: ‘Manufacturer: Full Font Name: Creation Year’.
- -obni, --oblique-not-italic¶
By default, if a font has the oblique bit set, the italic bits will be set too. Use this option to override the default behaviour (for example, when the family has both italic and oblique styles and you need to keep oblique and italic styles separate). The italic bits will be cleared when the oblique bit is set.
- --no-auto-shorten¶
When name id 1, 4 or 6 are longer than maximum allowed (27 characters for nameID 1, 31 for nameID 4 and 29 for nameID 6), the script tries to auto shorten those names replacing long words with short words. Use this option to prevent the script from auto shortening names.
- -cff¶
If this option is active, fontNames, FullName, FamilyName and Weight values in the ‘CFF’ table will be recalculated.
- -out, --output-dir <output_dir>¶
Specify the directory where output files are to be saved. If the directory doesn’t exist, will be created. If output_dir is not specified, files will be saved to the same folder.
- --recalc-timestamp¶
Keep the original font ‘modified’ timestamp (head.modified) or set it to current time. By default, original timestamp is kept.
- --no-overwrite¶
Overwrite existing files or save them to a new file (numbers are appended at the end of file name). By default, files are overwritten.
Arguments
- INPUT_PATH¶
Required argument
init¶
Creates the styles_mapping.json
and the fonts_data.csv
files in the ftCLI_files
directory. If one or both files already exist, user will be prompted for overwrite.
Both files can be edited manually or using the ftcli assistant ui
command.
ftcli assistant init [OPTIONS] INPUT_PATH
Options
- -q, --quiet¶
Suppress the overwrite confirmation message if the fonts_data.csv and/or styles_mapping.json files already exist in the ftCLI_files folder.
Arguments
- INPUT_PATH¶
Required argument
ui¶
Opens the character user interface to edit the styles_mapping.json and fonts_data.csv files.
ftcli assistant ui [OPTIONS] INPUT_PATH
Arguments
- INPUT_PATH¶
Required argument