feaLib

fontTools.feaLib – a package for dealing with OpenType feature files.

ast

class fontTools.feaLib.ast.AlternateSubstStatement(prefix, glyph, suffix, replacement, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.Anchor(x, y, name=None, contourpoint=None, xDeviceTable=None, yDeviceTable=None, location=None)[source]
asFea(indent='')[source]
class fontTools.feaLib.ast.AnchorDefinition(name, x, y, contourpoint=None, location=None)[source]
asFea(indent='')[source]
class fontTools.feaLib.ast.AnonymousBlock(tag, content, location=None)[source]
asFea(indent='')[source]
class fontTools.feaLib.ast.AttachStatement(glyphs, contourPoints, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.BaseAxis(bases, scripts, vertical, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.Block(location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.BytesIO

Buffered I/O implementation using an in-memory bytes buffer.

close()

Disable all I/O operations.

closed

True if the file is closed.

flush()

Does nothing.

getbuffer()

Get a read-write view over the contents of the BytesIO object.

getvalue()

Retrieve the entire contents of the BytesIO object.

isatty()

Always returns False.

BytesIO objects are not connected to a TTY-like device.

read()

Read at most size bytes, returned as a bytes object.

If the size argument is negative, read until EOF is reached. Return an empty bytes object at EOF.

read1()

Read at most size bytes, returned as a bytes object.

If the size argument is negative or omitted, read until EOF is reached. Return an empty bytes object at EOF.

readable()

Returns True if the IO object can be read.

readinto()

Read bytes into buffer.

Returns number of bytes read (0 for EOF), or None if the object is set not to block and has no data to read.

readline()

Next line from the file, as a bytes object.

Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty bytes object at EOF.

readlines()

List of bytes objects, each a line from the file.

Call readline() repeatedly and return a list of the lines so read. The optional size argument, if given, is an approximate bound on the total number of bytes in the lines returned.

seek()

Change stream position.

Seek to byte offset pos relative to position indicated by whence:
0 Start of stream (the default). pos should be >= 0; 1 Current position - pos may be negative; 2 End of stream - pos usually negative.

Returns the new absolute position.

seekable()

Returns True if the IO object can be seeked.

tell()

Current file position, an integer.

truncate()

Truncate the file to at most size bytes.

Size defaults to the current file position, as returned by tell(). The current file position is unchanged. Returns the new size.

writable()

Returns True if the IO object can be written.

write()

Write bytes to file.

Return the number of bytes written.

writelines()

Write lines to the file.

Note that newlines are not added. lines can be any iterable object producing bytes-like objects. This is equivalent to calling write() for each element.

class fontTools.feaLib.ast.CVParametersNameStatement(nameID, platformID, platEncID, langID, string, block_name, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.ChainContextPosStatement(prefix, glyphs, suffix, lookups, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.ChainContextSubstStatement(prefix, glyphs, suffix, lookups, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.CharacterStatement(character, tag, location=None)[source]

Statement used in cvParameters blocks of Character Variant features (cvXX). The Unicode value may be written with either decimal or hexadecimal notation. The value must be preceded by ‘0x’ if it is a hexadecimal value. The largest Unicode value allowed is 0xFFFFFF.

asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.Comment(text, location=None)[source]
asFea(indent='')[source]
class fontTools.feaLib.ast.CursivePosStatement(glyphclass, entryAnchor, exitAnchor, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.Element(location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.Expression(location=None)[source]
class fontTools.feaLib.ast.FeatureBlock(name, use_extension=False, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.FeatureFile[source]
asFea(indent='')[source]
exception fontTools.feaLib.ast.FeatureLibError(message, location)[source]
class fontTools.feaLib.ast.FeatureNameStatement(nameID, platformID, platEncID, langID, string, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.FeatureReferenceStatement(featureName, location=None)[source]

Example: feature salt;

asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.FontRevisionStatement(revision, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.GlyphClass(glyphs=None, location=None)[source]

A glyph class, such as [acute cedilla grave].

add_cid_range(start, end, glyphs)[source]
add_class(gc)[source]
add_range(start, end, glyphs)[source]
append(glyph)[source]
asFea(indent='')[source]
extend(glyphs)[source]
glyphSet()[source]
class fontTools.feaLib.ast.GlyphClassDefStatement(baseGlyphs, markGlyphs, ligatureGlyphs, componentGlyphs, location=None)[source]

Example: GlyphClassDef @UPPERCASE, [B], [C], [D];

asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.GlyphClassDefinition(name, glyphs, location=None)[source]

Example: @UPPERCASE = [A-Z];

asFea(indent='')[source]
glyphSet()[source]
class fontTools.feaLib.ast.GlyphClassName(glyphclass, location=None)[source]

A glyph class name, such as @FRENCH_MARKS.

asFea(indent='')[source]
glyphSet()[source]
class fontTools.feaLib.ast.GlyphName(glyph, location=None)[source]

A single glyph name, such as cedilla.

asFea(indent='')[source]
glyphSet()[source]
class fontTools.feaLib.ast.HheaField(key, value, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.IgnorePosStatement(chainContexts, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.IgnoreSubstStatement(chainContexts, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.IncludeStatement(filename, location=None)[source]
asFea(indent='')[source]
build()[source]
class fontTools.feaLib.ast.LanguageStatement(language, include_default=True, required=False, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.LanguageSystemStatement(script, language, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.LigatureCaretByIndexStatement(glyphs, carets, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.LigatureCaretByPosStatement(glyphs, carets, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.LigatureSubstStatement(prefix, glyphs, suffix, replacement, forceChain, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.LookupBlock(name, use_extension=False, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.LookupFlagStatement(value=0, markAttachment=None, markFilteringSet=None, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.LookupReferenceStatement(lookup, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.MarkBasePosStatement(base, marks, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.MarkClass(name)[source]
addDefinition(definition)[source]
asFea(indent='')[source]
glyphSet()[source]
class fontTools.feaLib.ast.MarkClassDefinition(markClass, anchor, glyphs, location=None)[source]
asFea(indent='')[source]
glyphSet()[source]
class fontTools.feaLib.ast.MarkClassName(markClass, location=None)[source]

A mark class name, such as @FRENCH_MARKS defined with markClass.

asFea(indent='')[source]
glyphSet()[source]
class fontTools.feaLib.ast.MarkLigPosStatement(ligatures, marks, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.MarkMarkPosStatement(baseMarks, marks, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.MultipleSubstStatement(prefix, glyph, suffix, replacement, forceChain=False, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.NameRecord(nameID, platformID, platEncID, langID, string, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.NestedBlock(tag, block_name, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.OS2Field(key, value, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.OrderedDict[source]

Dictionary that remembers insertion order

clear() → None. Remove all items from od.
copy() → a shallow copy of od
fromkeys()

Create a new ordered dictionary with keys from iterable and values set to value.

items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
move_to_end()

Move an existing element to the end (or beginning if last is false).

Raise KeyError if the element does not exist.

pop(k[, d]) → v, remove specified key and return the corresponding

value. If key is not found, d is returned if given, otherwise KeyError is raised.

popitem()

Remove and return a (key, value) pair from the dictionary.

Pairs are returned in LIFO order if last is true or FIFO order if false.

setdefault()

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) → None. Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() → an object providing a view on D's values
class fontTools.feaLib.ast.PairPosStatement(glyphs1, valuerecord1, glyphs2, valuerecord2, enumerated=False, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
exception fontTools.feaLib.ast.Py23Error[source]
class fontTools.feaLib.ast.ReverseChainSingleSubstStatement(old_prefix, old_suffix, glyphs, replacements, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.ScriptStatement(script, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.SimpleNamespace

A simple attribute-based namespace.

SimpleNamespace(**kwargs)

class fontTools.feaLib.ast.SinglePosStatement(pos, prefix, suffix, forceChain, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.SingleSubstStatement(glyphs, replace, prefix, suffix, forceChain, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.SizeParameters(DesignSize, SubfamilyID, RangeStart, RangeEnd, location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.Statement(location=None)[source]
class fontTools.feaLib.ast.StringIO

Text I/O implementation using an in-memory buffer.

The initial_value argument sets the value of object. The newline argument is like the one of TextIOWrapper’s constructor.

close()

Close the IO object.

Attempting any further operation after the object is closed will raise a ValueError.

This method has no effect if the file is already closed.

closed
getvalue()

Retrieve the entire contents of the object.

line_buffering
newlines

Line endings translated so far.

Only line endings translated during reading are considered.

Subclasses should override.

read()

Read at most size characters, returned as a string.

If the argument is negative or omitted, read until EOF is reached. Return an empty string at EOF.

readable()

Returns True if the IO object can be read.

readline()

Read until newline or EOF.

Returns an empty string if EOF is hit immediately.

seek()

Change stream position.

Seek to character offset pos relative to position indicated by whence:
0 Start of stream (the default). pos should be >= 0; 1 Current position - pos must be 0; 2 End of stream - pos must be 0.

Returns the new absolute position.

seekable()

Returns True if the IO object can be seeked.

tell()

Tell the current file position.

truncate()

Truncate size to pos.

The pos argument defaults to the current file position, as returned by tell(). The current file position is unchanged. Returns the new absolute position.

writable()

Returns True if the IO object can be written.

write()

Write string to file.

Returns the number of characters written, which is always equal to the length of the string.

class fontTools.feaLib.ast.SubtableStatement(location=None)[source]
asFea(indent='')[source]
build(builder)[source]
class fontTools.feaLib.ast.TableBlock(name, location=None)[source]
asFea(indent='')[source]
class fontTools.feaLib.ast.Tag[source]
tobytes()[source]
static transcode(blob)[source]
fontTools.feaLib.ast.UnicodeIO

alias of _io.StringIO

class fontTools.feaLib.ast.ValueRecord(xPlacement=None, yPlacement=None, xAdvance=None, yAdvance=None, xPlaDevice=None, yPlaDevice=None, xAdvDevice=None, yAdvDevice=None, vertical=False, location=None)[source]
asFea(indent='')[source]
class fontTools.feaLib.ast.ValueRecordDefinition(name, value, location=None)[source]
asFea(indent='')[source]
class fontTools.feaLib.ast.VheaField(key, value, location=None)[source]
asFea(indent='')[source]
build(builder)[source]

builder

class fontTools.feaLib.builder.AlternateSubstBuilder(font, location)[source]
add_subtable_break(location)[source]
build()[source]
equals(other)[source]
getAlternateGlyphs()[source]

Helper for building ‘aalt’ features.

class fontTools.feaLib.builder.Builder(font, featurefile)[source]
add_alternate_subst(location, prefix, glyph, suffix, replacement)[source]
add_attach_points(location, glyphs, contourPoints)[source]
add_chain_context_pos(location, prefix, glyphs, suffix, lookups)[source]
add_chain_context_subst(location, prefix, glyphs, suffix, lookups)[source]
add_class_pair_pos(location, glyphclass1, value1, glyphclass2, value2)[source]
add_cursive_pos(location, glyphclass, entryAnchor, exitAnchor)[source]
add_cv_character(character, tag)[source]
add_cv_parameter(tag)[source]
add_featureName(tag)[source]
add_feature_reference(location, featureName)[source]
add_glyphClassDef(location, baseGlyphs, ligatureGlyphs, markGlyphs, componentGlyphs)[source]
add_hhea_field(key, value)[source]
add_language_system(location, script, language)[source]
add_ligatureCaretByIndex_(location, glyphs, carets)[source]
add_ligatureCaretByPos_(location, glyphs, carets)[source]
add_ligature_subst(location, prefix, glyphs, suffix, replacement, forceChain)[source]
add_lookup_call(lookup_name)[source]
add_lookup_to_feature_(lookup, feature_name)[source]
add_mark_base_pos(location, bases, marks)[source]
add_mark_lig_pos(location, ligatures, components)[source]
add_mark_mark_pos(location, baseMarks, marks)[source]
add_marks_(location, lookupBuilder, marks)[source]

Helper for add_mark_{base,liga,mark}_pos.

add_multiple_subst(location, prefix, glyph, suffix, replacements, forceChain=False)[source]
add_name_record(location, nameID, platformID, platEncID, langID, string)[source]
add_os2_field(key, value)[source]
add_reverse_chain_single_subst(location, old_prefix, old_suffix, mapping)[source]
add_single_pos(location, prefix, suffix, pos, forceChain)[source]
add_single_pos_chained_(location, prefix, suffix, pos)[source]
add_single_subst(location, prefix, suffix, mapping, forceChain)[source]
add_single_subst_chained_(location, prefix, suffix, mapping)[source]
add_specific_pair_pos(location, glyph1, value1, glyph2, value2)[source]
add_subtable_break(location)[source]
add_to_cv_num_named_params(tag)[source]

Adds new items to self.cv_num_named_params_ or increments the count of existing items.

add_vhea_field(key, value)[source]
build(tables=None)[source]
buildBASE()[source]
buildBASEAxis(axis)[source]
buildFeatureParams(tag)[source]
buildGDEF()[source]
buildGDEFGlyphClassDef_()[source]
buildGDEFMarkAttachClassDef_()[source]
buildGDEFMarkGlyphSetsDef_()[source]
buildLookups_(tag)[source]
build_OS_2()[source]
build_codepages_(pages)[source]
build_feature_aalt_()[source]
build_head()[source]
build_hhea()[source]
build_name()[source]
build_vhea()[source]
end_feature()[source]
end_lookup_block()[source]
find_lookup_builders_(lookups)[source]

Helper for building chain contextual substitutions

Given a list of lookup names, finds the LookupBuilder for each name. If an input name is None, it gets mapped to a None LookupBuilder.

getMarkAttachClass_(location, glyphs)[source]
getMarkFilterSet_(location, glyphs)[source]
get_chained_lookup_(location, builder_class)[source]
get_default_language_systems_()[source]
get_lookup_(location, builder_class)[source]
get_user_name_id(table)[source]
makeTable(tag)[source]
setGlyphClass_(location, glyph, glyphClass)[source]
set_base_axis(bases, scripts, vertical)[source]
set_font_revision(location, revision)[source]
set_language(location, language, include_default, required)[source]
set_lookup_flag(location, value, markAttach, markFilter)[source]
set_script(location, script)[source]
set_size_parameters(location, DesignSize, SubfamilyID, RangeStart, RangeEnd)[source]
start_feature(location, name)[source]
start_lookup_block(location, name)[source]
supportedTables = frozenset({'BASE', 'name', 'head', 'GSUB', 'vhea', 'GPOS', 'OS/2', 'GDEF', 'hhea'})
class fontTools.feaLib.builder.ChainContextPosBuilder(font, location)[source]
add_subtable_break(location)[source]
build()[source]
equals(other)[source]
find_chainable_single_pos(lookups, glyphs, value)[source]

Helper for add_single_pos_chained_()

class fontTools.feaLib.builder.ChainContextSubstBuilder(font, location)[source]
add_subtable_break(location)[source]
build()[source]
equals(other)[source]
find_chainable_single_subst(glyphs)[source]

Helper for add_single_subst_chained_()

getAlternateGlyphs()[source]

Helper for building ‘aalt’ features.

class fontTools.feaLib.builder.ClassPairPosSubtableBuilder(builder, valueFormat1, valueFormat2)[source]
addPair(gc1, value1, gc2, value2)[source]
addSubtableBreak()[source]
flush_()[source]
subtables()[source]
class fontTools.feaLib.builder.CursivePosBuilder(font, location)[source]
add_attachment(location, glyphs, entryAnchor, exitAnchor)[source]
build()[source]
equals(other)[source]
class fontTools.feaLib.builder.LigatureSubstBuilder(font, location)[source]
add_subtable_break(location)[source]
build()[source]
equals(other)[source]
class fontTools.feaLib.builder.LookupBuilder(font, location, table, lookup_type)[source]
SUBTABLE_BREAK_ = 'SUBTABLE_BREAK'
add_subtable_break(location)[source]
buildLookup_(subtables)[source]
buildMarkClasses_(marks)[source]

{“cedilla”: (“BOTTOM”, ast.Anchor), …} –> {“BOTTOM”:0, “TOP”:1}

Helper for MarkBasePostBuilder, MarkLigPosBuilder, and MarkMarkPosBuilder. Seems to return the same numeric IDs for mark classes as the AFDKO makeotf tool.

build_subst_subtables(mapping, klass)[source]
equals(other)[source]
getAlternateGlyphs()[source]

Helper for building ‘aalt’ features.

inferGlyphClasses()[source]

Infers glyph glasses for the GDEF table, such as {“cedilla”:3}.

setBacktrackCoverage_(prefix, subtable)[source]
setInputCoverage_(glyphs, subtable)[source]
setLookAheadCoverage_(suffix, subtable)[source]
class fontTools.feaLib.builder.MarkBasePosBuilder(font, location)[source]
build()[source]
equals(other)[source]
inferGlyphClasses()[source]

Infers glyph glasses for the GDEF table, such as {“cedilla”:3}.

class fontTools.feaLib.builder.MarkLigPosBuilder(font, location)[source]
build()[source]
equals(other)[source]
inferGlyphClasses()[source]

Infers glyph glasses for the GDEF table, such as {“cedilla”:3}.

class fontTools.feaLib.builder.MarkMarkPosBuilder(font, location)[source]
build()[source]
equals(other)[source]
inferGlyphClasses()[source]

Infers glyph glasses for the GDEF table, such as {“cedilla”:3}.

class fontTools.feaLib.builder.MultipleSubstBuilder(font, location)[source]
add_subtable_break(location)[source]
build()[source]
equals(other)[source]
class fontTools.feaLib.builder.PairPosBuilder(font, location)[source]
addClassPair(location, glyphclass1, value1, glyphclass2, value2)[source]
addGlyphPair(location, glyph1, value1, glyph2, value2)[source]
add_subtable_break(location)[source]
build()[source]
equals(other)[source]
class fontTools.feaLib.builder.ReverseChainSingleSubstBuilder(font, location)[source]
add_subtable_break(location)[source]
build()[source]
equals(other)[source]
class fontTools.feaLib.builder.SinglePosBuilder(font, location)[source]
add_pos(location, glyph, valueRecord)[source]
build()[source]
can_add(glyph, value)[source]
equals(other)[source]
class fontTools.feaLib.builder.SingleSubstBuilder(font, location)[source]
add_subtable_break(location)[source]
build()[source]
equals(other)[source]
getAlternateGlyphs()[source]

Helper for building ‘aalt’ features.

fontTools.feaLib.builder.addOpenTypeFeatures(font, featurefile, tables=None)[source]
fontTools.feaLib.builder.addOpenTypeFeaturesFromString(font, features, filename=None, tables=None)[source]
fontTools.feaLib.builder.makeOpenTypeAnchor(anchor)[source]

ast.Anchor –> otTables.Anchor

fontTools.feaLib.builder.makeOpenTypeValueRecord(v, pairPosContext)[source]

ast.ValueRecord –> (otBase.ValueRecord, int ValueFormat)

error

class fontTools.feaLib.parser.Parser(featurefile, glyphNames=(), followIncludes=True, **kwargs)[source]
CV_FEATURE_TAGS = {'cv01', 'cv02', 'cv03', 'cv04', 'cv05', 'cv06', 'cv07', 'cv08', 'cv09', 'cv10', 'cv11', 'cv12', 'cv13', 'cv14', 'cv15', 'cv16', 'cv17', 'cv18', 'cv19', 'cv20', 'cv21', 'cv22', 'cv23', 'cv24', 'cv25', 'cv26', 'cv27', 'cv28', 'cv29', 'cv30', 'cv31', 'cv32', 'cv33', 'cv34', 'cv35', 'cv36', 'cv37', 'cv38', 'cv39', 'cv40', 'cv41', 'cv42', 'cv43', 'cv44', 'cv45', 'cv46', 'cv47', 'cv48', 'cv49', 'cv50', 'cv51', 'cv52', 'cv53', 'cv54', 'cv55', 'cv56', 'cv57', 'cv58', 'cv59', 'cv60', 'cv61', 'cv62', 'cv63', 'cv64', 'cv65', 'cv66', 'cv67', 'cv68', 'cv69', 'cv70', 'cv71', 'cv72', 'cv73', 'cv74', 'cv75', 'cv76', 'cv77', 'cv78', 'cv79', 'cv80', 'cv81', 'cv82', 'cv83', 'cv84', 'cv85', 'cv86', 'cv87', 'cv88', 'cv89', 'cv90', 'cv91', 'cv92', 'cv93', 'cv94', 'cv95', 'cv96', 'cv97', 'cv98', 'cv99'}
SS_FEATURE_TAGS = {'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'ss07', 'ss08', 'ss09', 'ss10', 'ss11', 'ss12', 'ss13', 'ss14', 'ss15', 'ss16', 'ss17', 'ss18', 'ss19', 'ss20'}
advance_lexer_(comments=False)[source]
ast = <module 'fontTools.feaLib.ast' from '/build/fonttools-eQQ8BD/fonttools-4.5.0/Doc/source/../../Lib/fontTools/feaLib/ast.py'>
check_glyph_name_in_glyph_set(*names)[source]

Raises if glyph name (just start) or glyph names of a range (start and end) are not in the glyph set.

If no glyph set is present, does nothing.

expect_any_number_()[source]
expect_cid_()[source]
expect_class_name_()[source]
expect_decipoint_()[source]
expect_filename_()[source]
expect_float_()[source]
expect_glyph_()[source]
expect_keyword_(keyword)[source]
expect_language_tag_()[source]
expect_markClass_reference_()[source]
expect_name_()[source]
expect_number_()[source]
expect_script_tag_()[source]
expect_string_()[source]
expect_symbol_(symbol)[source]
expect_tag_()[source]
extensions = {}
is_cur_keyword_(k)[source]
is_next_value_()[source]
make_cid_range_(location, start, limit)[source]

(location, 999, 1001) –> [“cid00999”, “cid01000”, “cid01001”]

make_glyph_range_(location, start, limit)[source]

(location, “a.sc”, “d.sc”) –> [“a.sc”, “b.sc”, “c.sc”, “d.sc”]

parse()[source]
parse_FontRevision_()[source]
parse_GlyphClassDef_()[source]

Parses ‘GlyphClassDef @BASE, @LIGATURES, @MARKS, @COMPONENTS;’

parse_anchor_()[source]
parse_anchor_marks_()[source]

Parses a sequence of [<anchor> mark @MARKCLASS]*.

parse_anchordef_()[source]
parse_anonymous_()[source]
parse_attach_()[source]
parse_base_script_list_(count)[source]
parse_base_script_record_(count)[source]
parse_base_tag_list_()[source]
parse_block_(block, vertical, stylisticset=None, size_feature=False, cv_feature=None)[source]
parse_chain_context_()[source]
parse_class_name_()[source]
parse_cvCharacter_(tag)[source]
parse_cvNameIDs_(tag, block_name)[source]
parse_cvParameters_(tag)[source]
parse_device_()[source]
parse_enumerate_(vertical)[source]
parse_featureNames_(tag)[source]
parse_feature_block_()[source]
parse_feature_reference_()[source]
parse_glyph_pattern_(vertical)[source]
parse_glyphclass_(accept_glyphname)[source]
parse_glyphclass_definition_()[source]

Parses glyph class definitions such as @UPPERCASE = [A-Z];’

parse_ignore_()[source]
parse_include_()[source]
parse_language_()[source]
parse_languagesystem_()[source]
parse_ligatureCaretByIndex_()[source]
parse_ligatureCaretByPos_()[source]
parse_lookup_(vertical)[source]
parse_lookupflag_()[source]
parse_markClass_()[source]
parse_name_()[source]
parse_nameid_()[source]
parse_position_(enumerated, vertical)[source]
parse_position_base_(enumerated, vertical)[source]
parse_position_cursive_(enumerated, vertical)[source]
parse_position_ligature_(enumerated, vertical)[source]
parse_position_mark_(enumerated, vertical)[source]
parse_script_()[source]
parse_size_menuname_()[source]
parse_size_parameters_()[source]
parse_substitute_()[source]
parse_subtable_()[source]
parse_table_()[source]
parse_table_BASE_(table)[source]
parse_table_GDEF_(table)[source]
parse_table_OS_2_(table)[source]
parse_table_head_(table)[source]
parse_table_hhea_(table)[source]
parse_table_name_(table)[source]
parse_table_vhea_(table)[source]
parse_valuerecord_(vertical)[source]
parse_valuerecord_definition_(vertical)[source]
static reverse_string_(s)[source]

‘abc’ –> ‘cba’

split_glyph_range_(name, location)[source]
static unescape_byte_(match, encoding)[source]
unescape_string_(string, encoding)[source]
static unescape_unichr_(match)[source]
class fontTools.feaLib.parser.SymbolTable[source]
define(name, item)[source]
enter_scope()[source]
exit_scope()[source]
resolve(name)[source]

lexer

class fontTools.feaLib.lexer.IncludingLexer(featurefile)[source]
static make_lexer_(file_or_path)[source]
next()[source]
scan_anonymous_block(tag)[source]
class fontTools.feaLib.lexer.Lexer(text, filename)[source]
ANONYMOUS_BLOCK = 'ANONYMOUS_BLOCK'
CHAR_DIGIT_ = '0123456789'
CHAR_HEXDIGIT_ = '0123456789ABCDEFabcdef'
CHAR_LETTER_ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
CHAR_NAME_CONTINUATION_ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.+*:^~!/-'
CHAR_NAME_START_ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_+*:.^~!\\'
CHAR_NEWLINE_ = '\r\n'
CHAR_SYMBOL_ = ",;:-+'{}[]<>()="
CHAR_WHITESPACE_ = ' \t'
CID = 'CID'
COMMENT = 'COMMENT'
FILENAME = 'FILENAME'
FLOAT = 'FLOAT'
GLYPHCLASS = 'GLYPHCLASS'
HEXADECIMAL = 'HEXADECIMAL'
MODE_FILENAME_ = 'FILENAME'
MODE_NORMAL_ = 'NORMAL'
NAME = 'NAME'
NEWLINE = 'NEWLINE'
NUMBER = 'NUMBER'
NUMBERS = ('NUMBER', 'HEXADECIMAL', 'OCTAL')
OCTAL = 'OCTAL'
RE_GLYPHCLASS = re.compile('^[A-Za-z_0-9.\\-]+$')
STRING = 'STRING'
SYMBOL = 'SYMBOL'
location_()[source]
next()[source]
next_()[source]
scan_anonymous_block(tag)[source]
scan_over_(valid)[source]
scan_until_(stop_at)[source]
class fontTools.feaLib.lexer.NonIncludingLexer(featurefile)[source]

Lexer that does not follow include statements, emits them as-is.

parser

class fontTools.feaLib.parser.Parser(featurefile, glyphNames=(), followIncludes=True, **kwargs)[source]
CV_FEATURE_TAGS = {'cv01', 'cv02', 'cv03', 'cv04', 'cv05', 'cv06', 'cv07', 'cv08', 'cv09', 'cv10', 'cv11', 'cv12', 'cv13', 'cv14', 'cv15', 'cv16', 'cv17', 'cv18', 'cv19', 'cv20', 'cv21', 'cv22', 'cv23', 'cv24', 'cv25', 'cv26', 'cv27', 'cv28', 'cv29', 'cv30', 'cv31', 'cv32', 'cv33', 'cv34', 'cv35', 'cv36', 'cv37', 'cv38', 'cv39', 'cv40', 'cv41', 'cv42', 'cv43', 'cv44', 'cv45', 'cv46', 'cv47', 'cv48', 'cv49', 'cv50', 'cv51', 'cv52', 'cv53', 'cv54', 'cv55', 'cv56', 'cv57', 'cv58', 'cv59', 'cv60', 'cv61', 'cv62', 'cv63', 'cv64', 'cv65', 'cv66', 'cv67', 'cv68', 'cv69', 'cv70', 'cv71', 'cv72', 'cv73', 'cv74', 'cv75', 'cv76', 'cv77', 'cv78', 'cv79', 'cv80', 'cv81', 'cv82', 'cv83', 'cv84', 'cv85', 'cv86', 'cv87', 'cv88', 'cv89', 'cv90', 'cv91', 'cv92', 'cv93', 'cv94', 'cv95', 'cv96', 'cv97', 'cv98', 'cv99'}
SS_FEATURE_TAGS = {'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'ss07', 'ss08', 'ss09', 'ss10', 'ss11', 'ss12', 'ss13', 'ss14', 'ss15', 'ss16', 'ss17', 'ss18', 'ss19', 'ss20'}
advance_lexer_(comments=False)[source]
ast = <module 'fontTools.feaLib.ast' from '/build/fonttools-eQQ8BD/fonttools-4.5.0/Doc/source/../../Lib/fontTools/feaLib/ast.py'>
check_glyph_name_in_glyph_set(*names)[source]

Raises if glyph name (just start) or glyph names of a range (start and end) are not in the glyph set.

If no glyph set is present, does nothing.

expect_any_number_()[source]
expect_cid_()[source]
expect_class_name_()[source]
expect_decipoint_()[source]
expect_filename_()[source]
expect_float_()[source]
expect_glyph_()[source]
expect_keyword_(keyword)[source]
expect_language_tag_()[source]
expect_markClass_reference_()[source]
expect_name_()[source]
expect_number_()[source]
expect_script_tag_()[source]
expect_string_()[source]
expect_symbol_(symbol)[source]
expect_tag_()[source]
extensions = {}
is_cur_keyword_(k)[source]
is_next_value_()[source]
make_cid_range_(location, start, limit)[source]

(location, 999, 1001) –> [“cid00999”, “cid01000”, “cid01001”]

make_glyph_range_(location, start, limit)[source]

(location, “a.sc”, “d.sc”) –> [“a.sc”, “b.sc”, “c.sc”, “d.sc”]

parse()[source]
parse_FontRevision_()[source]
parse_GlyphClassDef_()[source]

Parses ‘GlyphClassDef @BASE, @LIGATURES, @MARKS, @COMPONENTS;’

parse_anchor_()[source]
parse_anchor_marks_()[source]

Parses a sequence of [<anchor> mark @MARKCLASS]*.

parse_anchordef_()[source]
parse_anonymous_()[source]
parse_attach_()[source]
parse_base_script_list_(count)[source]
parse_base_script_record_(count)[source]
parse_base_tag_list_()[source]
parse_block_(block, vertical, stylisticset=None, size_feature=False, cv_feature=None)[source]
parse_chain_context_()[source]
parse_class_name_()[source]
parse_cvCharacter_(tag)[source]
parse_cvNameIDs_(tag, block_name)[source]
parse_cvParameters_(tag)[source]
parse_device_()[source]
parse_enumerate_(vertical)[source]
parse_featureNames_(tag)[source]
parse_feature_block_()[source]
parse_feature_reference_()[source]
parse_glyph_pattern_(vertical)[source]
parse_glyphclass_(accept_glyphname)[source]
parse_glyphclass_definition_()[source]

Parses glyph class definitions such as @UPPERCASE = [A-Z];’

parse_ignore_()[source]
parse_include_()[source]
parse_language_()[source]
parse_languagesystem_()[source]
parse_ligatureCaretByIndex_()[source]
parse_ligatureCaretByPos_()[source]
parse_lookup_(vertical)[source]
parse_lookupflag_()[source]
parse_markClass_()[source]
parse_name_()[source]
parse_nameid_()[source]
parse_position_(enumerated, vertical)[source]
parse_position_base_(enumerated, vertical)[source]
parse_position_cursive_(enumerated, vertical)[source]
parse_position_ligature_(enumerated, vertical)[source]
parse_position_mark_(enumerated, vertical)[source]
parse_script_()[source]
parse_size_menuname_()[source]
parse_size_parameters_()[source]
parse_substitute_()[source]
parse_subtable_()[source]
parse_table_()[source]
parse_table_BASE_(table)[source]
parse_table_GDEF_(table)[source]
parse_table_OS_2_(table)[source]
parse_table_head_(table)[source]
parse_table_hhea_(table)[source]
parse_table_name_(table)[source]
parse_table_vhea_(table)[source]
parse_valuerecord_(vertical)[source]
parse_valuerecord_definition_(vertical)[source]
static reverse_string_(s)[source]

‘abc’ –> ‘cba’

split_glyph_range_(name, location)[source]
static unescape_byte_(match, encoding)[source]
unescape_string_(string, encoding)[source]
static unescape_unichr_(match)[source]
class fontTools.feaLib.parser.SymbolTable[source]
define(name, item)[source]
enter_scope()[source]
exit_scope()[source]
resolve(name)[source]