freetypy.Face¶
-
class
freetypy.Face¶ A face object models a given typeface, in a given style.
Parameters: file : path, or readable file-like object
The file containing the face data.
face_index : int, optional
The index of the face within the font. The first face has index 0.
Returns: face : Face instance
Attributes
ascenderThe typographic ascender of the face, expressed in font units. available_sizesAn list of Bitmap_Sizeobjects for all bitmap strikes in the face.bboxThe font bounding box. charmapThe current active CharMapfor this face.charmapsA list of CharMapobjects in the face.descenderThe typographic descender of the face, expressed in font units. face_flagsA set of FACE_FLAGflags that give important information about the face.face_indexThe index of the face in the font file. family_nameThe face’s family name. filename⨎ The argument used to initialize the font. Is usually a glyphThe face’s associated glyph slot. has_horizontalTruewhenever a face object contains horizontal metrics.has_kerningTruewhenever a face object contains kerning data.has_verticalTruewhenever a face object contains real vertical metrics.heightThis value is the vertical distance between two consecutive baselines, expressed in font units. is_fixed_widthTruewhenever a font face contains fixed-width (or ‘monospace’) glyphs.is_scalableTruewhenever a face object contains a scalable font face.is_sfntTruewhenever font is based on the SFNT storage scheme.max_advance_heightThe maximum advance height, in font units, for all glyphs in this face. max_advance_widthThe maximum advance width, in font units, for all glyphs in this face. num_facesThe number of faces in the font file. num_glyphsThe number of glyphs in the face. sfnt_namesGet a SfntNameslist ofSfntNameentries for the Face.sizeThe current active size for this face. style_flagsA set of STYLE_FLAGflags indicating the style of the face.style_nameThe face’s style name. tt_headerThe TrueType header ( TT_Header) from the face.tt_horiheaderThe TrueType horizontal header ( TT_HoriHeader) from the face.tt_os2The OS/2 TrueType header ( TT_OS2) from the face.tt_pcltThe PCLT header ( TT_Pclt) from the face.tt_postscriptThe Postscript header ( TT_Postscript) from the face.tt_vertheaderThe TrueType vertical header ( TT_VertHeader) from the face.underline_positionThe position, in font units, of the underline line for this face. underline_thicknessThe thickness, in font units, of the underline for this face. units_per_emThe number of font units per EM square for this face. Methods
attach‘Attach’ data to a face object. get_char_indexReturn the glyph index of a given character code. get_char_index_unicode⨎ Return the glyph index of a given Unicode character. get_char_name⨎ Returns the glyph name of the given unicode code point. get_char_variant_indexReturn the glyph index of a given character code as modified by the variation selector. get_charsReturns an iterator over all of the character codes in the current charmap. get_fstype_flagsReturn the FSTYPEflags for a font, which indicate the licensing for embedding and subsetting a font.get_glyph_nameRetrieve the ASCII name of the given glyph in a face. get_kerningReturn the kerning vector between two glyphs of a same face. get_name_indexReturn the glyph index of a given glyph name. get_postscript_nameRetrieve the ASCII PostScript name of a given face, if available. get_track_kerningReturn the track kerning for a given face object at a given size. has_ps_glyph_namesReturn Trueif a given face provides reliable PostScript glyph names.load_charLoad a single glyph, according to its character code. load_char_unicode⨎ Load a single glyph, from a given unicode character. load_glyphLoad a single glyph. request_sizeResize the scale of the active Sizeobject in a face.select_charmapSelect a given charmap by its encoding tag. select_sizeSelect a bitmap strike. set_char_sizeRequest a nominal font size (in points). set_charmapSelect a charmap for character code to glyph index mapping. set_transformSet the transformation that is applied to glyph images.