simon-git: gonville (master): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sat Feb 22 15:06:34 GMT 2020
TL;DR:
5ab212d Migrate the Python scripts to Python 3.
747b020 Refactor the FontForge-running code.
39d5ce5 Switch argument handling to Python argparse.
3b6f5ee Use a container class to keep glyphs in.
7c92f86 Move font definitions out into their own file.
6d76db7 Get rid of the qc() function.
7ee318e Stop invoking subcommands in shell syntax.
29f799d Suppress all Fontforge banners.
8ab394a Add workaround script for LILYPOND_DATADIR bug.
0002304 Add workaround tool for SVG scientific-notation bug.
11e7650 Build the demo images as SVG as well as PNG.
68ae634 Parallelise all the slow gs/potrace runs.
Repository: https://git.tartarus.org/simon/gonville.git
On the web: https://git.tartarus.org/?p=simon/gonville.git
Branch updated: master
Committer: Simon Tatham <anakin at pobox.com>
Date: 2020-02-22 15:06:34
commit 5ab212db3b55898dc8629b98387d670d56536e13
web diff https://git.tartarus.org/?p=simon/gonville.git;a=commitdiff;h=5ab212db3b55898dc8629b98387d670d56536e13;hp=177659ad9da1090474da9d507b8c213d63505c9a
Author: Simon Tatham <anakin at pobox.com>
Date: Wed Feb 19 22:30:52 2020 +0000
Migrate the Python scripts to Python 3.
I came back to this project to try to solve a particular problem, and
the first thing I noticed is that all the Python is now written in an
obsolete language. So fixing that is the first order of business.
.gitignore | 2 +-
curves.py | 13 +++---
glyphs.py | 134 +++++++++++++++++++++++++++++--------------------------------
gui.py | 22 +++++-----
4 files changed, 83 insertions(+), 88 deletions(-)
commit 747b020e0c61d2d6f863c5ce6b63ecd5c480e2de
web diff https://git.tartarus.org/?p=simon/gonville.git;a=commitdiff;h=747b020e0c61d2d6f863c5ce6b63ecd5c480e2de;hp=5ab212db3b55898dc8629b98387d670d56536e13
Author: Simon Tatham <anakin at pobox.com>
Date: Thu Feb 20 06:56:53 2020 +0000
Refactor the FontForge-running code.
It was so ugly I had no chance of editing it correctly.
glyphs.py | 65 ++++++++++++++++++++++++++-------------------------------------
1 file changed, 27 insertions(+), 38 deletions(-)
commit 39d5ce56b3cb94ee339311937d8ea13f4057bc96
web diff https://git.tartarus.org/?p=simon/gonville.git;a=commitdiff;h=39d5ce56b3cb94ee339311937d8ea13f4057bc96;hp=747b020e0c61d2d6f863c5ce6b63ecd5c480e2de
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 22 11:47:33 2020 +0000
Switch argument handling to Python argparse.
The previous argument handling was ad-hoc, order-dependent,
inconsistent in its double and single dashes, badly error checked, and
had no online help.
Now each main piece of output code is in its own function, and there's
a main() with centralised argparse-based argument parsing that decides
which one to call.
Buildscr | 2 +-
glyphs.py | 115 ++++++++++++++++++++++++++++++++++++++++++++++----------------
2 files changed, 87 insertions(+), 30 deletions(-)
commit 3b6f5eee05fbbfeda84c2c89c53270f59ddf3987
web diff https://git.tartarus.org/?p=simon/gonville.git;a=commitdiff;h=3b6f5eee05fbbfeda84c2c89c53270f59ddf3987;hp=39d5ce56b3cb94ee339311937d8ea13f4057bc96
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 22 12:11:48 2020 +0000
Use a container class to keep glyphs in.
This removes a lot of ugly calls to eval() which were only there to
translate glyph name strings into the GlyphContext objects, and one
even nastier exec() which wrote new ones into the global namespace.
glyphs.py | 740 ++++++++++++++++++++++++++++++++------------------------------
1 file changed, 379 insertions(+), 361 deletions(-)
commit 7c92f86724f1200362ddaf97243d36e13104705a
web diff https://git.tartarus.org/?p=simon/gonville.git;a=commitdiff;h=7c92f86724f1200362ddaf97243d36e13104705a;hp=3b6f5eee05fbbfeda84c2c89c53270f59ddf3987
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 22 12:26:42 2020 +0000
Move font definitions out into their own file.
Now glyphs.py is just the main program that deals with rendering the
font into various output formats, and the actual _font design_ lives
in font.py. This also means a lot of stray global variables used
during glyph setup won't be left in the global namespace for the
output code.
font.py | 4127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
glyphs.py | 4130 +------------------------------------------------------------
2 files changed, 4128 insertions(+), 4129 deletions(-)
commit 6d76db77a74de01f09220cf7e84b62a677530e09
web diff https://git.tartarus.org/?p=simon/gonville.git;a=commitdiff;h=6d76db77a74de01f09220cf7e84b62a677530e09;hp=7c92f86724f1200362ddaf97243d36e13104705a
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 22 13:17:09 2020 +0000
Get rid of the qc() function.
It was there to work around the lack of a conditional operator in old
versions of Python. But now we have 'x if y else z', we can just use
that.
font.py | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
commit 7ee318e168603e5cc11c05fe812cd2cede7b579b
web diff https://git.tartarus.org/?p=simon/gonville.git;a=commitdiff;h=7ee318e168603e5cc11c05fe812cd2cede7b579b;hp=6d76db77a74de01f09220cf7e84b62a677530e09
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 22 13:14:39 2020 +0000
Stop invoking subcommands in shell syntax.
Now every subprocess invocation is done using an argv list - even
including the pipeline of up to 4 commands in get_ps_path, which now
constructs the pipeline directly in Python by assigning each new
Popen's stdin to be the previous one's stdout. Should be more robust
against spaces in paths, etc.
glyphs.py | 46 +++++++++++++++++++++++++++-------------------
1 file changed, 27 insertions(+), 19 deletions(-)
commit 29f799d462abea18e346efc58a791cac546f9e32
web diff https://git.tartarus.org/?p=simon/gonville.git;a=commitdiff;h=29f799d462abea18e346efc58a791cac546f9e32;hp=7ee318e168603e5cc11c05fe812cd2cede7b579b
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 22 13:41:08 2020 +0000
Suppress all Fontforge banners.
Now every call to Fontforge goes via a process that swallows its
stderr, and only re-emits it if Fontforge suffers an error.
glyphs.py | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
commit 8ab394aeeda0b61edc7fd2491c81dfbe1c851077
web diff https://git.tartarus.org/?p=simon/gonville.git;a=commitdiff;h=8ab394aeeda0b61edc7fd2491c81dfbe1c851077;hp=29f799d462abea18e346efc58a791cac546f9e32
Author: Simon Tatham <anakin at pobox.com>
Date: Wed Feb 19 22:46:35 2020 +0000
Add workaround script for LILYPOND_DATADIR bug.
When I came to re-test the main build script for this font, I found
that another thing that's bit-rotted in the last few years is that my
technique for overriding $LILYPOND_DATADIR doesn't work reliably any
more, because of what looks like a bug in Lilypond itself - it ignores
your input value of that env variable, because it overwrites it on
startup with a value inferred from its own binary path.
It's possible to work around this with a creative wrapper shell
script, so for the moment, let's do that.
(The wrapper script is complicated further by the need to dodge
Debian's own wrapper script. See the comment in it for details...)
Buildscr | 4 ++--
run-lilypond-with-datadir | 52 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 2 deletions(-)
commit 00023049c0dc2ba36a92d6eb87560853ad21acef
web diff https://git.tartarus.org/?p=simon/gonville.git;a=commitdiff;h=00023049c0dc2ba36a92d6eb87560853ad21acef;hp=8ab394aeeda0b61edc7fd2491c81dfbe1c851077
Author: Simon Tatham <anakin at pobox.com>
Date: Thu Feb 20 18:01:55 2020 +0000
Add workaround tool for SVG scientific-notation bug.
A user reported last week that Lilypond fails to extract some glyphs
(notably the sharp sign) from the Gonville SVGs, because some of the
path strings contain float literals in scientific notation (1.2e-3 and
so on), which Lilypond's SVG-font-parsing regex rejects.
I've reported the bug to the Lilypond maintainers, and it looks as if
it's likely to be fixed at some point. However, a lot of people will
still be using older versions of Lilypond for a while yet (including
me!), so for pragmatism, I'm now postprocessing the SVG font files
through a textual filter that fixes up those float literals after they
come out of Fontforge.
Buildscr | 5 +-
glyphs.py | 11 ++++
svgfilter/.gitignore | 3 +
svgfilter/Makefile | 14 ++++
svgfilter/svgfilter.l | 169 ++++++++++++++++++++++++++++++++++++++++++++++++
svgfilter/test.expected | 20 ++++++
svgfilter/test.input | 20 ++++++
7 files changed, 240 insertions(+), 2 deletions(-)
commit 11e76508da8bdff964462988a85de13eb8d6ad93
web diff https://git.tartarus.org/?p=simon/gonville.git;a=commitdiff;h=11e76508da8bdff964462988a85de13eb8d6ad93;hp=00023049c0dc2ba36a92d6eb87560853ad21acef
Author: Simon Tatham <anakin at pobox.com>
Date: Thu Feb 20 18:21:10 2020 +0000
Build the demo images as SVG as well as PNG.
Now I know how to actually get that to _work_, it would be a shame not
to show it off!
Buildscr | 8 ++++++++
1 file changed, 8 insertions(+)
commit 68ae634ce86afcb42bb49db4fb9d6558d21296ce
web diff https://git.tartarus.org/?p=simon/gonville.git;a=commitdiff;h=68ae634ce86afcb42bb49db4fb9d6558d21296ce;hp=11e76508da8bdff964462988a85de13eb8d6ad93
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 22 14:40:29 2020 +0000
Parallelise all the slow gs/potrace runs.
Now we're in a nice modern version of Python, this is pretty easy -
all we have to do is 'import multiprocessing' and take advantage of
the handy facilities it already provides. I was afraid I'd have to do
this by breaking the Python script up into tiny pieces and building a
Makefile, but there's really no need!
Buildscr | 2 +-
glyphs.py | 47 +++++++++++++++++++++++++++++++++++------------
2 files changed, 36 insertions(+), 13 deletions(-)
More information about the tartarus-commits
mailing list