7.5 KiB
Pysilfont example scripts
In addition to the main pysilfont scripts, there are many further scripts under pysilfont/examples and its sub-directories.
They are not maintained in the same way as the main scripts, and come in many categories including:
- Scripts under development
- Examples of how to do things
- Deprecated scripts
- Left-overs from previous development plans!
Note - all FontForge-based scripts need updating, since FontForge (as "FF") is no longer a supported tool for execute()
Some are documented below.
Table of scripts
Command | Status | Description |
---|---|---|
accesslibplist.py | ? | Demo script for accessing fields in lib.plist |
chaindemo.py | ? | Demo of how to chain calls to multiple scripts together |
ffchangeglyphnames | ? | Update glyph names in a ttf font based on csv file |
ffcopyglyphs | ? | Copy glyphs from one font to another, without using ffbuilder |
ffremovealloverlaps | ? | Remove overlap on all glyphs in a ttf font |
FFmapGdlNames.py | ? | Write mapping of graphite names to new graphite names |
FFmapGdlNames2.py | ? | Write mapping of graphite names to new graphite names |
FLWriteXml.py | ? | Outputs attachment point information and notes as XML file for TTFBuilder |
FTaddEmptyOT.py | ? | Add empty Opentype tables to ttf font |
FTMLnorm.py | ? | Normalize an FTML file |
psfaddGlyphDemo.py | ? | Demo script to add a glyph to a UFO font |
psfexpandstroke.py | ? | Expands an unclosed UFO stroke font into monoline forms with a fixed width |
psfexportnamesunicodesfp.py | ? | Outputs an unsorted csv file containing the names of all the glyphs in the default layer |
psfgenftml.py | ? | generate ftml tests from glyph_data.csv and UFO |
psftoneletters.py | ? | Creates Latin script tone letters (pitch contours) |
xmlDemo.py | ? | Demo script for use of ETWriter |
accesslibplist
Usage: python accesslibplist.py ...
(Standard options may also apply)
Demo script for accessing fields in lib.plist
chaindemo
Usage: python chaindemo.py ...
(Standard options also apply)
Demo of how to chain calls to multiple scripts together. Running
python chaindemo.py infont outfont --featfile feat.csv --uidsfile uids.csv
will run execute() against psfnormalize, psfsetassocfeat and psfsetassocuids passing the font, parameters and logger objects from one call to the next. So:
- the font is only opened once and written once
- there is a single log file produced
ffchangeglyphnames
Usage: ffchangeglyphnames [-i INPUT] [--reverse] ifont [ofont]
(Standard options also apply)
Update the glyph names in a ttf font based on csv file.
Example usage:
ffchangeglyphnames -i glyphmap.csv font.ttf
will update the glyph names in the font based on mapping file glyphmap.csv
If --reverse is used, it change names in reverse.
ffcopyglyphs
Usage: ffcopyglyphs -i INPUT [-r RANGE] [--rangefile RANGEFILE] [-n NAME] [--namefile NAMEFILE] [-a] [-f] [-s SCALE] ifont [ofont]
(Standard options also apply)
This section is Work In Progress!
optional arguments:
-h, --help show this help message and exit
-i INPUT, --input INPUT
Font to get glyphs from
-r RANGE, --range RANGE
StartUnicode..EndUnicode no spaces, e.g. 20..7E
--rangefile RANGEFILE
File with USVs e.g. 20 or a range e.g. 20..7E or both
-n NAME, --name NAME Include glyph named name
--namefile NAMEFILE File with glyph names
-a, --anchors Copy across anchor points
-f, --force Overwrite existing glyphs in the font
-s SCALE, --scale SCALE
Scale glyphs by this factor
ffremovealloverlaps
Usage: ffremovealloverlaps ifont [ofont]
(Standard options also apply)
Remove overlap on all glyphs in a ttf font
FFmapGdlNames
Usage: python FFmapGdlNames2.py ...
(Standard options may also apply)
Write mapping of graphite names to new graphite names based on:
- two ttf files
- the gdl files produced by makeGdl run against those fonts This could be different versions of makeGdl
- a csv mapping glyph names used in original ttf to those in the new font
FFmapGdlNames2
Usage: python FFmapGdlNames.py ...
(Standard options may also apply)
Write mapping of graphite names to new graphite names based on:
- an original ttf font
- the gdl file produced by makeGdl when original font was produced
- a csv mapping glyph names used in original ttf to those in the new font
- pysilfont's gdl library - so assumes pysilfonts makeGdl will be used with new font
FLWriteXml
Usage: python FLWriteXml.py ...
(Standard options may also apply)
Outputs attachment point information and notes as XML file for TTFBuilder
FTaddEmptyOT
Usage: python FTaddEmptyOT.py ...
(Standard options may also apply)
Add empty Opentype tables to ttf font
FTMLnorm
Usage: python FTMLnorm.py ...
(Standard options may also apply)
Normalize an FTML file
psfaddGlyphDemo
Usage: python psfaddGlyphDemo.py ...
(Standard options may also apply)
Demo script to add a glyph to a UFO font
psfexpandstroke
Usage: psfexpandstroke infont outfont expansion
(Standard options also apply)
Expands the outlines (typically unclosed) in an UFO stroke font into monoline forms with a fixed width.
Example that expands the stokes in a UFO font SevdaStrokeMaster-Regular.ufo
by 13 units on both sides, giving them a total width of 26 units, and writes the result to Sevda-Regular.ufo
.
psfexpandstroke SevdaStrokeMaster-Regular.ufo Sevda-Regular.ufo 13
Note that this only expands the outlines - it does not remove any resulting overlap.
psfexportnamesunicodesfp
Usage: python psfexportnamesunicodesfp.py ...
(Standard options may also apply)
Outputs an unsorted csv file containing the names of all the glyphs in the default layer and their primary unicode values.
Format name,usv
psfgenftml
Usage: python psfgenftml.py ...
(Standard options may also apply)
generate ftml tests from glyph_data.csv and UFO
psftoneletters
Usage: psftoneletters infont outfont
(Standard options also apply)
This uses the parameters from the UFO lib.plist org.sil.lcg.toneLetters key to create Latin script tone letters (pitch contours).
Example usage:
psftoneletters Andika-Regular.ufo Andika-Regular.ufo
xmlDemo
Usage: python xmlDemo.py ...
(Standard options may also apply)
Demo script for use of ETWriter