def filter_diacritics_glyphs(self): diacritic_glyphs = [] for filepath in self.directory.UFO: pifont = PiFont(os.path.join(self.operator.path, filepath)) for glyphcode, glyphname in pifont.get_glyphs(): if not self.is_diacritic(glyphname): continue diacritic_glyphs.append(pifont.get_glyph(glyphname)) return diacritic_glyphs
def test_family_glyph_names_match(self): """ Each font in family has matching glyph names? """ directory = UpstreamDirectory(self.operator.path) # TODO does this glyphs list object get populated? glyphs = [] for f in directory.get_fonts(): font = PiFont(os.path.join(self.operator.path, f)) glyphs_ = font.get_glyphs() if glyphs and glyphs != glyphs_: # TODO report which font self.fail('Family has different glyphs across fonts')
def test_font_prepolation_glyph_points(self): """ Check that glyphs has same number of points across family """ directory = UpstreamDirectory(self.operator.path) glyphs = {} for f in directory.get_fonts(): font = PiFont(os.path.join(self.operator.path, f)) glyphs_ = font.get_glyphs() for g, glyphname in glyphs_: points = font.get_points_count(glyphname) if g in glyphs and glyphs[g] != points: msg = ('Number of points of glyph "%s" does not match.' ' Expected %s points, but actual is %s points') self.fail(msg % (glyphname, glyphs[g], points)) glyphs[g] = points
def test_font_prepolation_glyph_contours(self): """ Check that glyphs has same number of contours across family """ directory = UpstreamDirectory(self.operator.path) glyphs = {} for f in directory.get_fonts(): font = PiFont(os.path.join(self.operator.path, f)) glyphs_ = font.get_glyphs() for glyphcode, glyphname in glyphs_: contours = font.get_contours_count(glyphname) if glyphcode in glyphs and glyphs[glyphcode] != contours: msg = ('Number of contours of glyph "%s" does not match.' ' Expected %s contours, but actual is %s contours') self.fail(msg % (glyphname, glyphs[glyphcode], contours)) glyphs[glyphcode] = contours