to use the bisect built-in module we need to have two separate
tables, one with the ranges themselves (which we pass to bisect
to get an index) and the other containing the script name for
each range.
Also, allow the buildUCD.py script to load data files from a
local directory, e.g. to allow downstream maintainers to rebuild
the generated modules from local files instead of downloading
from Unicode website.
The new `fontTools.unicodedata` module re-exports all the public
functions from the built-in `unicodedata` module, and also adds
additional functions.
The `script` function takes a unicode character and returns the
script name as defined in the UCD "Script.txt" data file.
It's implemented as a simple binary search, plus a memoizing
decorator that caches the results to avoid search the same
character more than once.
The unicodedata2 backport is imported if present, otherwise
the unicodedata built-in is used.
The script currently only parses the Scripts.txt file and
generates a new python module `fontTools.unicodedata.scripts`
containing a `SCRIPT_RANGES` list of tuples, each containing
the range and the corresponding script name.
... instead of a glyphMap dict.
The parser does not actually need a reverse glyph order mapping as
it is not interested in knowing the glyphID from the glyph name,
but only whether a glyph is in the font or not.
This makes it easier for client code (e.g. ufo2ft feature compiler)
to use the feaLib Parser, without having to first construct and pass
it a glyphMap argument.
Right now just reflects the axes, and even that with certain limitations:
- AxisOrdering is set to the order axes are defined,
- Name-table entries are not shared with fvar.
Towards https://github.com/LettError/designSpaceDocument/issues/8
In OT kern subtable header, the format is the high byte of 'coverage'
bit mask (bits 8-15), and the low byte (bits 0-7) is the actual coverage
bits.
In AAT kern, it's the opposite: the coverage flags are the high byte,
whereas the subtable format is the low byte.
Also adjusted the test data, and set coverage to 1 for OT kern subtable
(which means the usual horizontal kerning).