Skip to content

# `Font`

## FL.Font = class Font(object)

      ===============================================
        Font - base class to represent font
      ===============================================

      CONSTRUCTOR:
        Font() - generic constructor, creates an empty Font  Font(Font) - copy constructor
        Font(string filename) - creates a Font and assigns name of the file from which it was opened

      ATTRIBUTES:

        NAMES, COPYRIGHT AND IDENTIFICATION
        family_name(string) - font Family Name
        style_name
        full_name(string) - font Full Name
        font_name(string) - font Font Name
        font_style(integer) - Font Style
        menu_name(string) - font menu name
        weight
        weight_code
        width
        designer
        designer_url
        fontnames[NameRecord] - list of font name records
        copyright(string) - Copyright name field
        notice(string) - Notice field
        note(string) - Font note
        unique_id
        tt_u_id
        tt_version
        trademark
        x_u_id_num
        x_u_id
        vendor
        vendor_url
        version
        year
        version_major
        version_minor
        vp_id
        ms_charset
        ms_id
        panose[integer] - list of Panose values
        collection[collection] - list of glyph indexes in FontLab collection
        pcl_chars_set
        pcl_id

        DIMENSIONS
        upm
        ascender[integer] - list of ascenders, one for each master
        descender[integer] - list of descenders, one for each master
        cap_height[integer] - list of CapHeight records, one for each master
        x_height[integer] - list of xHeight values, one for each master
        default_width
        slant_angle
        italic_angle(float) - Italic Angle
        is_fixed_pitch
        underline_position
        underline_thickness

        ALIGNMENT
        blue_fuzz
        blue_scale
        blue_shift
        blue_values_num(integer) - number of defined blue values
        blue_values[integer[integer]] - two-dimentional array of BlueValues - master index is top-level index
        family_blues_num(integer) - number of FamilyBlues records
        family_blues[integer[integer]] - two-dimentional array of FamilyBlues - master index is top-level index
        family_other_blues_num(integer) - number of FamilyOtherBlues records
        family_other_blues[integer[integer]] - two-dimentional array of FamilyOtherBlues - master index is top-level index
        force_bold[integer] - list of Force Bold values, one for each master
        other_blues_num
        other_blues[integer[integer]] - two-dimentional array of OtherBlues - master index is top-level index
        stem_snap_h_num
        stem_snap_h
        stem_snap_v_num
        stem_snap_v

        OTHER ATTRIBUTES
        classes[string] - list of glyph classes
        ot_classes - OpenType classes data
        classes_text - glyph classes compiled in ot_classes format
        features[Feature] - list of OpenType features
        customdata(string) - font custom data field
        truetypetables[TrueTypeTable] - list of custom TrueType tables
        ttinfo(TTInfo) - loaded TrueType information (mostly hinting-related tables)
        encoding
        glyphs[Glyph] - array of glyphs
        source
        weight_vector
        measurement - position of the measurement line for the font

      OPERATIONS:
        len - returns number of glyphs
        [] - accesses glyphs array

      METHODS
        New() - clears the font
        Open(string filename) - opens font from VFB format
        Save(string filename) - saves font in VFB format
        Reencode()  FindGlyph(string name) | (Uni unicode) | (integer Unicode) - finds glyph and return its index or -1
        DefineAxis(string Name, string Type, string ShortName) - defines the new Multiple Master axis
        DeleteAxis(axisindex, float position) - removes the axis
        GenerateUnicode() - generates Unicode indexes for all glyphs
        GenerateNames() - generates names for all glyphs
        GenerateGlyph(string glyphname) - generates new glyph using 'glyphname' as a source of information about glyph's composition
        MakeKernFeature([WeightVector vector]) - generates 'kern' feature using font kerning and classes
        MergeFonts(Font source[, flags]) - appends all glyphs from the source font. Check mfXXXX constants for options
        SetClassFlags(int class_index, bool left, bool right) - allows to set 'left' and 'right' properties of the kerning class   SetClassFlags(int class_index, bool lsb, bool rsb, bool width) - allows to set 'lsb', 'rsb' and 'width' properties of the metrics class   GetClassLeft(int class_index) - returns the 'left' property of the class  GetClassRight(int class_index) - returns the 'right' property of the class  GetClassMetricsFlags(int class_index) - returns the tuple containing LSB, RSB and Width flags of the metrics class

#### Methods

DefineAxis(...)

DeleteAxis(...)

FindGlyph(...)

GenerateGlyph(...)

GenerateNames(...)

GenerateUnicode(...)

GetClassLeft(...)

GetClassMetricsFlags(...)

GetClassRight(...)

MakeKernFeature(...)

MergeFonts(...)

New(...)

Open(...)

OpenAFM(...)

Save(...)

SaveAFM(...)

SetClassFlags(...)

__delattr__(...)

      x.__delattr__('name') <==> del x.name

__delitem__(...)

      x.__delitem__(y) <==> del x[y]

__getattribute__(...)

      x.__getattribute__('name') <==> x.name

__getitem__(...)

      x.__getitem__(y) <==> x[y]

__init__(...)

      x.__init__(...) initializes x; see help(type(x)) for signature

__len__(...)

      x.__len__() <==> len(x)

__repr__(...)

      x.__repr__() <==> repr(x)

__setattr__(...)

      x.__setattr__('name', value) <==> x.name = value

__setitem__(...)

      x.__setitem__(i, y) <==> x[i]=y

has_key(...)

#### Attributes

__new__ = <built-in method __new__ of type object>

      T.__new__(S, ...) -> a new object with type S, a subtype of T