utils
- @fontbakery.utils.apple_terminal_bg_is_white[source]
Returns a boolean indicating if the background color of Apple’s Terminal is white.
- @fontbakery.utils.can_shape(ttFont, text, parameters=None)[source]
Returns true if the font can render a text string without any .notdef characters.
- @fontbakery.utils.filenames_ending_in(suffix, root)[source]
Returns a list of the filenames of all files in a given directory subtree that have the given filename suffix. Example: List all “.json” files.
- @fontbakery.utils.format_error[source]
Detail an error with name and stack trace for serialisation.
- @fontbakery.utils.get_apple_terminal_bg_color[source]
Runs an AppleScript snippet that returns the RGB values of the background color of the active Apple Terminal window.
- @fontbakery.utils.get_family_name[source]
Get the family name from the name table.
TODO: For now, this is just name ID 1. It should be expanded to at least check IDs 16 & 21, and ideally do the whole font differentiator heuristic.
- @fontbakery.utils.get_name_entries(font, nameID, platformID=None, encodingID=None, langID=None)[source]
- @fontbakery.utils.get_name_entry_strings(font, nameID, platformID=None, encodingID=None, langID=None)[source]
- @fontbakery.utils.get_resource_file_contents[source]
Return the full file path of a resource file inside the fontbakery directory.
- Parameters:
sub_file_path (str) – The file path relative to the fontbakery directory.
- Returns:
The full file path
- Return type:
Path
- @fontbakery.utils.get_subfamily_name[source]
Get the subfamily name from the name table.
TODO: For now, this is just name ID 2. It should be expanded to at least check IDs 17 & 22, and ideally do the whole font differentiator heuristic.
- @fontbakery.utils.glyph_contour_count(font, name)[source]
Contour count for specified glyph. This implementation will also return contour count for composite glyphs.
- @fontbakery.utils.glyph_has_ink(font: TTFont, glyph_name: str) bool[source]
Checks if specified glyph has any ink.
That is, that it has at least one defined contour associated. Composites are considered to have ink if any of their components have ink. :param font: the font :param glyph_name: The name of the glyph to check for ink.
- Returns:
True if the font has at least one contour associated with it.
- @fontbakery.utils.iterate_lookup_list_with_extensions(ttFont, table, callback, *args)[source]
Iterates over the lookup list of a font’s GSUB/GPOS table, calling the callback with the lookup and the provided arguments, but descending into Extension subtables.
- @fontbakery.utils.markdown_table[source]
Format a list of dicts into a markdown table.
>>> markdown_table( >>> [{"name": "Sam", "age": 30}, {"name": "Ash", "age": 25}] >>> ) ... | name | age | | :--- | :--- | | Sam | 30 | | Ash | 25 |
- @fontbakery.utils.pretty_print_list(config, values, shorten=10, sep=', ', glue=' and ', quiet=False)[source]
- @fontbakery.utils.remove_cmap_entry(font, cp)[source]
Helper method that removes a codepoint entry from all the tables in cmap.
- @fontbakery.utils.show_inconsistencies(dictionary, config)[source]
Display an ‘inconsistencies dictionary’ as a bullet list. Turns:
{ “value1”: [“file1”, “file2”], “value2”: [“file3”] }
into
value1: file1 and file2
value2: file3