From 52298f273cca93bff050806b6db6f13ebbc2bd5d Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Sun, 3 May 2020 22:53:28 +0100 Subject: [PATCH] [docs] Update buildTableList to write documentation into ttx.rst Have to do this a little bit differently because of the way that RtD handles comments/code blocks. --- Doc/source/ttx.rst | 14 +++++++++----- MetaTools/buildTableList.py | 7 ++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Doc/source/ttx.rst b/Doc/source/ttx.rst index 15b3c25bb..d672bfc80 100644 --- a/Doc/source/ttx.rst +++ b/Doc/source/ttx.rst @@ -31,16 +31,20 @@ When using TTX from the command line there are a bunch of extra options. These a The TTX file format ^^^^^^^^^^^^^^^^^^^ +.. begin table list + The following tables are currently supported:: BASE, CBDT, CBLC, CFF, CFF2, COLR, CPAL, DSIG, EBDT, EBLC, FFTM, Feat, GDEF, GMAP, GPKG, GPOS, GSUB, Glat, Gloc, HVAR, JSTF, LTSH, MATH, META, MVAR, OS/2, SING, STAT, SVG, Silf, Sill, TSI0, TSI1, - TSI2, TSI3, TSI5, TSIB, TSID, TSIJ, TSIP, TSIS, TSIV, TTFA, VDMX, - VORG, VVAR, ankr, avar, bsln, cidg, cmap, cvar, cvt, feat, fpgm, - fvar, gasp, gcid, glyf, gvar, hdmx, head, hhea, hmtx, kern, lcar, - loca, ltag, maxp, meta, mort, morx, name, opbd, post, prep, prop, - sbix, trak, vhea and vmtx + TSI2, TSI3, TSI5, TSIB, TSIC, TSID, TSIJ, TSIP, TSIS, TSIV, TTFA, + VDMX, VORG, VVAR, ankr, avar, bsln, cidg, cmap, cvar, cvt, feat, + fpgm, fvar, gasp, gcid, glyf, gvar, hdmx, head, hhea, hmtx, kern, + lcar, loca, ltag, maxp, meta, mort, morx, name, opbd, post, prep, + prop, sbix, trak, vhea and vmtx + +.. end table list Other tables are dumped as hexadecimal data. diff --git a/MetaTools/buildTableList.py b/MetaTools/buildTableList.py index 825f0db1a..36b9fa0a0 100755 --- a/MetaTools/buildTableList.py +++ b/MetaTools/buildTableList.py @@ -11,7 +11,7 @@ fontToolsDir = os.path.dirname(os.path.dirname(os.path.join(os.getcwd(), sys.arg fontToolsDir= os.path.normpath(fontToolsDir) tablesDir = os.path.join(fontToolsDir, "Lib", "fontTools", "ttLib", "tables") -docFile = os.path.join(fontToolsDir, "README.rst") +docFile = os.path.join(fontToolsDir, "Doc/source/ttx.rst") names = glob.glob1(tablesDir, "*.py") @@ -54,7 +54,7 @@ if __name__ == "__main__": ''') -begin = ".. begin table list\n.. code::\n" +begin = ".. begin table list\n" end = ".. end table list" with open(docFile) as f: doc = f.read() @@ -64,9 +64,10 @@ beginPos = beginPos + len(begin) + 1 endPos = doc.find(end) lines = textwrap.wrap(", ".join(tables[:-1]) + " and " + tables[-1], 66) +intro = "The following tables are currently supported::\n\n" blockquote = "\n".join(" "*4 + line for line in lines) + "\n" -doc = doc[:beginPos] + blockquote + doc[endPos:] +doc = doc[:beginPos] + intro + blockquote + "\n" + doc[endPos:] with open(docFile, "w") as f: f.write(doc)