freetypy.subset.subset_font

freetypy.subset.subset_font(input_fd, output_fd, charcodes, tables_to_remove=None)

Subset a SFNT-style (TrueType or OpenType) font.

If the font is not one of these types, a ValueError is raised.

Parameters:
  • input_fd (readable file-like object, for bytes) – The font file to read.
  • output_fd (writable file-like object, for bytes) – The file to write a subsetted font file to.
  • charcodes (list of int or unicode string) – The character codes to include in the output font file.
  • tables_to_remove (list of bytes, optional) –

    The tags of tables to remove completely. If not provided, this defaults to:

    [b’GPOS’, b’GSUB’]