11 Commits

Author SHA1 Message Date
Ben Harris
60df8ac6a6 Support cntrmask and hintmask operators in editor 2024-11-19 23:40:00 +00:00
Ben Harris
a0cbdb9d05 Skip XML comments when reading charstrings in editor 2024-11-19 23:40:00 +00:00
Ben Harris
86f186342a Reverse (almost) all the paths
Type 1 fonts (and by extension CFF fonts) are required to have their
outer contours go counter-clockwise.  Bedstead has always generated
outlines clockwise and depended on FontForge to correct them.  Now
they're generated counter-clockwise as is proper, which will be fine
until I decide I want TrueType outlines instead.

This makes no difference to FreeType's rendering at either 20 ppem or
10.5 ppem
2024-11-17 09:36:54 +00:00
Ben Harris
59a535c335 Ignore stem hints in editor
Though it would be neat if it could display them.
2024-11-14 23:31:36 +00:00
Ben Harris
8b6bfa5298 Update editor to read Type 2 charstrings (in source form)
Now the editor displays something useful again.
2024-11-14 22:27:18 +00:00
Ben Harris
e129bcd034 Update editor to emit the new style of character bitmap 2024-10-26 18:58:25 +01:00
Simon Tatham
d523da3671 editor: miscellaneous source cleanups.
Apparently I didn't know about chained comparisons when I wrote this
code, so I didn't take the opportunity to write '0 <= x < limit'.

Also, removed the wildcard import from tkinter, replacing it with
explicit references to the things needed. There weren't that many of
them, so I think the 'import *' didn't gain much.
2024-10-13 15:04:53 +01:00
Simon Tatham
67290ddd01 editor: better error message on paste failure.
Apparently I was incredibly lazy at some point in the past and forgot
to say what the problem was when the paste data couldn't be matched
against the regex.
2024-10-13 15:04:53 +01:00
Simon Tatham
4ce96879d8 editor: better ways to find the bedstead executable.
Previously the editor just expected to find it in your cwd. Now by
default it looks in the same directory as its own script, which means
you can run it from some other directory.

Also, I've provided a command-line option to override the default, in
case you keep the executable somewhere else again.
2024-10-13 15:04:53 +01:00
Simon Tatham
384c5a305c editor: put all the Tk work into a class.
The previous code organisation had a tiny 'Container' classlet that
held all the mutable variables, just so that all the event handler
functions could reach into it and modify it without having to faff
with 'global'.

But if you're going to make that much of a class, it makes more sense
to go further, and make all those functions _methods_ of the class. So
here's a reorganisation that wraps up the Tk code into a more or less
conventional class structure.

The patch for this commit looks like a total rewrite, but it's not
really: everything is indented further to the right (with a couple of
reflowings of long lines), and a lot of variables have a new 'self.'
on the front, but in other respects the code is substantially
unchanged.
2024-10-13 15:04:53 +01:00
Simon Tatham
cfab21f7a7 editor: commit to Python 3.
At the time I wrote this editor, it was sensible to try to be Python
2/3 agnostic. P2 is now thoroughly obsolete, so I've removed the P2
affordances. That lets me fix the shebang line to say 'python3', and
chmod the file +x, so that you can run it by its name.

Also, it can be renamed to just 'editor', because now that it's
executable, the fact that it's in Python is nothing but an internal
implementation detail.
2024-10-13 15:04:53 +01:00