Beispiel #1
0
 def expand_dir(cls, path: pathlib.Path):
     assert path.is_dir()
     for child in path.iterdir():
         if child.is_dir():
             yield from cls.expand_dir(child)
         elif Font.is_font_extension(child.suffix):
             yield child
Beispiel #2
0
 def save(self,
          output: Optional[pathlib.Path] = None,
          stem_suffix: Optional[str] = None,
          glyph_out: Optional[Union[pathlib.Path, str, TextIO]] = None,
          glyph_comment: int = 0,
          print_path: bool = False) -> pathlib.Path:
     assert self.has_spacings
     font = self.font
     path_before_save = font.path
     output = calc_output_path(path_before_save,
                               output,
                               stem_suffix=stem_suffix,
                               is_file=output
                               and Font.is_font_extension(output.suffix))
     logger.info('Saving to "%s"', output)
     font.save(output)
     paths = [output, path_before_save]
     if glyph_out:
         glyphs_path = self.save_glyphs(glyph_out, comment=glyph_comment)
         paths.append(glyphs_path)
     if print_path:
         print('\t'.join(str(path) for path in paths),
               flush=True)  # Flush, for better parallelism when piping.
     return output