repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
googlefonts/fontbakery | Lib/fontbakery/profiles/universal.py | com_google_fonts_check_whitespace_ink | def com_google_fonts_check_whitespace_ink(ttFont):
"""Whitespace glyphs have ink?"""
from fontbakery.utils import get_glyph_name, glyph_has_ink
# code-points for all "whitespace" chars:
WHITESPACE_CHARACTERS = [
0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x0020, 0x0085, 0x00A0, 0x1680,
0x2000, 0x2001,... | python | def com_google_fonts_check_whitespace_ink(ttFont):
"""Whitespace glyphs have ink?"""
from fontbakery.utils import get_glyph_name, glyph_has_ink
# code-points for all "whitespace" chars:
WHITESPACE_CHARACTERS = [
0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x0020, 0x0085, 0x00A0, 0x1680,
0x2000, 0x2001,... | [
"def",
"com_google_fonts_check_whitespace_ink",
"(",
"ttFont",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_glyph_name",
",",
"glyph_has_ink",
"WHITESPACE_CHARACTERS",
"=",
"[",
"0x0009",
",",
"0x000A",
",",
"0x000B",
",",
"0x000C",
",",
"0x000D",
... | Whitespace glyphs have ink? | [
"Whitespace",
"glyphs",
"have",
"ink?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/universal.py#L652-L672 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/universal.py | com_google_fonts_check_required_tables | def com_google_fonts_check_required_tables(ttFont):
"""Font contains all required tables?"""
from .shared_conditions import is_variable_font
REQUIRED_TABLES = {
"cmap", "head", "hhea", "hmtx", "maxp", "name", "OS/2", "post"}
OPTIONAL_TABLES = {
"cvt ", "fpgm", "loca", "prep", "VORG", "EBDT", "EBLC"... | python | def com_google_fonts_check_required_tables(ttFont):
"""Font contains all required tables?"""
from .shared_conditions import is_variable_font
REQUIRED_TABLES = {
"cmap", "head", "hhea", "hmtx", "maxp", "name", "OS/2", "post"}
OPTIONAL_TABLES = {
"cvt ", "fpgm", "loca", "prep", "VORG", "EBDT", "EBLC"... | [
"def",
"com_google_fonts_check_required_tables",
"(",
"ttFont",
")",
":",
"from",
".",
"shared_conditions",
"import",
"is_variable_font",
"REQUIRED_TABLES",
"=",
"{",
"\"cmap\"",
",",
"\"head\"",
",",
"\"hhea\"",
",",
"\"hmtx\"",
",",
"\"maxp\"",
",",
"\"name\"",
",... | Font contains all required tables? | [
"Font",
"contains",
"all",
"required",
"tables?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/universal.py#L689-L728 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/universal.py | com_google_fonts_check_unwanted_tables | def com_google_fonts_check_unwanted_tables(ttFont):
"""Are there unwanted tables?"""
UNWANTED_TABLES = {
'FFTM': '(from FontForge)',
'TTFA': '(from TTFAutohint)',
'TSI0': '(from VTT)',
'TSI1': '(from VTT)',
'TSI2': '(from VTT)',
'TSI3': '(from VTT)',
'TSI5': '(from VTT)',
... | python | def com_google_fonts_check_unwanted_tables(ttFont):
"""Are there unwanted tables?"""
UNWANTED_TABLES = {
'FFTM': '(from FontForge)',
'TTFA': '(from TTFAutohint)',
'TSI0': '(from VTT)',
'TSI1': '(from VTT)',
'TSI2': '(from VTT)',
'TSI3': '(from VTT)',
'TSI5': '(from VTT)',
... | [
"def",
"com_google_fonts_check_unwanted_tables",
"(",
"ttFont",
")",
":",
"UNWANTED_TABLES",
"=",
"{",
"'FFTM'",
":",
"'(from FontForge)'",
",",
"'TTFA'",
":",
"'(from TTFAutohint)'",
",",
"'TSI0'",
":",
"'(from VTT)'",
",",
"'TSI1'",
":",
"'(from VTT)'",
",",
"'TSI... | Are there unwanted tables? | [
"Are",
"there",
"unwanted",
"tables?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/universal.py#L737-L762 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/universal.py | com_google_fonts_check_valid_glyphnames | def com_google_fonts_check_valid_glyphnames(ttFont):
"""Glyph names are all valid?"""
if ttFont.sfntVersion == b'\x00\x01\x00\x00' and ttFont.get(
"post") and ttFont["post"].formatType == 3.0:
yield SKIP, ("TrueType fonts with a format 3.0 post table contain no"
" glyph names.")
else:
... | python | def com_google_fonts_check_valid_glyphnames(ttFont):
"""Glyph names are all valid?"""
if ttFont.sfntVersion == b'\x00\x01\x00\x00' and ttFont.get(
"post") and ttFont["post"].formatType == 3.0:
yield SKIP, ("TrueType fonts with a format 3.0 post table contain no"
" glyph names.")
else:
... | [
"def",
"com_google_fonts_check_valid_glyphnames",
"(",
"ttFont",
")",
":",
"if",
"ttFont",
".",
"sfntVersion",
"==",
"b'\\x00\\x01\\x00\\x00'",
"and",
"ttFont",
".",
"get",
"(",
"\"post\"",
")",
"and",
"ttFont",
"[",
"\"post\"",
"]",
".",
"formatType",
"==",
"3.... | Glyph names are all valid? | [
"Glyph",
"names",
"are",
"all",
"valid?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/universal.py#L777-L810 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/universal.py | com_google_fonts_check_unique_glyphnames | def com_google_fonts_check_unique_glyphnames(ttFont):
"""Font contains unique glyph names?"""
if ttFont.sfntVersion == b'\x00\x01\x00\x00' and ttFont.get(
"post") and ttFont["post"].formatType == 3.0:
yield SKIP, ("TrueType fonts with a format 3.0 post table contain no"
" glyph names.")
... | python | def com_google_fonts_check_unique_glyphnames(ttFont):
"""Font contains unique glyph names?"""
if ttFont.sfntVersion == b'\x00\x01\x00\x00' and ttFont.get(
"post") and ttFont["post"].formatType == 3.0:
yield SKIP, ("TrueType fonts with a format 3.0 post table contain no"
" glyph names.")
... | [
"def",
"com_google_fonts_check_unique_glyphnames",
"(",
"ttFont",
")",
":",
"if",
"ttFont",
".",
"sfntVersion",
"==",
"b'\\x00\\x01\\x00\\x00'",
"and",
"ttFont",
".",
"get",
"(",
"\"post\"",
")",
"and",
"ttFont",
"[",
"\"post\"",
"]",
".",
"formatType",
"==",
"3... | Font contains unique glyph names? | [
"Font",
"contains",
"unique",
"glyph",
"names?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/universal.py#L822-L843 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/universal.py | com_google_fonts_check_glyphnames_max_length | def com_google_fonts_check_glyphnames_max_length(ttFont):
"""Check that glyph names do not exceed max length."""
if ttFont.sfntVersion == b'\x00\x01\x00\x00' and ttFont.get(
"post") and ttFont["post"].formatType == 3.0:
yield PASS, ("TrueType fonts with a format 3.0 post table contain no "
... | python | def com_google_fonts_check_glyphnames_max_length(ttFont):
"""Check that glyph names do not exceed max length."""
if ttFont.sfntVersion == b'\x00\x01\x00\x00' and ttFont.get(
"post") and ttFont["post"].formatType == 3.0:
yield PASS, ("TrueType fonts with a format 3.0 post table contain no "
... | [
"def",
"com_google_fonts_check_glyphnames_max_length",
"(",
"ttFont",
")",
":",
"if",
"ttFont",
".",
"sfntVersion",
"==",
"b'\\x00\\x01\\x00\\x00'",
"and",
"ttFont",
".",
"get",
"(",
"\"post\"",
")",
"and",
"ttFont",
"[",
"\"post\"",
"]",
".",
"formatType",
"==",
... | Check that glyph names do not exceed max length. | [
"Check",
"that",
"glyph",
"names",
"do",
"not",
"exceed",
"max",
"length",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/universal.py#L857-L870 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/universal.py | com_google_fonts_check_ttx_roundtrip | def com_google_fonts_check_ttx_roundtrip(font):
"""Checking with fontTools.ttx"""
from fontTools import ttx
import sys
ttFont = ttx.TTFont(font)
failed = False
class TTXLogger:
msgs = []
def __init__(self):
self.original_stderr = sys.stderr
self.original_stdout = sys.stdout
sys.s... | python | def com_google_fonts_check_ttx_roundtrip(font):
"""Checking with fontTools.ttx"""
from fontTools import ttx
import sys
ttFont = ttx.TTFont(font)
failed = False
class TTXLogger:
msgs = []
def __init__(self):
self.original_stderr = sys.stderr
self.original_stdout = sys.stdout
sys.s... | [
"def",
"com_google_fonts_check_ttx_roundtrip",
"(",
"font",
")",
":",
"from",
"fontTools",
"import",
"ttx",
"import",
"sys",
"ttFont",
"=",
"ttx",
".",
"TTFont",
"(",
"font",
")",
"failed",
"=",
"False",
"class",
"TTXLogger",
":",
"msgs",
"=",
"[",
"]",
"d... | Checking with fontTools.ttx | [
"Checking",
"with",
"fontTools",
".",
"ttx"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/universal.py#L877-L946 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/universal.py | com_google_fonts_check_family_vertical_metrics | def com_google_fonts_check_family_vertical_metrics(ttFonts):
"""Each font in a family must have the same vertical metrics values."""
failed = []
vmetrics = {
"sTypoAscender": {},
"sTypoDescender": {},
"sTypoLineGap": {},
"usWinAscent": {},
"usWinDescent": {},
"ascent": {},
"descent": {... | python | def com_google_fonts_check_family_vertical_metrics(ttFonts):
"""Each font in a family must have the same vertical metrics values."""
failed = []
vmetrics = {
"sTypoAscender": {},
"sTypoDescender": {},
"sTypoLineGap": {},
"usWinAscent": {},
"usWinDescent": {},
"ascent": {},
"descent": {... | [
"def",
"com_google_fonts_check_family_vertical_metrics",
"(",
"ttFonts",
")",
":",
"failed",
"=",
"[",
"]",
"vmetrics",
"=",
"{",
"\"sTypoAscender\"",
":",
"{",
"}",
",",
"\"sTypoDescender\"",
":",
"{",
"}",
",",
"\"sTypoLineGap\"",
":",
"{",
"}",
",",
"\"usWi... | Each font in a family must have the same vertical metrics values. | [
"Each",
"font",
"in",
"a",
"family",
"must",
"have",
"the",
"same",
"vertical",
"metrics",
"values",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/universal.py#L956-L990 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/hhea.py | com_google_fonts_check_linegaps | def com_google_fonts_check_linegaps(ttFont):
"""Checking Vertical Metric Linegaps."""
if ttFont["hhea"].lineGap != 0:
yield WARN, Message("hhea", "hhea lineGap is not equal to 0.")
elif ttFont["OS/2"].sTypoLineGap != 0:
yield WARN, Message("OS/2", "OS/2 sTypoLineGap is not equal to 0.")
else:
yield ... | python | def com_google_fonts_check_linegaps(ttFont):
"""Checking Vertical Metric Linegaps."""
if ttFont["hhea"].lineGap != 0:
yield WARN, Message("hhea", "hhea lineGap is not equal to 0.")
elif ttFont["OS/2"].sTypoLineGap != 0:
yield WARN, Message("OS/2", "OS/2 sTypoLineGap is not equal to 0.")
else:
yield ... | [
"def",
"com_google_fonts_check_linegaps",
"(",
"ttFont",
")",
":",
"if",
"ttFont",
"[",
"\"hhea\"",
"]",
".",
"lineGap",
"!=",
"0",
":",
"yield",
"WARN",
",",
"Message",
"(",
"\"hhea\"",
",",
"\"hhea lineGap is not equal to 0.\"",
")",
"elif",
"ttFont",
"[",
"... | Checking Vertical Metric Linegaps. | [
"Checking",
"Vertical",
"Metric",
"Linegaps",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/hhea.py#L14-L21 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/hhea.py | com_google_fonts_check_maxadvancewidth | def com_google_fonts_check_maxadvancewidth(ttFont):
"""MaxAdvanceWidth is consistent with values in the Hmtx and Hhea tables?"""
hhea_advance_width_max = ttFont['hhea'].advanceWidthMax
hmtx_advance_width_max = None
for g in ttFont['hmtx'].metrics.values():
if hmtx_advance_width_max is None:
hmtx_advan... | python | def com_google_fonts_check_maxadvancewidth(ttFont):
"""MaxAdvanceWidth is consistent with values in the Hmtx and Hhea tables?"""
hhea_advance_width_max = ttFont['hhea'].advanceWidthMax
hmtx_advance_width_max = None
for g in ttFont['hmtx'].metrics.values():
if hmtx_advance_width_max is None:
hmtx_advan... | [
"def",
"com_google_fonts_check_maxadvancewidth",
"(",
"ttFont",
")",
":",
"hhea_advance_width_max",
"=",
"ttFont",
"[",
"'hhea'",
"]",
".",
"advanceWidthMax",
"hmtx_advance_width_max",
"=",
"None",
"for",
"g",
"in",
"ttFont",
"[",
"'hmtx'",
"]",
".",
"metrics",
".... | MaxAdvanceWidth is consistent with values in the Hmtx and Hhea tables? | [
"MaxAdvanceWidth",
"is",
"consistent",
"with",
"values",
"in",
"the",
"Hmtx",
"and",
"Hhea",
"tables?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/hhea.py#L27-L43 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/hhea.py | com_google_fonts_check_monospace_max_advancewidth | def com_google_fonts_check_monospace_max_advancewidth(ttFont, glyph_metrics_stats):
"""Monospace font has hhea.advanceWidthMax equal to each glyph's
advanceWidth?"""
from fontbakery.utils import pretty_print_list
seems_monospaced = glyph_metrics_stats["seems_monospaced"]
if not seems_monospaced:
yield SK... | python | def com_google_fonts_check_monospace_max_advancewidth(ttFont, glyph_metrics_stats):
"""Monospace font has hhea.advanceWidthMax equal to each glyph's
advanceWidth?"""
from fontbakery.utils import pretty_print_list
seems_monospaced = glyph_metrics_stats["seems_monospaced"]
if not seems_monospaced:
yield SK... | [
"def",
"com_google_fonts_check_monospace_max_advancewidth",
"(",
"ttFont",
",",
"glyph_metrics_stats",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"pretty_print_list",
"seems_monospaced",
"=",
"glyph_metrics_stats",
"[",
"\"seems_monospaced\"",
"]",
"if",
"not",... | Monospace font has hhea.advanceWidthMax equal to each glyph's
advanceWidth? | [
"Monospace",
"font",
"has",
"hhea",
".",
"advanceWidthMax",
"equal",
"to",
"each",
"glyph",
"s",
"advanceWidth?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/hhea.py#L50-L95 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/shared_conditions.py | glyph_metrics_stats | def glyph_metrics_stats(ttFont):
"""Returns a dict containing whether the font seems_monospaced,
what's the maximum glyph width and what's the most common width.
For a font to be considered monospaced, at least 80% of
the ascii glyphs must have the same width."""
glyph_metrics = ttFont['hmtx'].metrics
asci... | python | def glyph_metrics_stats(ttFont):
"""Returns a dict containing whether the font seems_monospaced,
what's the maximum glyph width and what's the most common width.
For a font to be considered monospaced, at least 80% of
the ascii glyphs must have the same width."""
glyph_metrics = ttFont['hmtx'].metrics
asci... | [
"def",
"glyph_metrics_stats",
"(",
"ttFont",
")",
":",
"glyph_metrics",
"=",
"ttFont",
"[",
"'hmtx'",
"]",
".",
"metrics",
"ascii_glyph_names",
"=",
"[",
"ttFont",
".",
"getBestCmap",
"(",
")",
"[",
"c",
"]",
"for",
"c",
"in",
"range",
"(",
"32",
",",
... | Returns a dict containing whether the font seems_monospaced,
what's the maximum glyph width and what's the most common width.
For a font to be considered monospaced, at least 80% of
the ascii glyphs must have the same width. | [
"Returns",
"a",
"dict",
"containing",
"whether",
"the",
"font",
"seems_monospaced",
"what",
"s",
"the",
"maximum",
"glyph",
"width",
"and",
"what",
"s",
"the",
"most",
"common",
"width",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/shared_conditions.py#L77-L98 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/shared_conditions.py | vtt_talk_sources | def vtt_talk_sources(ttFont) -> List[str]:
"""Return the tags of VTT source tables found in a font."""
VTT_SOURCE_TABLES = {'TSI0', 'TSI1', 'TSI2', 'TSI3', 'TSI5'}
tables_found = [tag for tag in ttFont.keys() if tag in VTT_SOURCE_TABLES]
return tables_found | python | def vtt_talk_sources(ttFont) -> List[str]:
"""Return the tags of VTT source tables found in a font."""
VTT_SOURCE_TABLES = {'TSI0', 'TSI1', 'TSI2', 'TSI3', 'TSI5'}
tables_found = [tag for tag in ttFont.keys() if tag in VTT_SOURCE_TABLES]
return tables_found | [
"def",
"vtt_talk_sources",
"(",
"ttFont",
")",
"->",
"List",
"[",
"str",
"]",
":",
"VTT_SOURCE_TABLES",
"=",
"{",
"'TSI0'",
",",
"'TSI1'",
",",
"'TSI2'",
",",
"'TSI3'",
",",
"'TSI5'",
"}",
"tables_found",
"=",
"[",
"tag",
"for",
"tag",
"in",
"ttFont",
... | Return the tags of VTT source tables found in a font. | [
"Return",
"the",
"tags",
"of",
"VTT",
"source",
"tables",
"found",
"in",
"a",
"font",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/shared_conditions.py#L180-L184 | train |
googlefonts/fontbakery | Lib/fontbakery/reporters/terminal.py | ThrottledOut.write | def write(self, data):
"""only put to stdout every now and then"""
self._buffer.append(data)
self._current_ticks += 1
# first entry ever will be flushed immediately
flush=False
if self._last_flush_time is None or \
(self._holdback_time is None and self._max_ticks == 0):
fl... | python | def write(self, data):
"""only put to stdout every now and then"""
self._buffer.append(data)
self._current_ticks += 1
# first entry ever will be flushed immediately
flush=False
if self._last_flush_time is None or \
(self._holdback_time is None and self._max_ticks == 0):
fl... | [
"def",
"write",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_buffer",
".",
"append",
"(",
"data",
")",
"self",
".",
"_current_ticks",
"+=",
"1",
"flush",
"=",
"False",
"if",
"self",
".",
"_last_flush_time",
"is",
"None",
"or",
"(",
"self",
".",... | only put to stdout every now and then | [
"only",
"put",
"to",
"stdout",
"every",
"now",
"and",
"then"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/reporters/terminal.py#L139-L154 | train |
googlefonts/fontbakery | Lib/fontbakery/reporters/terminal.py | ThrottledOut.flush | def flush(self, draw_progress=True):
"""call this at the very end, so that we can output the rest"""
reset_progressbar = None
if self._draw_progressbar and draw_progress:
progressbar, reset_progressbar = self._draw_progressbar()
self._buffer.append(progressbar)
for line in self._buffer:
... | python | def flush(self, draw_progress=True):
"""call this at the very end, so that we can output the rest"""
reset_progressbar = None
if self._draw_progressbar and draw_progress:
progressbar, reset_progressbar = self._draw_progressbar()
self._buffer.append(progressbar)
for line in self._buffer:
... | [
"def",
"flush",
"(",
"self",
",",
"draw_progress",
"=",
"True",
")",
":",
"reset_progressbar",
"=",
"None",
"if",
"self",
".",
"_draw_progressbar",
"and",
"draw_progress",
":",
"progressbar",
",",
"reset_progressbar",
"=",
"self",
".",
"_draw_progressbar",
"(",
... | call this at the very end, so that we can output the rest | [
"call",
"this",
"at",
"the",
"very",
"end",
"so",
"that",
"we",
"can",
"output",
"the",
"rest"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/reporters/terminal.py#L156-L171 | train |
googlefonts/fontbakery | Lib/fontbakery/reporters/terminal.py | TerminalProgress._draw_progressbar | def _draw_progressbar(self, columns=None, len_prefix=0, right_margin=0):
"""
if columns is None, don't insert any extra line breaks
"""
if self._order == None:
total = len(self._results)
else:
total = max(len(self._order), len(self._results))
percent = int(round(len(self._results)/t... | python | def _draw_progressbar(self, columns=None, len_prefix=0, right_margin=0):
"""
if columns is None, don't insert any extra line breaks
"""
if self._order == None:
total = len(self._results)
else:
total = max(len(self._order), len(self._results))
percent = int(round(len(self._results)/t... | [
"def",
"_draw_progressbar",
"(",
"self",
",",
"columns",
"=",
"None",
",",
"len_prefix",
"=",
"0",
",",
"right_margin",
"=",
"0",
")",
":",
"if",
"self",
".",
"_order",
"==",
"None",
":",
"total",
"=",
"len",
"(",
"self",
".",
"_results",
")",
"else"... | if columns is None, don't insert any extra line breaks | [
"if",
"columns",
"is",
"None",
"don",
"t",
"insert",
"any",
"extra",
"line",
"breaks"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/reporters/terminal.py#L281-L319 | train |
googlefonts/fontbakery | snippets/fontbakery-check-upstream.py | download_file | def download_file(url, dst_path):
"""Download a file from a url"""
request = requests.get(url, stream=True)
with open(dst_path, 'wb') as downloaded_file:
request.raw.decode_content = True
shutil.copyfileobj(request.raw, downloaded_file) | python | def download_file(url, dst_path):
"""Download a file from a url"""
request = requests.get(url, stream=True)
with open(dst_path, 'wb') as downloaded_file:
request.raw.decode_content = True
shutil.copyfileobj(request.raw, downloaded_file) | [
"def",
"download_file",
"(",
"url",
",",
"dst_path",
")",
":",
"request",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"stream",
"=",
"True",
")",
"with",
"open",
"(",
"dst_path",
",",
"'wb'",
")",
"as",
"downloaded_file",
":",
"request",
".",
"raw",
... | Download a file from a url | [
"Download",
"a",
"file",
"from",
"a",
"url"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/snippets/fontbakery-check-upstream.py#L32-L37 | train |
googlefonts/fontbakery | snippets/fontbakery-check-upstream.py | download_fonts | def download_fonts(gh_url, dst):
"""Download fonts from a github dir"""
font_paths = []
r = requests.get(gh_url)
for item in r.json():
if item['name'].endswith(".ttf"):
f = item['download_url']
dl_path = os.path.join(dst, os.path.basename(f))
download_file(f, ... | python | def download_fonts(gh_url, dst):
"""Download fonts from a github dir"""
font_paths = []
r = requests.get(gh_url)
for item in r.json():
if item['name'].endswith(".ttf"):
f = item['download_url']
dl_path = os.path.join(dst, os.path.basename(f))
download_file(f, ... | [
"def",
"download_fonts",
"(",
"gh_url",
",",
"dst",
")",
":",
"font_paths",
"=",
"[",
"]",
"r",
"=",
"requests",
".",
"get",
"(",
"gh_url",
")",
"for",
"item",
"in",
"r",
".",
"json",
"(",
")",
":",
"if",
"item",
"[",
"'name'",
"]",
".",
"endswit... | Download fonts from a github dir | [
"Download",
"fonts",
"from",
"a",
"github",
"dir"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/snippets/fontbakery-check-upstream.py#L40-L50 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/head.py | com_google_fonts_check_family_equal_font_versions | def com_google_fonts_check_family_equal_font_versions(ttFonts):
"""Make sure all font files have the same version value."""
all_detected_versions = []
fontfile_versions = {}
for ttFont in ttFonts:
v = ttFont['head'].fontRevision
fontfile_versions[ttFont] = v
if v not in all_detected_versions:
... | python | def com_google_fonts_check_family_equal_font_versions(ttFonts):
"""Make sure all font files have the same version value."""
all_detected_versions = []
fontfile_versions = {}
for ttFont in ttFonts:
v = ttFont['head'].fontRevision
fontfile_versions[ttFont] = v
if v not in all_detected_versions:
... | [
"def",
"com_google_fonts_check_family_equal_font_versions",
"(",
"ttFonts",
")",
":",
"all_detected_versions",
"=",
"[",
"]",
"fontfile_versions",
"=",
"{",
"}",
"for",
"ttFont",
"in",
"ttFonts",
":",
"v",
"=",
"ttFont",
"[",
"'head'",
"]",
".",
"fontRevision",
... | Make sure all font files have the same version value. | [
"Make",
"sure",
"all",
"font",
"files",
"have",
"the",
"same",
"version",
"value",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/head.py#L13-L33 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/head.py | com_google_fonts_check_unitsperem | def com_google_fonts_check_unitsperem(ttFont):
"""Checking unitsPerEm value is reasonable."""
upem = ttFont['head'].unitsPerEm
target_upem = [2**i for i in range(4, 15)]
target_upem.append(1000)
target_upem.append(2000)
if upem < 16 or upem > 16384:
yield FAIL, ("The value of unitsPerEm at the head tabl... | python | def com_google_fonts_check_unitsperem(ttFont):
"""Checking unitsPerEm value is reasonable."""
upem = ttFont['head'].unitsPerEm
target_upem = [2**i for i in range(4, 15)]
target_upem.append(1000)
target_upem.append(2000)
if upem < 16 or upem > 16384:
yield FAIL, ("The value of unitsPerEm at the head tabl... | [
"def",
"com_google_fonts_check_unitsperem",
"(",
"ttFont",
")",
":",
"upem",
"=",
"ttFont",
"[",
"'head'",
"]",
".",
"unitsPerEm",
"target_upem",
"=",
"[",
"2",
"**",
"i",
"for",
"i",
"in",
"range",
"(",
"4",
",",
"15",
")",
"]",
"target_upem",
".",
"a... | Checking unitsPerEm value is reasonable. | [
"Checking",
"unitsPerEm",
"value",
"is",
"reasonable",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/head.py#L53-L73 | train |
googlefonts/fontbakery | Lib/fontbakery/callable.py | cached_getter | def cached_getter(func):
"""Decorate a property by executing it at instatiation time and cache the
result on the instance object."""
@wraps(func)
def wrapper(self):
attribute = f'_{func.__name__}'
value = getattr(self, attribute, None)
if value is None:
value = func(self)
setattr(self, a... | python | def cached_getter(func):
"""Decorate a property by executing it at instatiation time and cache the
result on the instance object."""
@wraps(func)
def wrapper(self):
attribute = f'_{func.__name__}'
value = getattr(self, attribute, None)
if value is None:
value = func(self)
setattr(self, a... | [
"def",
"cached_getter",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"self",
")",
":",
"attribute",
"=",
"f'_{func.__name__}'",
"value",
"=",
"getattr",
"(",
"self",
",",
"attribute",
",",
"None",
")",
"if",
"value",
"i... | Decorate a property by executing it at instatiation time and cache the
result on the instance object. | [
"Decorate",
"a",
"property",
"by",
"executing",
"it",
"at",
"instatiation",
"time",
"and",
"cache",
"the",
"result",
"on",
"the",
"instance",
"object",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/callable.py#L18-L29 | train |
googlefonts/fontbakery | Lib/fontbakery/callable.py | condition | def condition(*args, **kwds):
"""Check wrapper, a factory for FontBakeryCondition
Requires all arguments of FontBakeryCondition but not `func`
which is passed via the decorator syntax.
"""
if len(args) == 1 and len(kwds) == 0 and callable(args[0]):
# used as `@decorator`
func = args[0]
return wra... | python | def condition(*args, **kwds):
"""Check wrapper, a factory for FontBakeryCondition
Requires all arguments of FontBakeryCondition but not `func`
which is passed via the decorator syntax.
"""
if len(args) == 1 and len(kwds) == 0 and callable(args[0]):
# used as `@decorator`
func = args[0]
return wra... | [
"def",
"condition",
"(",
"*",
"args",
",",
"**",
"kwds",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"and",
"len",
"(",
"kwds",
")",
"==",
"0",
"and",
"callable",
"(",
"args",
"[",
"0",
"]",
")",
":",
"func",
"=",
"args",
"[",
"0",
... | Check wrapper, a factory for FontBakeryCondition
Requires all arguments of FontBakeryCondition but not `func`
which is passed via the decorator syntax. | [
"Check",
"wrapper",
"a",
"factory",
"for",
"FontBakeryCondition"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/callable.py#L211-L225 | train |
googlefonts/fontbakery | Lib/fontbakery/callable.py | check | def check(*args, **kwds):
"""Check wrapper, a factory for FontBakeryCheck
Requires all arguments of FontBakeryCheck but not `checkfunc`
which is passed via the decorator syntax.
"""
def wrapper(checkfunc):
return wraps(checkfunc)(FontBakeryCheck(checkfunc, *args, **kwds))
return wrapper | python | def check(*args, **kwds):
"""Check wrapper, a factory for FontBakeryCheck
Requires all arguments of FontBakeryCheck but not `checkfunc`
which is passed via the decorator syntax.
"""
def wrapper(checkfunc):
return wraps(checkfunc)(FontBakeryCheck(checkfunc, *args, **kwds))
return wrapper | [
"def",
"check",
"(",
"*",
"args",
",",
"**",
"kwds",
")",
":",
"def",
"wrapper",
"(",
"checkfunc",
")",
":",
"return",
"wraps",
"(",
"checkfunc",
")",
"(",
"FontBakeryCheck",
"(",
"checkfunc",
",",
"*",
"args",
",",
"**",
"kwds",
")",
")",
"return",
... | Check wrapper, a factory for FontBakeryCheck
Requires all arguments of FontBakeryCheck but not `checkfunc`
which is passed via the decorator syntax. | [
"Check",
"wrapper",
"a",
"factory",
"for",
"FontBakeryCheck"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/callable.py#L227-L235 | train |
googlefonts/fontbakery | Lib/fontbakery/utils.py | get_bounding_box | def get_bounding_box(font):
""" Returns max and min bbox of given truetype font """
ymin = 0
ymax = 0
if font.sfntVersion == 'OTTO':
ymin = font['head'].yMin
ymax = font['head'].yMax
else:
for g in font['glyf'].glyphs:
char = font['glyf'][g]
if hasattr... | python | def get_bounding_box(font):
""" Returns max and min bbox of given truetype font """
ymin = 0
ymax = 0
if font.sfntVersion == 'OTTO':
ymin = font['head'].yMin
ymax = font['head'].yMax
else:
for g in font['glyf'].glyphs:
char = font['glyf'][g]
if hasattr... | [
"def",
"get_bounding_box",
"(",
"font",
")",
":",
"ymin",
"=",
"0",
"ymax",
"=",
"0",
"if",
"font",
".",
"sfntVersion",
"==",
"'OTTO'",
":",
"ymin",
"=",
"font",
"[",
"'head'",
"]",
".",
"yMin",
"ymax",
"=",
"font",
"[",
"'head'",
"]",
".",
"yMax",... | Returns max and min bbox of given truetype font | [
"Returns",
"max",
"and",
"min",
"bbox",
"of",
"given",
"truetype",
"font"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/utils.py#L57-L71 | train |
googlefonts/fontbakery | Lib/fontbakery/utils.py | glyph_contour_count | def glyph_contour_count(font, name):
"""Contour count for specified glyph.
This implementation will also return contour count for
composite glyphs.
"""
contour_count = 0
items = [font['glyf'][name]]
while items:
g = items.pop(0)
if g.isComposite():
for comp in g.... | python | def glyph_contour_count(font, name):
"""Contour count for specified glyph.
This implementation will also return contour count for
composite glyphs.
"""
contour_count = 0
items = [font['glyf'][name]]
while items:
g = items.pop(0)
if g.isComposite():
for comp in g.... | [
"def",
"glyph_contour_count",
"(",
"font",
",",
"name",
")",
":",
"contour_count",
"=",
"0",
"items",
"=",
"[",
"font",
"[",
"'glyf'",
"]",
"[",
"name",
"]",
"]",
"while",
"items",
":",
"g",
"=",
"items",
".",
"pop",
"(",
"0",
")",
"if",
"g",
"."... | Contour count for specified glyph.
This implementation will also return contour count for
composite glyphs. | [
"Contour",
"count",
"for",
"specified",
"glyph",
".",
"This",
"implementation",
"will",
"also",
"return",
"contour",
"count",
"for",
"composite",
"glyphs",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/utils.py#L116-L132 | train |
googlefonts/fontbakery | Lib/fontbakery/utils.py | get_font_glyph_data | def get_font_glyph_data(font):
"""Return information for each glyph in a font"""
from fontbakery.constants import (PlatformID,
WindowsEncodingID)
font_data = []
try:
subtable = font['cmap'].getcmap(PlatformID.WINDOWS,
... | python | def get_font_glyph_data(font):
"""Return information for each glyph in a font"""
from fontbakery.constants import (PlatformID,
WindowsEncodingID)
font_data = []
try:
subtable = font['cmap'].getcmap(PlatformID.WINDOWS,
... | [
"def",
"get_font_glyph_data",
"(",
"font",
")",
":",
"from",
"fontbakery",
".",
"constants",
"import",
"(",
"PlatformID",
",",
"WindowsEncodingID",
")",
"font_data",
"=",
"[",
"]",
"try",
":",
"subtable",
"=",
"font",
"[",
"'cmap'",
"]",
".",
"getcmap",
"(... | Return information for each glyph in a font | [
"Return",
"information",
"for",
"each",
"glyph",
"in",
"a",
"font"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/utils.py#L135-L164 | train |
googlefonts/fontbakery | Lib/fontbakery/utils.py | glyph_has_ink | def glyph_has_ink(font: TTFont, name: Text) -> bool:
"""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.
Args:
font: the font
glyph_name: The name of the glyph to che... | python | def glyph_has_ink(font: TTFont, name: Text) -> bool:
"""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.
Args:
font: the font
glyph_name: The name of the glyph to che... | [
"def",
"glyph_has_ink",
"(",
"font",
":",
"TTFont",
",",
"name",
":",
"Text",
")",
"->",
"bool",
":",
"if",
"'glyf'",
"in",
"font",
":",
"return",
"ttf_glyph_has_ink",
"(",
"font",
",",
"name",
")",
"elif",
"(",
"'CFF '",
"in",
"font",
")",
"or",
"("... | 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.
Args:
font: the font
glyph_name: The name of the glyph to check for ink.
Returns:
True if the font has at least... | [
"Checks",
"if",
"specified",
"glyph",
"has",
"any",
"ink",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/utils.py#L245-L261 | train |
googlefonts/fontbakery | Lib/fontbakery/utils.py | assert_results_contain | def assert_results_contain(check_results, expected_status, expected_msgcode=None):
"""
This helper function is useful when we want to make sure that
a certain log message is emited by a check but it can be in any
order among other log messages.
"""
found = False
for status, message in check_results:
i... | python | def assert_results_contain(check_results, expected_status, expected_msgcode=None):
"""
This helper function is useful when we want to make sure that
a certain log message is emited by a check but it can be in any
order among other log messages.
"""
found = False
for status, message in check_results:
i... | [
"def",
"assert_results_contain",
"(",
"check_results",
",",
"expected_status",
",",
"expected_msgcode",
"=",
"None",
")",
":",
"found",
"=",
"False",
"for",
"status",
",",
"message",
"in",
"check_results",
":",
"if",
"status",
"==",
"expected_status",
"and",
"me... | This helper function is useful when we want to make sure that
a certain log message is emited by a check but it can be in any
order among other log messages. | [
"This",
"helper",
"function",
"is",
"useful",
"when",
"we",
"want",
"to",
"make",
"sure",
"that",
"a",
"certain",
"log",
"message",
"is",
"emited",
"by",
"a",
"check",
"but",
"it",
"can",
"be",
"in",
"any",
"order",
"among",
"other",
"log",
"messages",
... | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/utils.py#L264-L275 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/post.py | com_google_fonts_check_family_underline_thickness | def com_google_fonts_check_family_underline_thickness(ttFonts):
"""Fonts have consistent underline thickness?"""
underTs = {}
underlineThickness = None
failed = False
for ttfont in ttFonts:
fontname = ttfont.reader.file.name
# stylename = style(fontname)
ut = ttfont['post'].underlineThickness
... | python | def com_google_fonts_check_family_underline_thickness(ttFonts):
"""Fonts have consistent underline thickness?"""
underTs = {}
underlineThickness = None
failed = False
for ttfont in ttFonts:
fontname = ttfont.reader.file.name
# stylename = style(fontname)
ut = ttfont['post'].underlineThickness
... | [
"def",
"com_google_fonts_check_family_underline_thickness",
"(",
"ttFonts",
")",
":",
"underTs",
"=",
"{",
"}",
"underlineThickness",
"=",
"None",
"failed",
"=",
"False",
"for",
"ttfont",
"in",
"ttFonts",
":",
"fontname",
"=",
"ttfont",
".",
"reader",
".",
"file... | Fonts have consistent underline thickness? | [
"Fonts",
"have",
"consistent",
"underline",
"thickness?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/post.py#L21-L47 | train |
googlefonts/fontbakery | Lib/fontbakery/reporters/html.py | summary_table | def summary_table(
errors: int, fails: int, warns: int, skips: int, infos: int, passes: int, total: int
) -> str:
"""Return summary table with statistics."""
return f"""<h2>Summary</h2>
<table>
<tr>
<th>{EMOTICON['ERROR']} ERROR</th>
<th>{EMOTICON['FA... | python | def summary_table(
errors: int, fails: int, warns: int, skips: int, infos: int, passes: int, total: int
) -> str:
"""Return summary table with statistics."""
return f"""<h2>Summary</h2>
<table>
<tr>
<th>{EMOTICON['ERROR']} ERROR</th>
<th>{EMOTICON['FA... | [
"def",
"summary_table",
"(",
"errors",
":",
"int",
",",
"fails",
":",
"int",
",",
"warns",
":",
"int",
",",
"skips",
":",
"int",
",",
"infos",
":",
"int",
",",
"passes",
":",
"int",
",",
"total",
":",
"int",
")",
"->",
"str",
":",
"return",
"f"
] | Return summary table with statistics. | [
"Return",
"summary",
"table",
"with",
"statistics",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/reporters/html.py#L204-L236 | train |
googlefonts/fontbakery | Lib/fontbakery/reporters/html.py | HTMLReporter.get_html | def get_html(self) -> str:
"""Return complete report as a HTML string."""
data = self.getdoc()
num_checks = 0
body_elements = []
# Order by section first...
for section in data["sections"]:
section_name = html.escape(section["key"][0])
section_sta... | python | def get_html(self) -> str:
"""Return complete report as a HTML string."""
data = self.getdoc()
num_checks = 0
body_elements = []
# Order by section first...
for section in data["sections"]:
section_name = html.escape(section["key"][0])
section_sta... | [
"def",
"get_html",
"(",
"self",
")",
"->",
"str",
":",
"data",
"=",
"self",
".",
"getdoc",
"(",
")",
"num_checks",
"=",
"0",
"body_elements",
"=",
"[",
"]",
"for",
"section",
"in",
"data",
"[",
"\"sections\"",
"]",
":",
"section_name",
"=",
"html",
"... | Return complete report as a HTML string. | [
"Return",
"complete",
"report",
"as",
"a",
"HTML",
"string",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/reporters/html.py#L29-L96 | train |
googlefonts/fontbakery | Lib/fontbakery/reporters/html.py | HTMLReporter.omit_loglevel | def omit_loglevel(self, msg) -> bool:
"""Determine if message is below log level."""
return self.loglevels and (
self.loglevels[0] > fontbakery.checkrunner.Status(msg)
) | python | def omit_loglevel(self, msg) -> bool:
"""Determine if message is below log level."""
return self.loglevels and (
self.loglevels[0] > fontbakery.checkrunner.Status(msg)
) | [
"def",
"omit_loglevel",
"(",
"self",
",",
"msg",
")",
"->",
"bool",
":",
"return",
"self",
".",
"loglevels",
"and",
"(",
"self",
".",
"loglevels",
"[",
"0",
"]",
">",
"fontbakery",
".",
"checkrunner",
".",
"Status",
"(",
"msg",
")",
")"
] | Determine if message is below log level. | [
"Determine",
"if",
"message",
"is",
"below",
"log",
"level",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/reporters/html.py#L98-L102 | train |
googlefonts/fontbakery | Lib/fontbakery/reporters/html.py | HTMLReporter.html_for_check | def html_for_check(self, check) -> str:
"""Return HTML string for complete single check."""
check["logs"].sort(key=lambda c: LOGLEVELS.index(c["status"]))
logs = "<ul>" + "".join([self.log_html(log) for log in check["logs"]]) + "</ul>"
return logs | python | def html_for_check(self, check) -> str:
"""Return HTML string for complete single check."""
check["logs"].sort(key=lambda c: LOGLEVELS.index(c["status"]))
logs = "<ul>" + "".join([self.log_html(log) for log in check["logs"]]) + "</ul>"
return logs | [
"def",
"html_for_check",
"(",
"self",
",",
"check",
")",
"->",
"str",
":",
"check",
"[",
"\"logs\"",
"]",
".",
"sort",
"(",
"key",
"=",
"lambda",
"c",
":",
"LOGLEVELS",
".",
"index",
"(",
"c",
"[",
"\"status\"",
"]",
")",
")",
"logs",
"=",
"\"<ul>\... | Return HTML string for complete single check. | [
"Return",
"HTML",
"string",
"for",
"complete",
"single",
"check",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/reporters/html.py#L104-L108 | train |
googlefonts/fontbakery | Lib/fontbakery/reporters/html.py | HTMLReporter.log_html | def log_html(self, log) -> str:
"""Return single check sub-result string as HTML or not if below log
level."""
if not self.omit_loglevel(log["status"]):
emoticon = EMOTICON[log["status"]]
status = log["status"]
message = html.escape(log["message"]).replace("\n... | python | def log_html(self, log) -> str:
"""Return single check sub-result string as HTML or not if below log
level."""
if not self.omit_loglevel(log["status"]):
emoticon = EMOTICON[log["status"]]
status = log["status"]
message = html.escape(log["message"]).replace("\n... | [
"def",
"log_html",
"(",
"self",
",",
"log",
")",
"->",
"str",
":",
"if",
"not",
"self",
".",
"omit_loglevel",
"(",
"log",
"[",
"\"status\"",
"]",
")",
":",
"emoticon",
"=",
"EMOTICON",
"[",
"log",
"[",
"\"status\"",
"]",
"]",
"status",
"=",
"log",
... | Return single check sub-result string as HTML or not if below log
level. | [
"Return",
"single",
"check",
"sub",
"-",
"result",
"string",
"as",
"HTML",
"or",
"not",
"if",
"below",
"log",
"level",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/reporters/html.py#L110-L123 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | style | def style(font):
"""Determine font style from canonical filename."""
from fontbakery.constants import STATIC_STYLE_NAMES
filename = os.path.basename(font)
if '-' in filename:
stylename = os.path.splitext(filename)[0].split('-')[1]
if stylename in [name.replace(' ', '') for name in STATIC_STYLE_NAMES]:
... | python | def style(font):
"""Determine font style from canonical filename."""
from fontbakery.constants import STATIC_STYLE_NAMES
filename = os.path.basename(font)
if '-' in filename:
stylename = os.path.splitext(filename)[0].split('-')[1]
if stylename in [name.replace(' ', '') for name in STATIC_STYLE_NAMES]:
... | [
"def",
"style",
"(",
"font",
")",
":",
"from",
"fontbakery",
".",
"constants",
"import",
"STATIC_STYLE_NAMES",
"filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"font",
")",
"if",
"'-'",
"in",
"filename",
":",
"stylename",
"=",
"os",
".",
"path",... | Determine font style from canonical filename. | [
"Determine",
"font",
"style",
"from",
"canonical",
"filename",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L140-L148 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | canonical_stylename | def canonical_stylename(font):
""" Returns the canonical stylename of a given font. """
from fontbakery.constants import (STATIC_STYLE_NAMES,
VARFONT_SUFFIXES)
from fontbakery.profiles.shared_conditions import is_variable_font
from fontTools.ttLib import TTFont
# remove sp... | python | def canonical_stylename(font):
""" Returns the canonical stylename of a given font. """
from fontbakery.constants import (STATIC_STYLE_NAMES,
VARFONT_SUFFIXES)
from fontbakery.profiles.shared_conditions import is_variable_font
from fontTools.ttLib import TTFont
# remove sp... | [
"def",
"canonical_stylename",
"(",
"font",
")",
":",
"from",
"fontbakery",
".",
"constants",
"import",
"(",
"STATIC_STYLE_NAMES",
",",
"VARFONT_SUFFIXES",
")",
"from",
"fontbakery",
".",
"profiles",
".",
"shared_conditions",
"import",
"is_variable_font",
"from",
"fo... | Returns the canonical stylename of a given font. | [
"Returns",
"the",
"canonical",
"stylename",
"of",
"a",
"given",
"font",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L224-L241 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_canonical_filename | def com_google_fonts_check_canonical_filename(font):
"""Checking file is named canonically.
A font's filename must be composed in the following manner:
<familyname>-<stylename>.ttf
e.g. Nunito-Regular.ttf,
Oswald-BoldItalic.ttf
Variable fonts must use the "-VF" suffix:
e.g. Roboto-VF.ttf,
... | python | def com_google_fonts_check_canonical_filename(font):
"""Checking file is named canonically.
A font's filename must be composed in the following manner:
<familyname>-<stylename>.ttf
e.g. Nunito-Regular.ttf,
Oswald-BoldItalic.ttf
Variable fonts must use the "-VF" suffix:
e.g. Roboto-VF.ttf,
... | [
"def",
"com_google_fonts_check_canonical_filename",
"(",
"font",
")",
":",
"from",
"fontTools",
".",
"ttLib",
"import",
"TTFont",
"from",
"fontbakery",
".",
"profiles",
".",
"shared_conditions",
"import",
"is_variable_font",
"from",
"fontbakery",
".",
"constants",
"im... | Checking file is named canonically.
A font's filename must be composed in the following manner:
<familyname>-<stylename>.ttf
e.g. Nunito-Regular.ttf,
Oswald-BoldItalic.ttf
Variable fonts must use the "-VF" suffix:
e.g. Roboto-VF.ttf,
Barlow-VF.ttf,
Example-Roman-VF.ttf,
Familyn... | [
"Checking",
"file",
"is",
"named",
"canonically",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L250-L285 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | family_directory | def family_directory(fonts):
"""Get the path of font project directory."""
if fonts:
dirname = os.path.dirname(fonts[0])
if dirname == '':
dirname = '.'
return dirname | python | def family_directory(fonts):
"""Get the path of font project directory."""
if fonts:
dirname = os.path.dirname(fonts[0])
if dirname == '':
dirname = '.'
return dirname | [
"def",
"family_directory",
"(",
"fonts",
")",
":",
"if",
"fonts",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"fonts",
"[",
"0",
"]",
")",
"if",
"dirname",
"==",
"''",
":",
"dirname",
"=",
"'.'",
"return",
"dirname"
] | Get the path of font project directory. | [
"Get",
"the",
"path",
"of",
"font",
"project",
"directory",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L289-L295 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | descfile | def descfile(family_directory):
"""Get the path of the DESCRIPTION file of a given font project."""
if family_directory:
descfilepath = os.path.join(family_directory, "DESCRIPTION.en_us.html")
if os.path.exists(descfilepath):
return descfilepath | python | def descfile(family_directory):
"""Get the path of the DESCRIPTION file of a given font project."""
if family_directory:
descfilepath = os.path.join(family_directory, "DESCRIPTION.en_us.html")
if os.path.exists(descfilepath):
return descfilepath | [
"def",
"descfile",
"(",
"family_directory",
")",
":",
"if",
"family_directory",
":",
"descfilepath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"family_directory",
",",
"\"DESCRIPTION.en_us.html\"",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"descfilepat... | Get the path of the DESCRIPTION file of a given font project. | [
"Get",
"the",
"path",
"of",
"the",
"DESCRIPTION",
"file",
"of",
"a",
"given",
"font",
"project",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L299-L304 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_description_broken_links | def com_google_fonts_check_description_broken_links(description):
"""Does DESCRIPTION file contain broken links?"""
from lxml.html import HTMLParser
import defusedxml.lxml
import requests
doc = defusedxml.lxml.fromstring(description, parser=HTMLParser())
broken_links = []
for link in doc.xpath('//a/@href'... | python | def com_google_fonts_check_description_broken_links(description):
"""Does DESCRIPTION file contain broken links?"""
from lxml.html import HTMLParser
import defusedxml.lxml
import requests
doc = defusedxml.lxml.fromstring(description, parser=HTMLParser())
broken_links = []
for link in doc.xpath('//a/@href'... | [
"def",
"com_google_fonts_check_description_broken_links",
"(",
"description",
")",
":",
"from",
"lxml",
".",
"html",
"import",
"HTMLParser",
"import",
"defusedxml",
".",
"lxml",
"import",
"requests",
"doc",
"=",
"defusedxml",
".",
"lxml",
".",
"fromstring",
"(",
"... | Does DESCRIPTION file contain broken links? | [
"Does",
"DESCRIPTION",
"file",
"contain",
"broken",
"links?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L320-L351 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_parses | def com_google_fonts_check_metadata_parses(family_directory):
""" Check METADATA.pb parse correctly. """
from google.protobuf import text_format
from fontbakery.utils import get_FamilyProto_Message
try:
pb_file = os.path.join(family_directory, "METADATA.pb")
get_FamilyProto_Message(pb_file)
yield PA... | python | def com_google_fonts_check_metadata_parses(family_directory):
""" Check METADATA.pb parse correctly. """
from google.protobuf import text_format
from fontbakery.utils import get_FamilyProto_Message
try:
pb_file = os.path.join(family_directory, "METADATA.pb")
get_FamilyProto_Message(pb_file)
yield PA... | [
"def",
"com_google_fonts_check_metadata_parses",
"(",
"family_directory",
")",
":",
"from",
"google",
".",
"protobuf",
"import",
"text_format",
"from",
"fontbakery",
".",
"utils",
"import",
"get_FamilyProto_Message",
"try",
":",
"pb_file",
"=",
"os",
".",
"path",
".... | Check METADATA.pb parse correctly. | [
"Check",
"METADATA",
".",
"pb",
"parse",
"correctly",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L420-L432 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_family_equal_numbers_of_glyphs | def com_google_fonts_check_family_equal_numbers_of_glyphs(ttFonts):
"""Fonts have equal numbers of glyphs?"""
# ttFonts is an iterator, so here we make a list from it
# because we'll have to iterate twice in this check implementation:
the_ttFonts = list(ttFonts)
failed = False
max_stylename = None
max_co... | python | def com_google_fonts_check_family_equal_numbers_of_glyphs(ttFonts):
"""Fonts have equal numbers of glyphs?"""
# ttFonts is an iterator, so here we make a list from it
# because we'll have to iterate twice in this check implementation:
the_ttFonts = list(ttFonts)
failed = False
max_stylename = None
max_co... | [
"def",
"com_google_fonts_check_family_equal_numbers_of_glyphs",
"(",
"ttFonts",
")",
":",
"the_ttFonts",
"=",
"list",
"(",
"ttFonts",
")",
"failed",
"=",
"False",
"max_stylename",
"=",
"None",
"max_count",
"=",
"0",
"max_glyphs",
"=",
"None",
"for",
"ttFont",
"in"... | Fonts have equal numbers of glyphs? | [
"Fonts",
"have",
"equal",
"numbers",
"of",
"glyphs?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L452-L493 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_family_equal_glyph_names | def com_google_fonts_check_family_equal_glyph_names(ttFonts):
"""Fonts have equal glyph names?"""
fonts = list(ttFonts)
all_glyphnames = set()
for ttFont in fonts:
all_glyphnames |= set(ttFont["glyf"].glyphs.keys())
missing = {}
available = {}
for glyphname in all_glyphnames:
missing[glyphname] ... | python | def com_google_fonts_check_family_equal_glyph_names(ttFonts):
"""Fonts have equal glyph names?"""
fonts = list(ttFonts)
all_glyphnames = set()
for ttFont in fonts:
all_glyphnames |= set(ttFont["glyf"].glyphs.keys())
missing = {}
available = {}
for glyphname in all_glyphnames:
missing[glyphname] ... | [
"def",
"com_google_fonts_check_family_equal_glyph_names",
"(",
"ttFonts",
")",
":",
"fonts",
"=",
"list",
"(",
"ttFonts",
")",
"all_glyphnames",
"=",
"set",
"(",
")",
"for",
"ttFont",
"in",
"fonts",
":",
"all_glyphnames",
"|=",
"set",
"(",
"ttFont",
"[",
"\"gl... | Fonts have equal glyph names? | [
"Fonts",
"have",
"equal",
"glyph",
"names?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L500-L542 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | registered_vendor_ids | def registered_vendor_ids():
"""Get a list of vendor IDs from Microsoft's website."""
from bs4 import BeautifulSoup
from pkg_resources import resource_filename
registered_vendor_ids = {}
CACHED = resource_filename('fontbakery',
'data/fontbakery-microsoft-vendorlist.cache')
cont... | python | def registered_vendor_ids():
"""Get a list of vendor IDs from Microsoft's website."""
from bs4 import BeautifulSoup
from pkg_resources import resource_filename
registered_vendor_ids = {}
CACHED = resource_filename('fontbakery',
'data/fontbakery-microsoft-vendorlist.cache')
cont... | [
"def",
"registered_vendor_ids",
"(",
")",
":",
"from",
"bs4",
"import",
"BeautifulSoup",
"from",
"pkg_resources",
"import",
"resource_filename",
"registered_vendor_ids",
"=",
"{",
"}",
"CACHED",
"=",
"resource_filename",
"(",
"'fontbakery'",
",",
"'data/fontbakery-micro... | Get a list of vendor IDs from Microsoft's website. | [
"Get",
"a",
"list",
"of",
"vendor",
"IDs",
"from",
"Microsoft",
"s",
"website",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L600-L630 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_name_unwanted_chars | def com_google_fonts_check_name_unwanted_chars(ttFont):
"""Substitute copyright, registered and trademark
symbols in name table entries."""
failed = False
replacement_map = [("\u00a9", '(c)'),
("\u00ae", '(r)'),
("\u2122", '(tm)')]
for name in ttFont['name'].names:... | python | def com_google_fonts_check_name_unwanted_chars(ttFont):
"""Substitute copyright, registered and trademark
symbols in name table entries."""
failed = False
replacement_map = [("\u00a9", '(c)'),
("\u00ae", '(r)'),
("\u2122", '(tm)')]
for name in ttFont['name'].names:... | [
"def",
"com_google_fonts_check_name_unwanted_chars",
"(",
"ttFont",
")",
":",
"failed",
"=",
"False",
"replacement_map",
"=",
"[",
"(",
"\"\\u00a9\"",
",",
"'(c)'",
")",
",",
"(",
"\"\\u00ae\"",
",",
"'(r)'",
")",
",",
"(",
"\"\\u2122\"",
",",
"'(tm)'",
")",
... | Substitute copyright, registered and trademark
symbols in name table entries. | [
"Substitute",
"copyright",
"registered",
"and",
"trademark",
"symbols",
"in",
"name",
"table",
"entries",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L666-L684 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | licenses | def licenses(family_directory):
"""Get a list of paths for every license
file found in a font project."""
found = []
search_paths = [family_directory]
gitroot = git_rootdir(family_directory)
if gitroot and gitroot not in search_paths:
search_paths.append(gitroot)
for directory in search_paths:
... | python | def licenses(family_directory):
"""Get a list of paths for every license
file found in a font project."""
found = []
search_paths = [family_directory]
gitroot = git_rootdir(family_directory)
if gitroot and gitroot not in search_paths:
search_paths.append(gitroot)
for directory in search_paths:
... | [
"def",
"licenses",
"(",
"family_directory",
")",
":",
"found",
"=",
"[",
"]",
"search_paths",
"=",
"[",
"family_directory",
"]",
"gitroot",
"=",
"git_rootdir",
"(",
"family_directory",
")",
"if",
"gitroot",
"and",
"gitroot",
"not",
"in",
"search_paths",
":",
... | Get a list of paths for every license
file found in a font project. | [
"Get",
"a",
"list",
"of",
"paths",
"for",
"every",
"license",
"file",
"found",
"in",
"a",
"font",
"project",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L740-L755 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_family_has_license | def com_google_fonts_check_family_has_license(licenses):
"""Check font has a license."""
if len(licenses) > 1:
yield FAIL, Message("multiple",
("More than a single license file found."
" Please review."))
elif not licenses:
yield FAIL, Message("no-license",... | python | def com_google_fonts_check_family_has_license(licenses):
"""Check font has a license."""
if len(licenses) > 1:
yield FAIL, Message("multiple",
("More than a single license file found."
" Please review."))
elif not licenses:
yield FAIL, Message("no-license",... | [
"def",
"com_google_fonts_check_family_has_license",
"(",
"licenses",
")",
":",
"if",
"len",
"(",
"licenses",
")",
">",
"1",
":",
"yield",
"FAIL",
",",
"Message",
"(",
"\"multiple\"",
",",
"(",
"\"More than a single license file found.\"",
"\" Please review.\"",
")",
... | Check font has a license. | [
"Check",
"font",
"has",
"a",
"license",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L775-L790 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_name_license | def com_google_fonts_check_name_license(ttFont, license):
"""Check copyright namerecords match license file."""
from fontbakery.constants import PLACEHOLDER_LICENSING_TEXT
failed = False
placeholder = PLACEHOLDER_LICENSING_TEXT[license]
entry_found = False
for i, nameRecord in enumerate(ttFont["name"].names... | python | def com_google_fonts_check_name_license(ttFont, license):
"""Check copyright namerecords match license file."""
from fontbakery.constants import PLACEHOLDER_LICENSING_TEXT
failed = False
placeholder = PLACEHOLDER_LICENSING_TEXT[license]
entry_found = False
for i, nameRecord in enumerate(ttFont["name"].names... | [
"def",
"com_google_fonts_check_name_license",
"(",
"ttFont",
",",
"license",
")",
":",
"from",
"fontbakery",
".",
"constants",
"import",
"PLACEHOLDER_LICENSING_TEXT",
"failed",
"=",
"False",
"placeholder",
"=",
"PLACEHOLDER_LICENSING_TEXT",
"[",
"license",
"]",
"entry_f... | Check copyright namerecords match license file. | [
"Check",
"copyright",
"namerecords",
"match",
"license",
"file",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L799-L830 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_name_license_url | def com_google_fonts_check_name_license_url(ttFont, familyname):
""""License URL matches License text on name table?"""
from fontbakery.constants import PLACEHOLDER_LICENSING_TEXT
LEGACY_UFL_FAMILIES = ["Ubuntu", "UbuntuCondensed", "UbuntuMono"]
LICENSE_URL = {
'OFL.txt': 'http://scripts.sil.org/OFL',
'... | python | def com_google_fonts_check_name_license_url(ttFont, familyname):
""""License URL matches License text on name table?"""
from fontbakery.constants import PLACEHOLDER_LICENSING_TEXT
LEGACY_UFL_FAMILIES = ["Ubuntu", "UbuntuCondensed", "UbuntuMono"]
LICENSE_URL = {
'OFL.txt': 'http://scripts.sil.org/OFL',
'... | [
"def",
"com_google_fonts_check_name_license_url",
"(",
"ttFont",
",",
"familyname",
")",
":",
"from",
"fontbakery",
".",
"constants",
"import",
"PLACEHOLDER_LICENSING_TEXT",
"LEGACY_UFL_FAMILIES",
"=",
"[",
"\"Ubuntu\"",
",",
"\"UbuntuCondensed\"",
",",
"\"UbuntuMono\"",
... | License URL matches License text on name table? | [
"License",
"URL",
"matches",
"License",
"text",
"on",
"name",
"table?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L848-L919 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_name_description_max_length | def com_google_fonts_check_name_description_max_length(ttFont):
"""Description strings in the name table must not exceed 200 characters."""
failed = False
for name in ttFont['name'].names:
if (name.nameID == NameID.DESCRIPTION and
len(name.string.decode(name.getEncoding())) > 200):
failed = True... | python | def com_google_fonts_check_name_description_max_length(ttFont):
"""Description strings in the name table must not exceed 200 characters."""
failed = False
for name in ttFont['name'].names:
if (name.nameID == NameID.DESCRIPTION and
len(name.string.decode(name.getEncoding())) > 200):
failed = True... | [
"def",
"com_google_fonts_check_name_description_max_length",
"(",
"ttFont",
")",
":",
"failed",
"=",
"False",
"for",
"name",
"in",
"ttFont",
"[",
"'name'",
"]",
".",
"names",
":",
"if",
"(",
"name",
".",
"nameID",
"==",
"NameID",
".",
"DESCRIPTION",
"and",
"... | Description strings in the name table must not exceed 200 characters. | [
"Description",
"strings",
"in",
"the",
"name",
"table",
"must",
"not",
"exceed",
"200",
"characters",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L935-L954 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_hinting_impact | def com_google_fonts_check_hinting_impact(font, ttfautohint_stats):
"""Show hinting filesize impact.
Current implementation simply logs useful info
but there's no fail scenario for this checker."""
hinted = ttfautohint_stats["hinted_size"]
dehinted = ttfautohint_stats["dehinted_size"]
increase = hin... | python | def com_google_fonts_check_hinting_impact(font, ttfautohint_stats):
"""Show hinting filesize impact.
Current implementation simply logs useful info
but there's no fail scenario for this checker."""
hinted = ttfautohint_stats["hinted_size"]
dehinted = ttfautohint_stats["dehinted_size"]
increase = hin... | [
"def",
"com_google_fonts_check_hinting_impact",
"(",
"font",
",",
"ttfautohint_stats",
")",
":",
"hinted",
"=",
"ttfautohint_stats",
"[",
"\"hinted_size\"",
"]",
"dehinted",
"=",
"ttfautohint_stats",
"[",
"\"dehinted_size\"",
"]",
"increase",
"=",
"hinted",
"-",
"dehi... | Show hinting filesize impact.
Current implementation simply logs useful info
but there's no fail scenario for this checker. | [
"Show",
"hinting",
"filesize",
"impact",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L982-L1012 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_name_version_format | def com_google_fonts_check_name_version_format(ttFont):
"""Version format is correct in 'name' table?"""
from fontbakery.utils import get_name_entry_strings
import re
def is_valid_version_format(value):
return re.match(r'Version\s0*[1-9]+\.\d+', value)
failed = False
version_entries = get_name_entry_st... | python | def com_google_fonts_check_name_version_format(ttFont):
"""Version format is correct in 'name' table?"""
from fontbakery.utils import get_name_entry_strings
import re
def is_valid_version_format(value):
return re.match(r'Version\s0*[1-9]+\.\d+', value)
failed = False
version_entries = get_name_entry_st... | [
"def",
"com_google_fonts_check_name_version_format",
"(",
"ttFont",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"import",
"re",
"def",
"is_valid_version_format",
"(",
"value",
")",
":",
"return",
"re",
".",
"match",
"(",
"r'Vers... | Version format is correct in 'name' table? | [
"Version",
"format",
"is",
"correct",
"in",
"name",
"table?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1018-L1043 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_has_ttfautohint_params | def com_google_fonts_check_has_ttfautohint_params(ttFont):
""" Font has ttfautohint params? """
from fontbakery.utils import get_name_entry_strings
def ttfautohint_version(value):
# example string:
#'Version 1.000; ttfautohint (v0.93) -l 8 -r 50 -G 200 -x 14 -w "G"
import re
results = re.search(r... | python | def com_google_fonts_check_has_ttfautohint_params(ttFont):
""" Font has ttfautohint params? """
from fontbakery.utils import get_name_entry_strings
def ttfautohint_version(value):
# example string:
#'Version 1.000; ttfautohint (v0.93) -l 8 -r 50 -G 200 -x 14 -w "G"
import re
results = re.search(r... | [
"def",
"com_google_fonts_check_has_ttfautohint_params",
"(",
"ttFont",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"def",
"ttfautohint_version",
"(",
"value",
")",
":",
"import",
"re",
"results",
"=",
"re",
".",
"search",
"(",
... | Font has ttfautohint params? | [
"Font",
"has",
"ttfautohint",
"params?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1049-L1075 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_old_ttfautohint | def com_google_fonts_check_old_ttfautohint(ttFont, ttfautohint_stats):
"""Font has old ttfautohint applied?
1. find which version was used, by inspecting name table entries
2. find which version of ttfautohint is installed
"""
from fontbakery.utils import get_name_entry_strings
def ttfautohint_vers... | python | def com_google_fonts_check_old_ttfautohint(ttFont, ttfautohint_stats):
"""Font has old ttfautohint applied?
1. find which version was used, by inspecting name table entries
2. find which version of ttfautohint is installed
"""
from fontbakery.utils import get_name_entry_strings
def ttfautohint_vers... | [
"def",
"com_google_fonts_check_old_ttfautohint",
"(",
"ttFont",
",",
"ttfautohint_stats",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"def",
"ttfautohint_version",
"(",
"values",
")",
":",
"import",
"re",
"for",
"value",
"in",
"... | Font has old ttfautohint applied?
1. find which version was used, by inspecting name table entries
2. find which version of ttfautohint is installed | [
"Font",
"has",
"old",
"ttfautohint",
"applied?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1082-L1137 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_gasp | def com_google_fonts_check_gasp(ttFont):
"""Is 'gasp' table set to optimize rendering?"""
if "gasp" not in ttFont.keys():
yield FAIL, ("Font is missing the 'gasp' table."
" Try exporting the font with autohinting enabled.")
else:
if not isinstance(ttFont["gasp"].gaspRange, dict):
y... | python | def com_google_fonts_check_gasp(ttFont):
"""Is 'gasp' table set to optimize rendering?"""
if "gasp" not in ttFont.keys():
yield FAIL, ("Font is missing the 'gasp' table."
" Try exporting the font with autohinting enabled.")
else:
if not isinstance(ttFont["gasp"].gaspRange, dict):
y... | [
"def",
"com_google_fonts_check_gasp",
"(",
"ttFont",
")",
":",
"if",
"\"gasp\"",
"not",
"in",
"ttFont",
".",
"keys",
"(",
")",
":",
"yield",
"FAIL",
",",
"(",
"\"Font is missing the 'gasp' table.\"",
"\" Try exporting the font with autohinting enabled.\"",
")",
"else",
... | Is 'gasp' table set to optimize rendering? | [
"Is",
"gasp",
"table",
"set",
"to",
"optimize",
"rendering?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1185-L1234 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_name_familyname_first_char | def com_google_fonts_check_name_familyname_first_char(ttFont):
"""Make sure family name does not begin with a digit.
Font family names which start with a numeral are often not
discoverable in Windows applications.
"""
from fontbakery.utils import get_name_entry_strings
failed = False
for familyname... | python | def com_google_fonts_check_name_familyname_first_char(ttFont):
"""Make sure family name does not begin with a digit.
Font family names which start with a numeral are often not
discoverable in Windows applications.
"""
from fontbakery.utils import get_name_entry_strings
failed = False
for familyname... | [
"def",
"com_google_fonts_check_name_familyname_first_char",
"(",
"ttFont",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"failed",
"=",
"False",
"for",
"familyname",
"in",
"get_name_entry_strings",
"(",
"ttFont",
",",
"NameID",
".",
... | Make sure family name does not begin with a digit.
Font family names which start with a numeral are often not
discoverable in Windows applications. | [
"Make",
"sure",
"family",
"name",
"does",
"not",
"begin",
"with",
"a",
"digit",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1240-L1255 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_currency_chars | def com_google_fonts_check_currency_chars(ttFont):
"""Font has all expected currency sign characters?"""
def font_has_char(ttFont, codepoint):
for subtable in ttFont['cmap'].tables:
if codepoint in subtable.cmap:
return True
#otherwise
return False
failed = False
OPTIONAL = {
#T... | python | def com_google_fonts_check_currency_chars(ttFont):
"""Font has all expected currency sign characters?"""
def font_has_char(ttFont, codepoint):
for subtable in ttFont['cmap'].tables:
if codepoint in subtable.cmap:
return True
#otherwise
return False
failed = False
OPTIONAL = {
#T... | [
"def",
"com_google_fonts_check_currency_chars",
"(",
"ttFont",
")",
":",
"def",
"font_has_char",
"(",
"ttFont",
",",
"codepoint",
")",
":",
"for",
"subtable",
"in",
"ttFont",
"[",
"'cmap'",
"]",
".",
"tables",
":",
"if",
"codepoint",
"in",
"subtable",
".",
"... | Font has all expected currency sign characters? | [
"Font",
"has",
"all",
"expected",
"currency",
"sign",
"characters?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1262-L1293 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_name_ascii_only_entries | def com_google_fonts_check_name_ascii_only_entries(ttFont):
"""Are there non-ASCII characters in ASCII-only NAME table entries?"""
bad_entries = []
for name in ttFont["name"].names:
if name.nameID == NameID.COPYRIGHT_NOTICE or \
name.nameID == NameID.POSTSCRIPT_NAME:
string = name.string.decode(n... | python | def com_google_fonts_check_name_ascii_only_entries(ttFont):
"""Are there non-ASCII characters in ASCII-only NAME table entries?"""
bad_entries = []
for name in ttFont["name"].names:
if name.nameID == NameID.COPYRIGHT_NOTICE or \
name.nameID == NameID.POSTSCRIPT_NAME:
string = name.string.decode(n... | [
"def",
"com_google_fonts_check_name_ascii_only_entries",
"(",
"ttFont",
")",
":",
"bad_entries",
"=",
"[",
"]",
"for",
"name",
"in",
"ttFont",
"[",
"\"name\"",
"]",
".",
"names",
":",
"if",
"name",
".",
"nameID",
"==",
"NameID",
".",
"COPYRIGHT_NOTICE",
"or",
... | Are there non-ASCII characters in ASCII-only NAME table entries? | [
"Are",
"there",
"non",
"-",
"ASCII",
"characters",
"in",
"ASCII",
"-",
"only",
"NAME",
"table",
"entries?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1313-L1337 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_license | def com_google_fonts_check_metadata_license(family_metadata):
"""METADATA.pb license is "APACHE2", "UFL" or "OFL"?"""
licenses = ["APACHE2", "OFL", "UFL"]
if family_metadata.license in licenses:
yield PASS, ("Font license is declared"
" in METADATA.pb as \"{}\"").format(family_metadata.licens... | python | def com_google_fonts_check_metadata_license(family_metadata):
"""METADATA.pb license is "APACHE2", "UFL" or "OFL"?"""
licenses = ["APACHE2", "OFL", "UFL"]
if family_metadata.license in licenses:
yield PASS, ("Font license is declared"
" in METADATA.pb as \"{}\"").format(family_metadata.licens... | [
"def",
"com_google_fonts_check_metadata_license",
"(",
"family_metadata",
")",
":",
"licenses",
"=",
"[",
"\"APACHE2\"",
",",
"\"OFL\"",
",",
"\"UFL\"",
"]",
"if",
"family_metadata",
".",
"license",
"in",
"licenses",
":",
"yield",
"PASS",
",",
"(",
"\"Font license... | METADATA.pb license is "APACHE2", "UFL" or "OFL"? | [
"METADATA",
".",
"pb",
"license",
"is",
"APACHE2",
"UFL",
"or",
"OFL",
"?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1448-L1458 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_menu_and_latin | def com_google_fonts_check_metadata_menu_and_latin(family_metadata):
"""METADATA.pb should contain at least "menu" and "latin" subsets."""
missing = []
for s in ["menu", "latin"]:
if s not in list(family_metadata.subsets):
missing.append(s)
if missing != []:
yield FAIL, ("Subsets \"menu\" and \"l... | python | def com_google_fonts_check_metadata_menu_and_latin(family_metadata):
"""METADATA.pb should contain at least "menu" and "latin" subsets."""
missing = []
for s in ["menu", "latin"]:
if s not in list(family_metadata.subsets):
missing.append(s)
if missing != []:
yield FAIL, ("Subsets \"menu\" and \"l... | [
"def",
"com_google_fonts_check_metadata_menu_and_latin",
"(",
"family_metadata",
")",
":",
"missing",
"=",
"[",
"]",
"for",
"s",
"in",
"[",
"\"menu\"",
",",
"\"latin\"",
"]",
":",
"if",
"s",
"not",
"in",
"list",
"(",
"family_metadata",
".",
"subsets",
")",
"... | METADATA.pb should contain at least "menu" and "latin" subsets. | [
"METADATA",
".",
"pb",
"should",
"contain",
"at",
"least",
"menu",
"and",
"latin",
"subsets",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1465-L1477 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_subsets_order | def com_google_fonts_check_metadata_subsets_order(family_metadata):
"""METADATA.pb subsets should be alphabetically ordered."""
expected = list(sorted(family_metadata.subsets))
if list(family_metadata.subsets) != expected:
yield FAIL, ("METADATA.pb subsets are not sorted "
"in alphabetical o... | python | def com_google_fonts_check_metadata_subsets_order(family_metadata):
"""METADATA.pb subsets should be alphabetically ordered."""
expected = list(sorted(family_metadata.subsets))
if list(family_metadata.subsets) != expected:
yield FAIL, ("METADATA.pb subsets are not sorted "
"in alphabetical o... | [
"def",
"com_google_fonts_check_metadata_subsets_order",
"(",
"family_metadata",
")",
":",
"expected",
"=",
"list",
"(",
"sorted",
"(",
"family_metadata",
".",
"subsets",
")",
")",
"if",
"list",
"(",
"family_metadata",
".",
"subsets",
")",
"!=",
"expected",
":",
... | METADATA.pb subsets should be alphabetically ordered. | [
"METADATA",
".",
"pb",
"subsets",
"should",
"be",
"alphabetically",
"ordered",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1484-L1494 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_familyname | def com_google_fonts_check_metadata_familyname(family_metadata):
"""Check that METADATA.pb family values are all the same."""
name = ""
fail = False
for f in family_metadata.fonts:
if name and f.name != name:
fail = True
name = f.name
if fail:
yield FAIL, ("METADATA.pb: Family name is not th... | python | def com_google_fonts_check_metadata_familyname(family_metadata):
"""Check that METADATA.pb family values are all the same."""
name = ""
fail = False
for f in family_metadata.fonts:
if name and f.name != name:
fail = True
name = f.name
if fail:
yield FAIL, ("METADATA.pb: Family name is not th... | [
"def",
"com_google_fonts_check_metadata_familyname",
"(",
"family_metadata",
")",
":",
"name",
"=",
"\"\"",
"fail",
"=",
"False",
"for",
"f",
"in",
"family_metadata",
".",
"fonts",
":",
"if",
"name",
"and",
"f",
".",
"name",
"!=",
"name",
":",
"fail",
"=",
... | Check that METADATA.pb family values are all the same. | [
"Check",
"that",
"METADATA",
".",
"pb",
"family",
"values",
"are",
"all",
"the",
"same",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1520-L1533 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_nameid_family_name | def com_google_fonts_check_metadata_nameid_family_name(ttFont, font_metadata):
"""Checks METADATA.pb font.name field matches
family name declared on the name table.
"""
from fontbakery.utils import get_name_entry_strings
familynames = get_name_entry_strings(ttFont, NameID.TYPOGRAPHIC_FAMILY_NAME)
if not... | python | def com_google_fonts_check_metadata_nameid_family_name(ttFont, font_metadata):
"""Checks METADATA.pb font.name field matches
family name declared on the name table.
"""
from fontbakery.utils import get_name_entry_strings
familynames = get_name_entry_strings(ttFont, NameID.TYPOGRAPHIC_FAMILY_NAME)
if not... | [
"def",
"com_google_fonts_check_metadata_nameid_family_name",
"(",
"ttFont",
",",
"font_metadata",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"familynames",
"=",
"get_name_entry_strings",
"(",
"ttFont",
",",
"NameID",
".",
"TYPOGRAPHI... | Checks METADATA.pb font.name field matches
family name declared on the name table. | [
"Checks",
"METADATA",
".",
"pb",
"font",
".",
"name",
"field",
"matches",
"family",
"name",
"declared",
"on",
"the",
"name",
"table",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1593-L1617 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_nameid_post_script_name | def com_google_fonts_check_metadata_nameid_post_script_name(ttFont, font_metadata):
"""Checks METADATA.pb font.post_script_name matches
postscript name declared on the name table.
"""
failed = False
from fontbakery.utils import get_name_entry_strings
postscript_names = get_name_entry_strings(ttFont, Nam... | python | def com_google_fonts_check_metadata_nameid_post_script_name(ttFont, font_metadata):
"""Checks METADATA.pb font.post_script_name matches
postscript name declared on the name table.
"""
failed = False
from fontbakery.utils import get_name_entry_strings
postscript_names = get_name_entry_strings(ttFont, Nam... | [
"def",
"com_google_fonts_check_metadata_nameid_post_script_name",
"(",
"ttFont",
",",
"font_metadata",
")",
":",
"failed",
"=",
"False",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"postscript_names",
"=",
"get_name_entry_strings",
"(",
"ttFont",... | Checks METADATA.pb font.post_script_name matches
postscript name declared on the name table. | [
"Checks",
"METADATA",
".",
"pb",
"font",
".",
"post_script_name",
"matches",
"postscript",
"name",
"declared",
"on",
"the",
"name",
"table",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1623-L1650 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_nameid_full_name | def com_google_fonts_check_metadata_nameid_full_name(ttFont, font_metadata):
"""METADATA.pb font.full_name value matches
fullname declared on the name table?
"""
from fontbakery.utils import get_name_entry_strings
full_fontnames = get_name_entry_strings(ttFont, NameID.FULL_FONT_NAME)
if len(full_fontnam... | python | def com_google_fonts_check_metadata_nameid_full_name(ttFont, font_metadata):
"""METADATA.pb font.full_name value matches
fullname declared on the name table?
"""
from fontbakery.utils import get_name_entry_strings
full_fontnames = get_name_entry_strings(ttFont, NameID.FULL_FONT_NAME)
if len(full_fontnam... | [
"def",
"com_google_fonts_check_metadata_nameid_full_name",
"(",
"ttFont",
",",
"font_metadata",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"full_fontnames",
"=",
"get_name_entry_strings",
"(",
"ttFont",
",",
"NameID",
".",
"FULL_FONT... | METADATA.pb font.full_name value matches
fullname declared on the name table? | [
"METADATA",
".",
"pb",
"font",
".",
"full_name",
"value",
"matches",
"fullname",
"declared",
"on",
"the",
"name",
"table?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1657-L1680 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_nameid_font_name | def com_google_fonts_check_metadata_nameid_font_name(ttFont, style, font_metadata):
"""METADATA.pb font.name value should be same as
the family name declared on the name table.
"""
from fontbakery.utils import get_name_entry_strings
from fontbakery.constants import RIBBI_STYLE_NAMES
if style in RIBBI_ST... | python | def com_google_fonts_check_metadata_nameid_font_name(ttFont, style, font_metadata):
"""METADATA.pb font.name value should be same as
the family name declared on the name table.
"""
from fontbakery.utils import get_name_entry_strings
from fontbakery.constants import RIBBI_STYLE_NAMES
if style in RIBBI_ST... | [
"def",
"com_google_fonts_check_metadata_nameid_font_name",
"(",
"ttFont",
",",
"style",
",",
"font_metadata",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"from",
"fontbakery",
".",
"constants",
"import",
"RIBBI_STYLE_NAMES",
"if",
"... | METADATA.pb font.name value should be same as
the family name declared on the name table. | [
"METADATA",
".",
"pb",
"font",
".",
"name",
"value",
"should",
"be",
"same",
"as",
"the",
"family",
"name",
"declared",
"on",
"the",
"name",
"table",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1687-L1716 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_match_fullname_postscript | def com_google_fonts_check_metadata_match_fullname_postscript(font_metadata):
"""METADATA.pb font.full_name and font.post_script_name
fields have equivalent values ?
"""
import re
regex = re.compile(r"\W")
post_script_name = regex.sub("", font_metadata.post_script_name)
fullname = regex.sub("", font_me... | python | def com_google_fonts_check_metadata_match_fullname_postscript(font_metadata):
"""METADATA.pb font.full_name and font.post_script_name
fields have equivalent values ?
"""
import re
regex = re.compile(r"\W")
post_script_name = regex.sub("", font_metadata.post_script_name)
fullname = regex.sub("", font_me... | [
"def",
"com_google_fonts_check_metadata_match_fullname_postscript",
"(",
"font_metadata",
")",
":",
"import",
"re",
"regex",
"=",
"re",
".",
"compile",
"(",
"r\"\\W\"",
")",
"post_script_name",
"=",
"regex",
".",
"sub",
"(",
"\"\"",
",",
"font_metadata",
".",
"pos... | METADATA.pb font.full_name and font.post_script_name
fields have equivalent values ? | [
"METADATA",
".",
"pb",
"font",
".",
"full_name",
"and",
"font",
".",
"post_script_name",
"fields",
"have",
"equivalent",
"values",
"?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1723-L1738 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_match_filename_postscript | def com_google_fonts_check_metadata_match_filename_postscript(font_metadata):
"""METADATA.pb font.filename and font.post_script_name
fields have equivalent values?
"""
post_script_name = font_metadata.post_script_name
filename = os.path.splitext(font_metadata.filename)[0]
if filename != post_script_name... | python | def com_google_fonts_check_metadata_match_filename_postscript(font_metadata):
"""METADATA.pb font.filename and font.post_script_name
fields have equivalent values?
"""
post_script_name = font_metadata.post_script_name
filename = os.path.splitext(font_metadata.filename)[0]
if filename != post_script_name... | [
"def",
"com_google_fonts_check_metadata_match_filename_postscript",
"(",
"font_metadata",
")",
":",
"post_script_name",
"=",
"font_metadata",
".",
"post_script_name",
"filename",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"font_metadata",
".",
"filename",
")",
"[",
... | METADATA.pb font.filename and font.post_script_name
fields have equivalent values? | [
"METADATA",
".",
"pb",
"font",
".",
"filename",
"and",
"font",
".",
"post_script_name",
"fields",
"have",
"equivalent",
"values?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1748-L1762 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_valid_name_values | def com_google_fonts_check_metadata_valid_name_values(style,
font_metadata,
font_familynames,
typographic_familynames):
"""METADATA.pb font.name field conta... | python | def com_google_fonts_check_metadata_valid_name_values(style,
font_metadata,
font_familynames,
typographic_familynames):
"""METADATA.pb font.name field conta... | [
"def",
"com_google_fonts_check_metadata_valid_name_values",
"(",
"style",
",",
"font_metadata",
",",
"font_familynames",
",",
"typographic_familynames",
")",
":",
"from",
"fontbakery",
".",
"constants",
"import",
"RIBBI_STYLE_NAMES",
"if",
"style",
"in",
"RIBBI_STYLE_NAMES"... | METADATA.pb font.name field contains font name in right format? | [
"METADATA",
".",
"pb",
"font",
".",
"name",
"field",
"contains",
"font",
"name",
"in",
"right",
"format?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1792-L1813 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_valid_full_name_values | def com_google_fonts_check_metadata_valid_full_name_values(style,
font_metadata,
font_familynames,
typographic_familynames):
"""METADATA.pb f... | python | def com_google_fonts_check_metadata_valid_full_name_values(style,
font_metadata,
font_familynames,
typographic_familynames):
"""METADATA.pb f... | [
"def",
"com_google_fonts_check_metadata_valid_full_name_values",
"(",
"style",
",",
"font_metadata",
",",
"font_familynames",
",",
"typographic_familynames",
")",
":",
"from",
"fontbakery",
".",
"constants",
"import",
"RIBBI_STYLE_NAMES",
"if",
"style",
"in",
"RIBBI_STYLE_N... | METADATA.pb font.full_name field contains font name in right format? | [
"METADATA",
".",
"pb",
"font",
".",
"full_name",
"field",
"contains",
"font",
"name",
"in",
"right",
"format?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1821-L1846 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_valid_filename_values | def com_google_fonts_check_metadata_valid_filename_values(font,
family_metadata):
"""METADATA.pb font.filename field contains font name in right format?"""
expected = os.path.basename(font)
failed = True
for font_metadata in family_metadata.fonts:
if... | python | def com_google_fonts_check_metadata_valid_filename_values(font,
family_metadata):
"""METADATA.pb font.filename field contains font name in right format?"""
expected = os.path.basename(font)
failed = True
for font_metadata in family_metadata.fonts:
if... | [
"def",
"com_google_fonts_check_metadata_valid_filename_values",
"(",
"font",
",",
"family_metadata",
")",
":",
"expected",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"font",
")",
"failed",
"=",
"True",
"for",
"font_metadata",
"in",
"family_metadata",
".",
"font... | METADATA.pb font.filename field contains font name in right format? | [
"METADATA",
".",
"pb",
"font",
".",
"filename",
"field",
"contains",
"font",
"name",
"in",
"right",
"format?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1855-L1868 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_valid_post_script_name_values | def com_google_fonts_check_metadata_valid_post_script_name_values(font_metadata,
font_familynames):
"""METADATA.pb font.post_script_name field
contains font name in right format?
"""
for font_familyname in font_familynames:
psname = "".joi... | python | def com_google_fonts_check_metadata_valid_post_script_name_values(font_metadata,
font_familynames):
"""METADATA.pb font.post_script_name field
contains font name in right format?
"""
for font_familyname in font_familynames:
psname = "".joi... | [
"def",
"com_google_fonts_check_metadata_valid_post_script_name_values",
"(",
"font_metadata",
",",
"font_familynames",
")",
":",
"for",
"font_familyname",
"in",
"font_familynames",
":",
"psname",
"=",
"\"\"",
".",
"join",
"(",
"str",
"(",
"font_familyname",
")",
".",
... | METADATA.pb font.post_script_name field
contains font name in right format? | [
"METADATA",
".",
"pb",
"font",
".",
"post_script_name",
"field",
"contains",
"font",
"name",
"in",
"right",
"format?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1876-L1890 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_valid_copyright | def com_google_fonts_check_metadata_valid_copyright(font_metadata):
"""Copyright notices match canonical pattern in METADATA.pb"""
import re
string = font_metadata.copyright
does_match = re.search(r'Copyright [0-9]{4} The .* Project Authors \([^\@]*\)',
string)
if does_match:
yi... | python | def com_google_fonts_check_metadata_valid_copyright(font_metadata):
"""Copyright notices match canonical pattern in METADATA.pb"""
import re
string = font_metadata.copyright
does_match = re.search(r'Copyright [0-9]{4} The .* Project Authors \([^\@]*\)',
string)
if does_match:
yi... | [
"def",
"com_google_fonts_check_metadata_valid_copyright",
"(",
"font_metadata",
")",
":",
"import",
"re",
"string",
"=",
"font_metadata",
".",
"copyright",
"does_match",
"=",
"re",
".",
"search",
"(",
"r'Copyright [0-9]{4} The .* Project Authors \\([^\\@]*\\)'",
",",
"strin... | Copyright notices match canonical pattern in METADATA.pb | [
"Copyright",
"notices",
"match",
"canonical",
"pattern",
"in",
"METADATA",
".",
"pb"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1897-L1911 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_font_copyright | def com_google_fonts_check_font_copyright(ttFont):
"""Copyright notices match canonical pattern in fonts"""
import re
from fontbakery.utils import get_name_entry_strings
failed = False
for string in get_name_entry_strings(ttFont, NameID.COPYRIGHT_NOTICE):
does_match = re.search(r'Copyright [0-9]{4} The .... | python | def com_google_fonts_check_font_copyright(ttFont):
"""Copyright notices match canonical pattern in fonts"""
import re
from fontbakery.utils import get_name_entry_strings
failed = False
for string in get_name_entry_strings(ttFont, NameID.COPYRIGHT_NOTICE):
does_match = re.search(r'Copyright [0-9]{4} The .... | [
"def",
"com_google_fonts_check_font_copyright",
"(",
"ttFont",
")",
":",
"import",
"re",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"failed",
"=",
"False",
"for",
"string",
"in",
"get_name_entry_strings",
"(",
"ttFont",
",",
"NameID",
".... | Copyright notices match canonical pattern in fonts | [
"Copyright",
"notices",
"match",
"canonical",
"pattern",
"in",
"fonts"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1917-L1938 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_italic_style | def com_google_fonts_check_metadata_italic_style(ttFont, font_metadata):
"""METADATA.pb font.style "italic" matches font internals?"""
from fontbakery.utils import get_name_entry_strings
from fontbakery.constants import MacStyle
if font_metadata.style != "italic":
yield SKIP, "This check only applies to it... | python | def com_google_fonts_check_metadata_italic_style(ttFont, font_metadata):
"""METADATA.pb font.style "italic" matches font internals?"""
from fontbakery.utils import get_name_entry_strings
from fontbakery.constants import MacStyle
if font_metadata.style != "italic":
yield SKIP, "This check only applies to it... | [
"def",
"com_google_fonts_check_metadata_italic_style",
"(",
"ttFont",
",",
"font_metadata",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"from",
"fontbakery",
".",
"constants",
"import",
"MacStyle",
"if",
"font_metadata",
".",
"style... | METADATA.pb font.style "italic" matches font internals? | [
"METADATA",
".",
"pb",
"font",
".",
"style",
"italic",
"matches",
"font",
"internals?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2029-L2061 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_normal_style | def com_google_fonts_check_metadata_normal_style(ttFont, font_metadata):
"""METADATA.pb font.style "normal" matches font internals?"""
from fontbakery.utils import get_name_entry_strings
from fontbakery.constants import MacStyle
if font_metadata.style != "normal":
yield SKIP, "This check only applies to no... | python | def com_google_fonts_check_metadata_normal_style(ttFont, font_metadata):
"""METADATA.pb font.style "normal" matches font internals?"""
from fontbakery.utils import get_name_entry_strings
from fontbakery.constants import MacStyle
if font_metadata.style != "normal":
yield SKIP, "This check only applies to no... | [
"def",
"com_google_fonts_check_metadata_normal_style",
"(",
"ttFont",
",",
"font_metadata",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"from",
"fontbakery",
".",
"constants",
"import",
"MacStyle",
"if",
"font_metadata",
".",
"style... | METADATA.pb font.style "normal" matches font internals? | [
"METADATA",
".",
"pb",
"font",
".",
"style",
"normal",
"matches",
"font",
"internals?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2068-L2106 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_nameid_family_and_full_names | def com_google_fonts_check_metadata_nameid_family_and_full_names(ttFont, font_metadata):
"""METADATA.pb font.name and font.full_name fields match
the values declared on the name table?
"""
from fontbakery.utils import get_name_entry_strings
font_familynames = get_name_entry_strings(ttFont, NameID.TYPOGRAP... | python | def com_google_fonts_check_metadata_nameid_family_and_full_names(ttFont, font_metadata):
"""METADATA.pb font.name and font.full_name fields match
the values declared on the name table?
"""
from fontbakery.utils import get_name_entry_strings
font_familynames = get_name_entry_strings(ttFont, NameID.TYPOGRAP... | [
"def",
"com_google_fonts_check_metadata_nameid_family_and_full_names",
"(",
"ttFont",
",",
"font_metadata",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"font_familynames",
"=",
"get_name_entry_strings",
"(",
"ttFont",
",",
"NameID",
"."... | METADATA.pb font.name and font.full_name fields match
the values declared on the name table? | [
"METADATA",
".",
"pb",
"font",
".",
"name",
"and",
"font",
".",
"full_name",
"fields",
"match",
"the",
"values",
"declared",
"on",
"the",
"name",
"table?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2113-L2141 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_match_weight_postscript | def com_google_fonts_check_metadata_match_weight_postscript(font_metadata):
"""METADATA.pb weight matches postScriptName."""
WEIGHTS = {
"Thin": 100,
"ThinItalic": 100,
"ExtraLight": 200,
"ExtraLightItalic": 200,
"Light": 300,
"LightItalic": 300,
"Regular": 400,
"Italic": 400,
"M... | python | def com_google_fonts_check_metadata_match_weight_postscript(font_metadata):
"""METADATA.pb weight matches postScriptName."""
WEIGHTS = {
"Thin": 100,
"ThinItalic": 100,
"ExtraLight": 200,
"ExtraLightItalic": 200,
"Light": 300,
"LightItalic": 300,
"Regular": 400,
"Italic": 400,
"M... | [
"def",
"com_google_fonts_check_metadata_match_weight_postscript",
"(",
"font_metadata",
")",
":",
"WEIGHTS",
"=",
"{",
"\"Thin\"",
":",
"100",
",",
"\"ThinItalic\"",
":",
"100",
",",
"\"ExtraLight\"",
":",
"200",
",",
"\"ExtraLightItalic\"",
":",
"200",
",",
"\"Ligh... | METADATA.pb weight matches postScriptName. | [
"METADATA",
".",
"pb",
"weight",
"matches",
"postScriptName",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2259-L2299 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_unitsperem_strict | def com_google_fonts_check_unitsperem_strict(ttFont):
""" Stricter unitsPerEm criteria for Google Fonts. """
upm_height = ttFont["head"].unitsPerEm
ACCEPTABLE = [16, 32, 64, 128, 256, 500,
512, 1000, 1024, 2000, 2048]
if upm_height not in ACCEPTABLE:
yield FAIL, (f"Font em size (unitsPerEm) ... | python | def com_google_fonts_check_unitsperem_strict(ttFont):
""" Stricter unitsPerEm criteria for Google Fonts. """
upm_height = ttFont["head"].unitsPerEm
ACCEPTABLE = [16, 32, 64, 128, 256, 500,
512, 1000, 1024, 2000, 2048]
if upm_height not in ACCEPTABLE:
yield FAIL, (f"Font em size (unitsPerEm) ... | [
"def",
"com_google_fonts_check_unitsperem_strict",
"(",
"ttFont",
")",
":",
"upm_height",
"=",
"ttFont",
"[",
"\"head\"",
"]",
".",
"unitsPerEm",
"ACCEPTABLE",
"=",
"[",
"16",
",",
"32",
",",
"64",
",",
"128",
",",
"256",
",",
"500",
",",
"512",
",",
"10... | Stricter unitsPerEm criteria for Google Fonts. | [
"Stricter",
"unitsPerEm",
"criteria",
"for",
"Google",
"Fonts",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2367-L2387 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | remote_styles | def remote_styles(family_metadata):
"""Get a dictionary of TTFont objects of all font files of
a given family as currently hosted at Google Fonts.
"""
def download_family_from_Google_Fonts(family_name):
"""Return a zipfile containing a font family hosted on fonts.google.com"""
from zipfile import Zi... | python | def remote_styles(family_metadata):
"""Get a dictionary of TTFont objects of all font files of
a given family as currently hosted at Google Fonts.
"""
def download_family_from_Google_Fonts(family_name):
"""Return a zipfile containing a font family hosted on fonts.google.com"""
from zipfile import Zi... | [
"def",
"remote_styles",
"(",
"family_metadata",
")",
":",
"def",
"download_family_from_Google_Fonts",
"(",
"family_name",
")",
":",
"from",
"zipfile",
"import",
"ZipFile",
"from",
"fontbakery",
".",
"utils",
"import",
"download_file",
"url_prefix",
"=",
"'https://font... | Get a dictionary of TTFont objects of all font files of
a given family as currently hosted at Google Fonts. | [
"Get",
"a",
"dictionary",
"of",
"TTFont",
"objects",
"of",
"all",
"font",
"files",
"of",
"a",
"given",
"family",
"as",
"currently",
"hosted",
"at",
"Google",
"Fonts",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2391-L2428 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | github_gfonts_ttFont | def github_gfonts_ttFont(ttFont, license):
"""Get a TTFont object of a font downloaded
from Google Fonts git repository.
"""
if not license:
return
from fontbakery.utils import download_file
from fontTools.ttLib import TTFont
from urllib.request import HTTPError
LICENSE_DIRECTORY = {
"OFL.tx... | python | def github_gfonts_ttFont(ttFont, license):
"""Get a TTFont object of a font downloaded
from Google Fonts git repository.
"""
if not license:
return
from fontbakery.utils import download_file
from fontTools.ttLib import TTFont
from urllib.request import HTTPError
LICENSE_DIRECTORY = {
"OFL.tx... | [
"def",
"github_gfonts_ttFont",
"(",
"ttFont",
",",
"license",
")",
":",
"if",
"not",
"license",
":",
"return",
"from",
"fontbakery",
".",
"utils",
"import",
"download_file",
"from",
"fontTools",
".",
"ttLib",
"import",
"TTFont",
"from",
"urllib",
".",
"request... | Get a TTFont object of a font downloaded
from Google Fonts git repository. | [
"Get",
"a",
"TTFont",
"object",
"of",
"a",
"font",
"downloaded",
"from",
"Google",
"Fonts",
"git",
"repository",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2442-L2467 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_version_bump | def com_google_fonts_check_version_bump(ttFont,
api_gfonts_ttFont,
github_gfonts_ttFont):
"""Version number has increased since previous release on Google Fonts?"""
v_number = ttFont["head"].fontRevision
api_gfonts_v_number = api_gfon... | python | def com_google_fonts_check_version_bump(ttFont,
api_gfonts_ttFont,
github_gfonts_ttFont):
"""Version number has increased since previous release on Google Fonts?"""
v_number = ttFont["head"].fontRevision
api_gfonts_v_number = api_gfon... | [
"def",
"com_google_fonts_check_version_bump",
"(",
"ttFont",
",",
"api_gfonts_ttFont",
",",
"github_gfonts_ttFont",
")",
":",
"v_number",
"=",
"ttFont",
"[",
"\"head\"",
"]",
".",
"fontRevision",
"api_gfonts_v_number",
"=",
"api_gfonts_ttFont",
"[",
"\"head\"",
"]",
"... | Version number has increased since previous release on Google Fonts? | [
"Version",
"number",
"has",
"increased",
"since",
"previous",
"release",
"on",
"Google",
"Fonts?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2475-L2515 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_production_glyphs_similarity | def com_google_fonts_check_production_glyphs_similarity(ttFont, api_gfonts_ttFont):
"""Glyphs are similiar to Google Fonts version?"""
def glyphs_surface_area(ttFont):
"""Calculate the surface area of a glyph's ink"""
from fontTools.pens.areaPen import AreaPen
glyphs = {}
glyph_set = ttFont.getGlyp... | python | def com_google_fonts_check_production_glyphs_similarity(ttFont, api_gfonts_ttFont):
"""Glyphs are similiar to Google Fonts version?"""
def glyphs_surface_area(ttFont):
"""Calculate the surface area of a glyph's ink"""
from fontTools.pens.areaPen import AreaPen
glyphs = {}
glyph_set = ttFont.getGlyp... | [
"def",
"com_google_fonts_check_production_glyphs_similarity",
"(",
"ttFont",
",",
"api_gfonts_ttFont",
")",
":",
"def",
"glyphs_surface_area",
"(",
"ttFont",
")",
":",
"from",
"fontTools",
".",
"pens",
".",
"areaPen",
"import",
"AreaPen",
"glyphs",
"=",
"{",
"}",
... | Glyphs are similiar to Google Fonts version? | [
"Glyphs",
"are",
"similiar",
"to",
"Google",
"Fonts",
"version?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2522-L2562 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_italic_angle | def com_google_fonts_check_italic_angle(ttFont, style):
"""Checking post.italicAngle value."""
failed = False
value = ttFont["post"].italicAngle
# Checking that italicAngle <= 0
if value > 0:
failed = True
yield FAIL, Message("positive",
("The value of post.italicAngle is posi... | python | def com_google_fonts_check_italic_angle(ttFont, style):
"""Checking post.italicAngle value."""
failed = False
value = ttFont["post"].italicAngle
# Checking that italicAngle <= 0
if value > 0:
failed = True
yield FAIL, Message("positive",
("The value of post.italicAngle is posi... | [
"def",
"com_google_fonts_check_italic_angle",
"(",
"ttFont",
",",
"style",
")",
":",
"failed",
"=",
"False",
"value",
"=",
"ttFont",
"[",
"\"post\"",
"]",
".",
"italicAngle",
"if",
"value",
">",
"0",
":",
"failed",
"=",
"True",
"yield",
"FAIL",
",",
"Messa... | Checking post.italicAngle value. | [
"Checking",
"post",
".",
"italicAngle",
"value",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2610-L2655 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_mac_style | def com_google_fonts_check_mac_style(ttFont, style):
"""Checking head.macStyle value."""
from fontbakery.utils import check_bit_entry
from fontbakery.constants import MacStyle
# Checking macStyle ITALIC bit:
expected = "Italic" in style
yield check_bit_entry(ttFont, "head", "macStyle",
... | python | def com_google_fonts_check_mac_style(ttFont, style):
"""Checking head.macStyle value."""
from fontbakery.utils import check_bit_entry
from fontbakery.constants import MacStyle
# Checking macStyle ITALIC bit:
expected = "Italic" in style
yield check_bit_entry(ttFont, "head", "macStyle",
... | [
"def",
"com_google_fonts_check_mac_style",
"(",
"ttFont",
",",
"style",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"check_bit_entry",
"from",
"fontbakery",
".",
"constants",
"import",
"MacStyle",
"expected",
"=",
"\"Italic\"",
"in",
"style",
"yield",
... | Checking head.macStyle value. | [
"Checking",
"head",
".",
"macStyle",
"value",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2668-L2685 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_contour_count | def com_google_fonts_check_contour_count(ttFont):
"""Check if each glyph has the recommended amount of contours.
This check is useful to assure glyphs aren't incorrectly constructed.
The desired_glyph_data module contains the 'recommended' countour count
for encoded glyphs. The contour counts are derived from... | python | def com_google_fonts_check_contour_count(ttFont):
"""Check if each glyph has the recommended amount of contours.
This check is useful to assure glyphs aren't incorrectly constructed.
The desired_glyph_data module contains the 'recommended' countour count
for encoded glyphs. The contour counts are derived from... | [
"def",
"com_google_fonts_check_contour_count",
"(",
"ttFont",
")",
":",
"from",
"fontbakery",
".",
"glyphdata",
"import",
"desired_glyph_data",
"as",
"glyph_data",
"from",
"fontbakery",
".",
"utils",
"import",
"(",
"get_font_glyph_data",
",",
"pretty_print_list",
")",
... | Check if each glyph has the recommended amount of contours.
This check is useful to assure glyphs aren't incorrectly constructed.
The desired_glyph_data module contains the 'recommended' countour count
for encoded glyphs. The contour counts are derived from fonts which were
chosen for their quality and unique... | [
"Check",
"if",
"each",
"glyph",
"has",
"the",
"recommended",
"amount",
"of",
"contours",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2706-L2772 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_metadata_nameid_copyright | def com_google_fonts_check_metadata_nameid_copyright(ttFont, font_metadata):
"""Copyright field for this font on METADATA.pb matches
all copyright notice entries on the name table ?"""
failed = False
for nameRecord in ttFont['name'].names:
string = nameRecord.string.decode(nameRecord.getEncoding())
i... | python | def com_google_fonts_check_metadata_nameid_copyright(ttFont, font_metadata):
"""Copyright field for this font on METADATA.pb matches
all copyright notice entries on the name table ?"""
failed = False
for nameRecord in ttFont['name'].names:
string = nameRecord.string.decode(nameRecord.getEncoding())
i... | [
"def",
"com_google_fonts_check_metadata_nameid_copyright",
"(",
"ttFont",
",",
"font_metadata",
")",
":",
"failed",
"=",
"False",
"for",
"nameRecord",
"in",
"ttFont",
"[",
"'name'",
"]",
".",
"names",
":",
"string",
"=",
"nameRecord",
".",
"string",
".",
"decode... | Copyright field for this font on METADATA.pb matches
all copyright notice entries on the name table ? | [
"Copyright",
"field",
"for",
"this",
"font",
"on",
"METADATA",
".",
"pb",
"matches",
"all",
"copyright",
"notice",
"entries",
"on",
"the",
"name",
"table",
"?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2800-L2816 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_name_mandatory_entries | def com_google_fonts_check_name_mandatory_entries(ttFont, style):
"""Font has all mandatory 'name' table entries ?"""
from fontbakery.utils import get_name_entry_strings
from fontbakery.constants import RIBBI_STYLE_NAMES
required_nameIDs = [NameID.FONT_FAMILY_NAME,
NameID.FONT_SUBFAMILY_N... | python | def com_google_fonts_check_name_mandatory_entries(ttFont, style):
"""Font has all mandatory 'name' table entries ?"""
from fontbakery.utils import get_name_entry_strings
from fontbakery.constants import RIBBI_STYLE_NAMES
required_nameIDs = [NameID.FONT_FAMILY_NAME,
NameID.FONT_SUBFAMILY_N... | [
"def",
"com_google_fonts_check_name_mandatory_entries",
"(",
"ttFont",
",",
"style",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entry_strings",
"from",
"fontbakery",
".",
"constants",
"import",
"RIBBI_STYLE_NAMES",
"required_nameIDs",
"=",
"[",
"N... | Font has all mandatory 'name' table entries ? | [
"Font",
"has",
"all",
"mandatory",
"name",
"table",
"entries",
"?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2868-L2888 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_name_copyright_length | def com_google_fonts_check_name_copyright_length(ttFont):
""" Length of copyright notice must not exceed 500 characters. """
from fontbakery.utils import get_name_entries
failed = False
for notice in get_name_entries(ttFont, NameID.COPYRIGHT_NOTICE):
notice_str = notice.string.decode(notice.getEncoding())
... | python | def com_google_fonts_check_name_copyright_length(ttFont):
""" Length of copyright notice must not exceed 500 characters. """
from fontbakery.utils import get_name_entries
failed = False
for notice in get_name_entries(ttFont, NameID.COPYRIGHT_NOTICE):
notice_str = notice.string.decode(notice.getEncoding())
... | [
"def",
"com_google_fonts_check_name_copyright_length",
"(",
"ttFont",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"get_name_entries",
"failed",
"=",
"False",
"for",
"notice",
"in",
"get_name_entries",
"(",
"ttFont",
",",
"NameID",
".",
"COPYRIGHT_NOTICE",
... | Length of copyright notice must not exceed 500 characters. | [
"Length",
"of",
"copyright",
"notice",
"must",
"not",
"exceed",
"500",
"characters",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3181-L3196 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_fontv | def com_google_fonts_check_fontv(ttFont):
""" Check for font-v versioning """
from fontv.libfv import FontVersion
fv = FontVersion(ttFont)
if fv.version and (fv.is_development or fv.is_release):
yield PASS, "Font version string looks GREAT!"
else:
yield INFO, ("Version string is: \"{}\"\n"
... | python | def com_google_fonts_check_fontv(ttFont):
""" Check for font-v versioning """
from fontv.libfv import FontVersion
fv = FontVersion(ttFont)
if fv.version and (fv.is_development or fv.is_release):
yield PASS, "Font version string looks GREAT!"
else:
yield INFO, ("Version string is: \"{}\"\n"
... | [
"def",
"com_google_fonts_check_fontv",
"(",
"ttFont",
")",
":",
"from",
"fontv",
".",
"libfv",
"import",
"FontVersion",
"fv",
"=",
"FontVersion",
"(",
"ttFont",
")",
"if",
"fv",
".",
"version",
"and",
"(",
"fv",
".",
"is_development",
"or",
"fv",
".",
"is_... | Check for font-v versioning | [
"Check",
"for",
"font",
"-",
"v",
"versioning"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3239-L3252 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_negative_advance_width | def com_google_fonts_check_negative_advance_width(ttFont):
""" Check that advance widths cannot be inferred as negative. """
failed = False
for glyphName in ttFont["glyf"].glyphs:
coords = ttFont["glyf"][glyphName].coordinates
rightX = coords[-3][0]
leftX = coords[-4][0]
advwidth = rightX - leftX
... | python | def com_google_fonts_check_negative_advance_width(ttFont):
""" Check that advance widths cannot be inferred as negative. """
failed = False
for glyphName in ttFont["glyf"].glyphs:
coords = ttFont["glyf"][glyphName].coordinates
rightX = coords[-3][0]
leftX = coords[-4][0]
advwidth = rightX - leftX
... | [
"def",
"com_google_fonts_check_negative_advance_width",
"(",
"ttFont",
")",
":",
"failed",
"=",
"False",
"for",
"glyphName",
"in",
"ttFont",
"[",
"\"glyf\"",
"]",
".",
"glyphs",
":",
"coords",
"=",
"ttFont",
"[",
"\"glyf\"",
"]",
"[",
"glyphName",
"]",
".",
... | Check that advance widths cannot be inferred as negative. | [
"Check",
"that",
"advance",
"widths",
"cannot",
"be",
"inferred",
"as",
"negative",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3284-L3300 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_varfont_generate_static | def com_google_fonts_check_varfont_generate_static(ttFont):
""" Check a static ttf can be generated from a variable font. """
import tempfile
from fontTools.varLib import mutator
try:
loc = {k.axisTag: float((k.maxValue + k.minValue) / 2)
for k in ttFont['fvar'].axes}
with tempfile.Temporary... | python | def com_google_fonts_check_varfont_generate_static(ttFont):
""" Check a static ttf can be generated from a variable font. """
import tempfile
from fontTools.varLib import mutator
try:
loc = {k.axisTag: float((k.maxValue + k.minValue) / 2)
for k in ttFont['fvar'].axes}
with tempfile.Temporary... | [
"def",
"com_google_fonts_check_varfont_generate_static",
"(",
"ttFont",
")",
":",
"import",
"tempfile",
"from",
"fontTools",
".",
"varLib",
"import",
"mutator",
"try",
":",
"loc",
"=",
"{",
"k",
".",
"axisTag",
":",
"float",
"(",
"(",
"k",
".",
"maxValue",
"... | Check a static ttf can be generated from a variable font. | [
"Check",
"a",
"static",
"ttf",
"can",
"be",
"generated",
"from",
"a",
"variable",
"font",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3326-L3341 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_smart_dropout | def com_google_fonts_check_smart_dropout(ttFont):
"""Font enables smart dropout control in "prep" table instructions?
B8 01 FF PUSHW 0x01FF
85 SCANCTRL (unconditinally turn on
dropout control mode)
B0 04 PUSHB 0x04
8D SCANTYPE (enable smart dropout control)
... | python | def com_google_fonts_check_smart_dropout(ttFont):
"""Font enables smart dropout control in "prep" table instructions?
B8 01 FF PUSHW 0x01FF
85 SCANCTRL (unconditinally turn on
dropout control mode)
B0 04 PUSHB 0x04
8D SCANTYPE (enable smart dropout control)
... | [
"def",
"com_google_fonts_check_smart_dropout",
"(",
"ttFont",
")",
":",
"INSTRUCTIONS",
"=",
"b\"\\xb8\\x01\\xff\\x85\\xb0\\x04\\x8d\"",
"if",
"(",
"\"prep\"",
"in",
"ttFont",
"and",
"INSTRUCTIONS",
"in",
"ttFont",
"[",
"\"prep\"",
"]",
".",
"program",
".",
"getByteco... | Font enables smart dropout control in "prep" table instructions?
B8 01 FF PUSHW 0x01FF
85 SCANCTRL (unconditinally turn on
dropout control mode)
B0 04 PUSHB 0x04
8D SCANTYPE (enable smart dropout control)
Smart dropout control means activating rules 1, 2 an... | [
"Font",
"enables",
"smart",
"dropout",
"control",
"in",
"prep",
"table",
"instructions?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3417-L3450 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_aat | def com_google_fonts_check_aat(ttFont):
"""Are there unwanted Apple tables?"""
UNWANTED_TABLES = {
'EBSC', 'Zaph', 'acnt', 'ankr', 'bdat', 'bhed', 'bloc',
'bmap', 'bsln', 'fdsc', 'feat', 'fond', 'gcid', 'just',
'kerx', 'lcar', 'ltag', 'mort', 'morx', 'opbd', 'prop',
'trak', 'xref'
}
unwanted_tab... | python | def com_google_fonts_check_aat(ttFont):
"""Are there unwanted Apple tables?"""
UNWANTED_TABLES = {
'EBSC', 'Zaph', 'acnt', 'ankr', 'bdat', 'bhed', 'bloc',
'bmap', 'bsln', 'fdsc', 'feat', 'fond', 'gcid', 'just',
'kerx', 'lcar', 'ltag', 'mort', 'morx', 'opbd', 'prop',
'trak', 'xref'
}
unwanted_tab... | [
"def",
"com_google_fonts_check_aat",
"(",
"ttFont",
")",
":",
"UNWANTED_TABLES",
"=",
"{",
"'EBSC'",
",",
"'Zaph'",
",",
"'acnt'",
",",
"'ankr'",
",",
"'bdat'",
",",
"'bhed'",
",",
"'bloc'",
",",
"'bmap'",
",",
"'bsln'",
",",
"'fdsc'",
",",
"'feat'",
",",
... | Are there unwanted Apple tables? | [
"Are",
"there",
"unwanted",
"Apple",
"tables?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3477-L3497 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_fvar_name_entries | def com_google_fonts_check_fvar_name_entries(ttFont):
"""All name entries referenced by fvar instances exist on the name table?"""
failed = False
for instance in ttFont["fvar"].instances:
entries = [entry for entry in ttFont["name"].names if entry.nameID == instance.subfamilyNameID]
if len(entries) == 0... | python | def com_google_fonts_check_fvar_name_entries(ttFont):
"""All name entries referenced by fvar instances exist on the name table?"""
failed = False
for instance in ttFont["fvar"].instances:
entries = [entry for entry in ttFont["name"].names if entry.nameID == instance.subfamilyNameID]
if len(entries) == 0... | [
"def",
"com_google_fonts_check_fvar_name_entries",
"(",
"ttFont",
")",
":",
"failed",
"=",
"False",
"for",
"instance",
"in",
"ttFont",
"[",
"\"fvar\"",
"]",
".",
"instances",
":",
"entries",
"=",
"[",
"entry",
"for",
"entry",
"in",
"ttFont",
"[",
"\"name\"",
... | All name entries referenced by fvar instances exist on the name table? | [
"All",
"name",
"entries",
"referenced",
"by",
"fvar",
"instances",
"exist",
"on",
"the",
"name",
"table?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3509-L3522 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_varfont_weight_instances | def com_google_fonts_check_varfont_weight_instances(ttFont):
"""Variable font weight coordinates must be multiples of 100."""
failed = False
for instance in ttFont["fvar"].instances:
if 'wght' in instance.coordinates and instance.coordinates['wght'] % 100 != 0:
failed = True
yield FAIL, ("Found a... | python | def com_google_fonts_check_varfont_weight_instances(ttFont):
"""Variable font weight coordinates must be multiples of 100."""
failed = False
for instance in ttFont["fvar"].instances:
if 'wght' in instance.coordinates and instance.coordinates['wght'] % 100 != 0:
failed = True
yield FAIL, ("Found a... | [
"def",
"com_google_fonts_check_varfont_weight_instances",
"(",
"ttFont",
")",
":",
"failed",
"=",
"False",
"for",
"instance",
"in",
"ttFont",
"[",
"\"fvar\"",
"]",
".",
"instances",
":",
"if",
"'wght'",
"in",
"instance",
".",
"coordinates",
"and",
"instance",
".... | Variable font weight coordinates must be multiples of 100. | [
"Variable",
"font",
"weight",
"coordinates",
"must",
"be",
"multiples",
"of",
"100",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3549-L3561 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_family_tnum_horizontal_metrics | def com_google_fonts_check_family_tnum_horizontal_metrics(fonts):
"""All tabular figures must have the same width across the RIBBI-family."""
from fontbakery.constants import RIBBI_STYLE_NAMES
from fontTools.ttLib import TTFont
RIBBI_ttFonts = [TTFont(f)
for f in fonts
if s... | python | def com_google_fonts_check_family_tnum_horizontal_metrics(fonts):
"""All tabular figures must have the same width across the RIBBI-family."""
from fontbakery.constants import RIBBI_STYLE_NAMES
from fontTools.ttLib import TTFont
RIBBI_ttFonts = [TTFont(f)
for f in fonts
if s... | [
"def",
"com_google_fonts_check_family_tnum_horizontal_metrics",
"(",
"fonts",
")",
":",
"from",
"fontbakery",
".",
"constants",
"import",
"RIBBI_STYLE_NAMES",
"from",
"fontTools",
".",
"ttLib",
"import",
"TTFont",
"RIBBI_ttFonts",
"=",
"[",
"TTFont",
"(",
"f",
")",
... | All tabular figures must have the same width across the RIBBI-family. | [
"All",
"tabular",
"figures",
"must",
"have",
"the",
"same",
"width",
"across",
"the",
"RIBBI",
"-",
"family",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3579-L3611 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_ligature_carets | def com_google_fonts_check_ligature_carets(ttFont, ligature_glyphs):
"""Are there caret positions declared for every ligature?"""
if ligature_glyphs == -1:
yield FAIL, Message("malformed", "Failed to lookup ligatures."
" This font file seems to be malformed."
" Fo... | python | def com_google_fonts_check_ligature_carets(ttFont, ligature_glyphs):
"""Are there caret positions declared for every ligature?"""
if ligature_glyphs == -1:
yield FAIL, Message("malformed", "Failed to lookup ligatures."
" This font file seems to be malformed."
" Fo... | [
"def",
"com_google_fonts_check_ligature_carets",
"(",
"ttFont",
",",
"ligature_glyphs",
")",
":",
"if",
"ligature_glyphs",
"==",
"-",
"1",
":",
"yield",
"FAIL",
",",
"Message",
"(",
"\"malformed\"",
",",
"\"Failed to lookup ligatures.\"",
"\" This font file seems to be ma... | Are there caret positions declared for every ligature? | [
"Are",
"there",
"caret",
"positions",
"declared",
"for",
"every",
"ligature?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3660-L3693 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_kerning_for_non_ligated_sequences | def com_google_fonts_check_kerning_for_non_ligated_sequences(ttFont, ligatures, has_kerning_info):
"""Is there kerning info for non-ligated sequences?"""
def look_for_nonligated_kern_info(table):
for pairpos in table.SubTable:
for i, glyph in enumerate(pairpos.Coverage.glyphs):
if not hasattr(pai... | python | def com_google_fonts_check_kerning_for_non_ligated_sequences(ttFont, ligatures, has_kerning_info):
"""Is there kerning info for non-ligated sequences?"""
def look_for_nonligated_kern_info(table):
for pairpos in table.SubTable:
for i, glyph in enumerate(pairpos.Coverage.glyphs):
if not hasattr(pai... | [
"def",
"com_google_fonts_check_kerning_for_non_ligated_sequences",
"(",
"ttFont",
",",
"ligatures",
",",
"has_kerning_info",
")",
":",
"def",
"look_for_nonligated_kern_info",
"(",
"table",
")",
":",
"for",
"pairpos",
"in",
"table",
".",
"SubTable",
":",
"for",
"i",
... | Is there kerning info for non-ligated sequences? | [
"Is",
"there",
"kerning",
"info",
"for",
"non",
"-",
"ligated",
"sequences?"
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3708-L3755 | train |
googlefonts/fontbakery | Lib/fontbakery/profiles/googlefonts.py | com_google_fonts_check_name_family_and_style_max_length | def com_google_fonts_check_name_family_and_style_max_length(ttFont):
"""Combined length of family and style must not exceed 27 characters."""
from fontbakery.utils import (get_name_entries,
get_name_entry_strings)
failed = False
for familyname in get_name_entries(ttFont,
... | python | def com_google_fonts_check_name_family_and_style_max_length(ttFont):
"""Combined length of family and style must not exceed 27 characters."""
from fontbakery.utils import (get_name_entries,
get_name_entry_strings)
failed = False
for familyname in get_name_entries(ttFont,
... | [
"def",
"com_google_fonts_check_name_family_and_style_max_length",
"(",
"ttFont",
")",
":",
"from",
"fontbakery",
".",
"utils",
"import",
"(",
"get_name_entries",
",",
"get_name_entry_strings",
")",
"failed",
"=",
"False",
"for",
"familyname",
"in",
"get_name_entries",
"... | Combined length of family and style must not exceed 27 characters. | [
"Combined",
"length",
"of",
"family",
"and",
"style",
"must",
"not",
"exceed",
"27",
"characters",
"."
] | b355aea2e619a4477769e060d24c32448aa65399 | https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L3781-L3807 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.