utils

exception fontbakery.utils.BadCertificateSetupException[source][source]
class fontbakery.utils.PointsPen[source][source]
getPoints()[source][source]
highestPoint()[source][source]
lowestPoint()[source][source]
fontbakery.utils.add_check_overrides(checkids, profile_tag, overrides)[source][source]

Overridden checkids have a suffix identifying the specific profile that customize their behaviour.

This helper function adds them to the list of checks and ensures the original check is not redundantly listed.

fontbakery.utils.all_kerning(ttFont)[source][source]
fontbakery.utils.apple_terminal_bg_is_white()[source][source]

Returns a boolean indicating if the background color of Apple’s Terminal is white.

fontbakery.utils.axis(ttFont, tag)[source][source]

Return the axis with the given tag.

fontbakery.utils.bullet_list(config, items, bullet='-', indentation='\t')[source][source]
fontbakery.utils.cff_glyph_has_ink(font: fontTools.ttLib.ttFont.TTFont, glyph_name: str) bool[source][source]
fontbakery.utils.chars_in_range(ttFont, bit)[source][source]
fontbakery.utils.check_bit_entry(ttFont, table, attr, expected, bitmask, bitname)[source][source]
fontbakery.utils.colorless_len(string)[source][source]

Returns the lenght of a string without its color prefix

fontbakery.utils.compute_unicoderange_bits(ttFont)[source][source]
fontbakery.utils.download_file(url)[source][source]
fontbakery.utils.exit_with_install_instructions()[source][source]
fontbakery.utils.filenames_ending_in(suffix, root)[source][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.filesize_formatting(s)[source][source]
fontbakery.utils.get_DesignerInfoProto_Message(text_data)[source][source]
fontbakery.utils.get_FamilyProto_Message(path)[source][source]
fontbakery.utils.get_Protobuf_Message(klass, path)[source][source]
fontbakery.utils.get_apple_terminal_bg_color()[source][source]

Runs an AppleScript snippet that returns the RGB values of the background color of the active Apple Terminal window.

fontbakery.utils.get_bounding_box(font)[source][source]

Returns max and min bbox of given truetype font

fontbakery.utils.get_font_glyph_data(font)[source][source]

Return information for each glyph in a font

fontbakery.utils.get_glyph_name(font: fontTools.ttLib.ttFont.TTFont, codepoint: int) Optional[str][source][source]
fontbakery.utils.get_name_entries(font, nameID, platformID=None, encodingID=None, langID=None)[source][source]
fontbakery.utils.get_name_entry_strings(font, nameID, platformID=None, encodingID=None, langID=None)[source][source]
fontbakery.utils.get_preferred_cmap(ttFont)[source][source]
fontbakery.utils.get_regular(fonts)[source][source]
fontbakery.utils.get_theme(args)[source][source]
fontbakery.utils.glyph_contour_count(font, name)[source][source]

Contour count for specified glyph. This implementation will also return contour count for composite glyphs.

fontbakery.utils.glyph_has_ink(font: fontTools.ttLib.ttFont.TTFont, glyph_name: str) bool[source][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.html5_collapsible(summary, details) str[source][source]

Return nestable, collapsible <detail> tag for check grouping and sub-results.

fontbakery.utils.is_negated(name)[source][source]
fontbakery.utils.iterate_lookup_list_with_extensions(ttFont, table, callback, *args)[source][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(items)[source][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.name_entry_id(name)[source][source]
fontbakery.utils.pretty_print_list(config, values, shorten=10, sep=', ', glue=' and ')[source][source]
fontbakery.utils.remove_white_space(s)[source][source]
fontbakery.utils.set_profile_name(name)[source][source]
fontbakery.utils.split_camel_case(camelcase)[source][source]
fontbakery.utils.text_flow(content, width=80, indent=0, left_margin=0, right_margin=0, first_line_indent=0, space_padding=False, text_color=<built-in method format of str object>)[source][source]
fontbakery.utils.ttf_glyph_has_ink(font: fontTools.ttLib.ttFont.TTFont, name: str) bool[source][source]
fontbakery.utils.unicoderange_bit_name(bit)[source][source]
fontbakery.utils.unindent_and_unwrap_rationale(rationale, checkid=None)[source][source]

Takes the ‘rationale’ docstring of a check and removes indents and hard line breaks that were added to long lines.