- python 2 or 3
- python package
FontTools
v >= 3.25.0
pip install pip install fonttools
Each character is described as a glyph which is further described by a set of closed contours. And each contour is defined by a set of points.
Each point has three attributes: the x-axis location, the y-axis location and the condition of bezier curve: on
or off
.
details see font_utils.py
- DONE
decode
: given a ttf or otf format TrueType - STILL IN development
normalize
: normalize the EM square - STILL IN development
render
: render a glyph - STILL IN development
glyph
: store a glyph in local file system
For the character with unicode 304f, look up the glyp table of the font (In our case, we use 'FZS3JW.TTF' provided in the src/
as an example and test case),
We could see the output of our extracted data as:
It shows that we successfully extracted the correct data.
Interesting readers about how the TrueType format could refer to
- An Introduction to TrueType Fonts: A look inside the TTF format
- and An introduction to glyphs, as used and defined in the FreeType engine:
for the details of how glyphs are represented and rendered in our machines.