googlefonts / fontelemetry

A library and toolset for typeface software development reporting
Apache License 2.0
2 stars 3 forks source link

Pull glyph free text from UFO source files #3

Open chrissimpkins opened 5 years ago

chrissimpkins commented 5 years ago

Free text strings can be stored in UFO source at the glyph level. These are used to annotate Unicode code positions by design teams for documentation to self and to others in collaborative project workflows.

These data are maintained in UFO source *.glif files with the following format (free text entered on this glyph is "this is a note"):

<?xml version='1.0' encoding='UTF-8'?>
<glyph name="A" format="2">
    <advance width="668"/>
    <unicode hex="0041"/>
    <note>
This is a note
     </note>
</glyph>

The UFO 3 spec for the note field of the *.glif file is located at http://unifiedfontobject.org/versions/ufo3/glyphs/glif/#note. There is no specified structure or encoding requirements for the field in UFO 3 source.

TODO:

chrissimpkins commented 5 years ago

Added Python script with example of glyph-specific data reads using fontTools.ufoLib.glifLib library in

https://github.com/inkwork/gs-proposal/blob/master/src/python/ufo-glyphdata-pull.py

The note free text that is entered in the editor is parsed to a Py3 Unicode str or None if it is not present on the glyph