chiark / gitweb /
bedstead.git
5 months agoSwitch hhints loop in emit_hints() so it counts forwards
Ben Harris [Sat, 16 Nov 2024 23:39:30 +0000 (23:39 +0000)]
Switch hhints loop in emit_hints() so it counts forwards

Now that it only touches the input array once, it's much simpler to do
the y-axis inversion there.

5 months agoSome infrastructure towards edge hints
Ben Harris [Sat, 16 Nov 2024 23:33:30 +0000 (23:33 +0000)]
Some infrastructure towards edge hints

There are places to record them now, but they're ignored by
select_hints() and emit_hints().

5 months agoSeparate selecting usable hints from emitting them
Ben Harris [Sat, 16 Nov 2024 18:58:41 +0000 (18:58 +0000)]
Separate selecting usable hints from emitting them

Now there's a select_hints() function that decides what hints should
be emitted, and emit_hints() just handles putting those hints into a
charstring.  I hope this will make each function reasonably simple.
Importantly, it means that select_hints() can be called twice, once
for horizontal stems and once for vertical ones.

5 months agoChange version number so pre-release fonts are distinguishable
Ben Harris [Sat, 16 Nov 2024 14:41:43 +0000 (14:41 +0000)]
Change version number so pre-release fonts are distinguishable

5 months agoCorrect baseline of BDF fonts
Ben Harris [Sat, 16 Nov 2024 14:40:47 +0000 (14:40 +0000)]
Correct baseline of BDF fonts

5 months agoPass --no-recalc-timestamp to TTX
Ben Harris [Sat, 16 Nov 2024 11:35:03 +0000 (11:35 +0000)]
Pass --no-recalc-timestamp to TTX

Without that, it updates the "modified" field in the 'head' table,
which makes builds unreproducible.

5 months agoEmit OpenType tables in a more logical order
Ben Harris [Sat, 16 Nov 2024 11:22:21 +0000 (11:22 +0000)]
Emit OpenType tables in a more logical order

TTX doesn't actually care what order we emit tables in: it will always
put them into the recommended order.  So I've made the order something
that works correctly and that doesn't look too silly in TTX's console
output.

5 months agoUpdate Web page for new generation procedure
Ben Harris [Sat, 16 Nov 2024 11:07:29 +0000 (11:07 +0000)]
Update Web page for new generation procedure

5 months agoCorrect cap height in font headers
Ben Harris [Sat, 16 Nov 2024 02:00:44 +0000 (02:00 +0000)]
Correct cap height in font headers

5 months agoPut version number in glyph complement PDF
Ben Harris [Fri, 15 Nov 2024 20:45:01 +0000 (20:45 +0000)]
Put version number in glyph complement PDF

Now that we've got the version number in a constant, this is
convenient.

5 months agoExtract version number from C file, not nonexistent SFD
Ben Harris [Fri, 15 Nov 2024 00:48:34 +0000 (00:48 +0000)]
Extract version number from C file, not nonexistent SFD

5 months agoCorrect ordering of stem hints
Ben Harris [Tue, 12 Nov 2024 10:53:15 +0000 (10:53 +0000)]
Correct ordering of stem hints

The spec for Type 2 charstrings requires that all hstem hints must
occur before all vstem hints.

5 months agoIgnore stem hints in editor
Ben Harris [Mon, 11 Nov 2024 23:20:23 +0000 (23:20 +0000)]
Ignore stem hints in editor

Though it would be neat if it could display them.

5 months agoAdd .DELETE_ON_ERROR target to Makefile
Ben Harris [Mon, 11 Nov 2024 22:28:40 +0000 (22:28 +0000)]
Add .DELETE_ON_ERROR target to Makefile

That ensures that output files of a rule get properly deleted if the
recipe fails, which is almost always correct.

5 months agoMake the processing of SOURCE_DATE_EPOCH safe
Ben Harris [Mon, 11 Nov 2024 22:19:54 +0000 (22:19 +0000)]
Make the processing of SOURCE_DATE_EPOCH safe

And explain in excruciating detail why it's safe.  It's only actually
safe on systems (like POSIX ones) where time_t is an integer type, but
I think that's good enough for me.

5 months agoSupport SOURCE_DATE_EPOCH
Ben Harris [Sun, 10 Nov 2024 10:49:28 +0000 (10:49 +0000)]
Support SOURCE_DATE_EPOCH

If set, it is used to set the "created" and "modified" fields in the
OpenType 'head' table.  This means that builds of Bedstead can be
reproducible.

The current code just casts the "long long" interpretation of the
environment variable into a time_t.  This is potentially undefined
behaviour, because time_t might be a signed integer type smaller than
"long long".  But I can't find a way to properly range-check it.  Even
in POSIX, where time_t is required to be an integer type, there
doesn't seem to be a constant that specifies its range.

5 months agoGenerate stem hints
Ben Harris [Sat, 9 Nov 2024 23:51:36 +0000 (23:51 +0000)]
Generate stem hints

These are generated from the glyph bitmap by a similar
pattern-matching arrangement that generates the outline.  Then, like
emit_path(), there's an emit_hints() that turns them into valid
charstrings.  The handling of overlapping hints could be cleverer: at
the moment we emit the leftmost-possible set of hints, but we collect
a histogram of where hints are needed so could instead emit the most
useful.  Or even try to do hint substitution.

This makes the Bedstead Web page at 90% zoom much prettier than
before, but it's not as good as the FontForge auto-hinter managed.
Edge hints and counter hints will probably help.

5 months agoUse my own, officially assigned, achVendID
Ben Harris [Fri, 8 Nov 2024 09:37:52 +0000 (09:37 +0000)]
Use my own, officially assigned, achVendID

The assignment is recorded at
<https://learn.microsoft.com/en-gb/typography/vendors/>.

This branch is destined to be the next major version of Bedstead, so
it's a sensible place to make this change.

5 months agoConstants for 'OS/2' achVendID and XLFD/BDF FOUNDRY
Ben Harris [Fri, 8 Nov 2024 09:34:18 +0000 (09:34 +0000)]
Constants for 'OS/2' achVendID and XLFD/BDF FOUNDRY

5 months agoHave a defined constant for the family name "Bedstead"
Ben Harris [Fri, 8 Nov 2024 09:30:44 +0000 (09:30 +0000)]
Have a defined constant for the family name "Bedstead"

All occurrences of the name in the OTF and BDF files are now derived
from that definition so that they can conveniently be changed together.

5 months agoVery rough but apparently functional 'palt' support
Ben Harris [Fri, 8 Nov 2024 00:42:42 +0000 (00:42 +0000)]
Very rough but apparently functional 'palt' support

5 months agoChange TTXI etc macros to take XML tag name as a string
Ben Harris [Fri, 8 Nov 2024 00:41:20 +0000 (00:41 +0000)]
Change TTXI etc macros to take XML tag name as a string

Stringifying it from a C token may have been more compact, but it was
also quite confusing because those really weren't C identifiers and
everywhere else XML appears in strings.

5 months agoSkeleton of GPOS support
Ben Harris [Wed, 6 Nov 2024 23:05:54 +0000 (23:05 +0000)]
Skeleton of GPOS support

5 months agoPut single substitutions in the GSUB table
Ben Harris [Wed, 6 Nov 2024 20:47:20 +0000 (20:47 +0000)]
Put single substitutions in the GSUB table

5 months ago'aalt' feature implemented via TTX
Ben Harris [Tue, 5 Nov 2024 23:57:51 +0000 (23:57 +0000)]
'aalt' feature implemented via TTX

5 months agoBeginnings of 'GSUB' generation: a table of the lookups we need
Ben Harris [Mon, 4 Nov 2024 23:59:09 +0000 (23:59 +0000)]
Beginnings of 'GSUB' generation: a table of the lookups we need

This is now used to generate the 'name' entries for stylistic sets.

5 months agoClean up trailing whitespace in bedstead.c
Ben Harris [Sun, 3 Nov 2024 18:04:28 +0000 (18:04 +0000)]
Clean up trailing whitespace in bedstead.c

5 months agoRecord proper left sidebearings in 'hmtx' table
Ben Harris [Sun, 3 Nov 2024 17:37:44 +0000 (17:37 +0000)]
Record proper left sidebearings in 'hmtx' table

That change was more invasive than I was expecting.

5 months agoMove function declarations after structure declarations
Ben Harris [Sun, 3 Nov 2024 17:02:21 +0000 (17:02 +0000)]
Move function declarations after structure declarations

5 months agoUpdate editor to read Type 2 charstrings (in source form)
Ben Harris [Sun, 3 Nov 2024 14:22:39 +0000 (14:22 +0000)]
Update editor to read Type 2 charstrings (in source form)

Now the editor displays something useful again.

5 months agoUpdate comment on compare_glyphs_by_ffid()
Ben Harris [Sun, 3 Nov 2024 13:17:23 +0000 (13:17 +0000)]
Update comment on compare_glyphs_by_ffid()

It's not necessary any more, but it does seem to make the output file
smaller so it can stay for now.

5 months agoNote that TTX overrides hhea.numberOfHMetrics
Ben Harris [Sun, 3 Nov 2024 09:33:16 +0000 (09:33 +0000)]
Note that TTX overrides hhea.numberOfHMetrics

5 months agoAdjust indentation of CFF XML
Ben Harris [Sun, 3 Nov 2024 08:35:40 +0000 (08:35 +0000)]
Adjust indentation of CFF XML

It's not perfect, but it's prettier.

5 months agoRemove extraglyphs variable that's no longer needed
Ben Harris [Sun, 3 Nov 2024 00:16:17 +0000 (00:16 +0000)]
Remove extraglyphs variable that's no longer needed

5 months agoDon't emit unnecessary CFF DICT entries
Ben Harris [Sat, 2 Nov 2024 23:02:37 +0000 (23:02 +0000)]
Don't emit unnecessary CFF DICT entries

In several cases, Bedstead uses the defaults, so there's no need to
mention them.

5 months agoRemove newlines from charstrings in TTX output
Ben Harris [Sat, 2 Nov 2024 22:38:16 +0000 (22:38 +0000)]
Remove newlines from charstrings in TTX output

This does make the file rather wide, but I think it also makes it
easier to find what you're looking for.

5 months agoCreate a subroutine for each aliased glyph
Ben Harris [Sat, 2 Nov 2024 22:31:01 +0000 (22:31 +0000)]
Create a subroutine for each aliased glyph

So both the original name and any aliases can then call the subroutine
instead.

5 months agoCorrect charstring stack accounting in emit_contour()
Ben Harris [Sat, 2 Nov 2024 22:10:33 +0000 (22:10 +0000)]
Correct charstring stack accounting in emit_contour()

The first point doesn't count because it gets an rmoveto rather than an
rlineto.

5 months agoMake aliases work again, inefficiently
Ben Harris [Sat, 2 Nov 2024 22:07:23 +0000 (22:07 +0000)]
Make aliases work again, inefficiently

This pulls the conditional that works out how to render a glyph into
it's own function, doglyph(), that also handles indirecting through
aliases.  Later maybe we'll properly use subroutines to share the
charstrings for aliased glyphs.

5 months agoPut the charstring cursor in a local variable
Ben Harris [Sat, 2 Nov 2024 19:32:17 +0000 (19:32 +0000)]
Put the charstring cursor in a local variable

5 months agoCombine successive rlineto operators
Ben Harris [Sat, 2 Nov 2024 19:25:41 +0000 (19:25 +0000)]
Combine successive rlineto operators

In a Type 2 charstring, an rlineto operator can take up to 24 pairs of
co-ordinates, so most contours need only one rmoveto and one rlineto.

5 months agoDon't emit first point of a contour twice
Ben Harris [Sat, 2 Nov 2024 19:24:42 +0000 (19:24 +0000)]
Don't emit first point of a contour twice

Type 2 charstrings implicitly close each contour with a line, so there's
no need for us to explicitly do so.

5 months agoEmit 'CFF ' and 'hmtx' tables for TTX (mostly)
Ben Harris [Sat, 2 Nov 2024 17:50:31 +0000 (17:50 +0000)]
Emit 'CFF ' and 'hmtx' tables for TTX (mostly)

The left sidebearings in 'hmtx' are not set yet, and there are (of
course) no hints, but the glyphs are the right shapes.

5 months agocmap fixup
Ben Harris [Sat, 2 Nov 2024 17:49:57 +0000 (17:49 +0000)]
cmap fixup

5 months agoGenerate 'post' table for TTX
Ben Harris [Sat, 2 Nov 2024 16:39:50 +0000 (16:39 +0000)]
Generate 'post' table for TTX

5 months agoGenerate 'cmap' table for TTX
Ben Harris [Sat, 2 Nov 2024 16:35:34 +0000 (16:35 +0000)]
Generate 'cmap' table for TTX

TTX currently refuses to compile it, but I suspect that's because the
font still has no glyphs.

5 months agoGenerate 'name' table for TTX
Ben Harris [Sat, 2 Nov 2024 15:26:04 +0000 (15:26 +0000)]
Generate 'name' table for TTX

5 months agoMacros for the common TTX pattern <foo value='bar'/>
Ben Harris [Sat, 2 Nov 2024 14:41:34 +0000 (14:41 +0000)]
Macros for the common TTX pattern <foo value='bar'/>

That makes things a little less verbose.

5 months agoGenerate 'OS/2' table for TTX
Ben Harris [Sat, 2 Nov 2024 13:53:55 +0000 (13:53 +0000)]
Generate 'OS/2' table for TTX

5 months agoUse constants for ascent, descent, etc
Ben Harris [Sat, 2 Nov 2024 11:40:09 +0000 (11:40 +0000)]
Use constants for ascent, descent, etc

This way there won't be quite so many magic numbers in the font metrics.

5 months agoGenerate 'maxp' table for TTX
Ben Harris [Sat, 2 Nov 2024 10:21:58 +0000 (10:21 +0000)]
Generate 'maxp' table for TTX

5 months agoGenerate 'hhea' table for TTX
Ben Harris [Sat, 2 Nov 2024 10:16:36 +0000 (10:16 +0000)]
Generate 'hhea' table for TTX

5 months agoGenerate 'head' table for TTX
Ben Harris [Sat, 2 Nov 2024 10:02:28 +0000 (10:02 +0000)]
Generate 'head' table for TTX

5 months agoMinimal infrastructure for going via TTX rather than SFD
Ben Harris [Sat, 2 Nov 2024 08:46:28 +0000 (08:46 +0000)]
Minimal infrastructure for going via TTX rather than SFD

bedstead.c outputs an utterly minimal TTX file containing no tables, and
TTX compiles it into a similarly minimal OTF.  Which Ghostscript then
complains about.

FontForge is an impressive application, but it's not well-suited to
being part of a mechanical font-production pipeline.  The SFD format is
weird and rather difficult to generate, and FontForge imposes rather
more of its own opinions on the output than I'd like.

TTX is a lower-level format, and while it's a little bit weird, most of
it's weirdness comes from being a faithful representation of the
structure of an OpenType font.  Ideally I'd like something a little
higher-level, but a format that's too low-level is much easier to work
with than one that's too high-level.  The obvious alternative is UFO,
which is very popular but looks like being a pain to generate from plain
C.

Looking to the future, I like the idea of a variable version of
Bedstead, and neither SFD nor UFO seems to support that very well.  In
UFO's case, it seems that the convention is to create UFOs at various
points in the design space and then have a tool interpolate between
them, which seems wrong when they're all procedurally generated from the
same source.  TTX will allow me to directly generate the variation
tables, if I can understand how they work.

5 months agoWibblings about version numbers
Ben Harris [Thu, 14 Nov 2024 22:25:08 +0000 (22:25 +0000)]
Wibblings about version numbers

5 months agoFontmap is required by .bdf.ps files
Ben Harris [Sat, 2 Nov 2024 01:18:19 +0000 (01:18 +0000)]
Fontmap is required by .bdf.ps files

5 months agoAdd DEFAULT_CHAR to BDF
Ben Harris [Fri, 1 Nov 2024 20:42:22 +0000 (20:42 +0000)]
Add DEFAULT_CHAR to BDF

Also sort properties into the order they appear in the XLFD spec.

5 months agoCorrect weight and width names in BDF
Ben Harris [Fri, 1 Nov 2024 19:48:34 +0000 (19:48 +0000)]
Correct weight and width names in BDF

They shouldn't have leading spaces.

5 months agoAdd FACE_NAME property to BDF
Ben Harris [Fri, 1 Nov 2024 19:43:43 +0000 (19:43 +0000)]
Add FACE_NAME property to BDF

5 months agoAdd FONT_VERSION property to BDF
Ben Harris [Fri, 1 Nov 2024 19:41:08 +0000 (19:41 +0000)]
Add FONT_VERSION property to BDF

5 months agoSwitch build system to generating BDF via PostScript
Ben Harris [Fri, 1 Nov 2024 14:39:15 +0000 (14:39 +0000)]
Switch build system to generating BDF via PostScript

As far as I can see, the new BDF files are now as good as the
FontForge-generated ones.

5 months agoAdd support for choosing font size and weight in BDF generation
Ben Harris [Fri, 1 Nov 2024 14:38:39 +0000 (14:38 +0000)]
Add support for choosing font size and weight in BDF generation

5 months agoMore BDF properties and a proper XLFD name
Ben Harris [Fri, 1 Nov 2024 10:18:14 +0000 (10:18 +0000)]
More BDF properties and a proper XLFD name

5 months agoRough Makefile bits for new BDF generation
Ben Harris [Fri, 1 Nov 2024 00:41:50 +0000 (00:41 +0000)]
Rough Makefile bits for new BDF generation

5 months agoAdd rough support for generating BDF without FontForge
Ben Harris [Thu, 31 Oct 2024 23:34:18 +0000 (23:34 +0000)]
Add rough support for generating BDF without FontForge

This is extremely silly, but it's actually quite functional and
surprisingly compact.  bedstead.c gains the ability to generate a
PostScript file that emits a BDF file rendering each glyph into an image
and then dumping the image in hex.

I still need to get the font metadata right, which is my main reason for
wanting to get away from FontForge, but that shouldn't be difficult.
And the Makefile needs to be updated to make this work properly.  But
the bitmaps are coming out correctly.

5 months agoUse EXIT_SUCCESS and EXIT_FAILURE
Ben Harris [Sun, 10 Nov 2024 09:27:31 +0000 (09:27 +0000)]
Use EXIT_SUCCESS and EXIT_FAILURE

This is a bit of C pedantry.  POSIX requires that an exit status of
zero is success and non-zero is failure, but the C standard says no
such thing.  Instead it provides EXIT_SUCCESS and EXIT_FAILURE.  Since
Bedstead aspires to work on non-POSIX systems, it should use the
defined constants.  Also removing magic numbers is a good thing.

5 months agoMake it safe to call fullname_to_fontname() twice
Ben Harris [Sat, 2 Nov 2024 15:18:55 +0000 (15:18 +0000)]
Make it safe to call fullname_to_fontname() twice

5 months agoAnother capital esszett link
Ben Harris [Thu, 7 Nov 2024 23:37:33 +0000 (23:37 +0000)]
Another capital esszett link

6 months agoMap the .notdef character at U+F1FF
Ben Harris [Fri, 1 Nov 2024 20:36:23 +0000 (20:36 +0000)]
Map the .notdef character at U+F1FF

It should be the DEFAULT_CHAR in BDF, but that needs it to have an
encoding.  U+2395 APL FUNCTIONAL SYMBOL QUAD happens to look
identical, but I don't think I should rely on that.

6 months agoCorrect Wdieresis small-cap
Ben Harris [Tue, 29 Oct 2024 22:39:04 +0000 (22:39 +0000)]
Correct Wdieresis small-cap

Wdieresis.sc is obviously wrong: a capital shouldn't have an 'smcp'
mapping.  A 'c2sc' mapping for that character would also be wrong
because it's already squashed to fit under its accent.  On the other
hand, there should be a wdieresis.sc that maps to the upper-case,
because the characters are slightly different.

Wdieresis.sc is retained as a compatibility alias (for Wdieresis),
just in case.

6 months agoSAA5050 reverse-engineering links
Ben Harris [Tue, 29 Oct 2024 09:35:03 +0000 (09:35 +0000)]
SAA5050 reverse-engineering links

6 months agoAdd headings in NOTES
Ben Harris [Tue, 29 Oct 2024 09:34:54 +0000 (09:34 +0000)]
Add headings in NOTES

6 months agoMove dot in Ldot and corresponding small cap leftwards
Ben Harris [Tue, 29 Oct 2024 00:42:07 +0000 (00:42 +0000)]
Move dot in Ldot and corresponding small cap leftwards

It should be centred between the uprights of the Ls, and that makes it
so.  Sadly, it's not possible to do the same for the lower-case.

Also add a relevant link to NOTES.

6 months agoSome thoughts on UnitsPerEm
Ben Harris [Mon, 28 Oct 2024 15:05:11 +0000 (15:05 +0000)]
Some thoughts on UnitsPerEm

6 months agoExplicitly set OS2Vendor to 'PfEd'
Ben Harris [Sun, 27 Oct 2024 11:56:30 +0000 (11:56 +0000)]
Explicitly set OS2Vendor to 'PfEd'

That's the default value that FontForge uses.  I'd like to change it,
but fontconfig makes it available to applications as "foundry" and I
somehow ended up with Emacs recording that in its configuration.  So if
I'm going to make that change I think it should go with a major version
bump.

But at least I can make sure it doesn't change unexpectedly and give
myself somewhere to make the change when it comes.

6 months agoStop dopalt() reading off the end of the character bitmap
Ben Harris [Sat, 26 Oct 2024 18:00:39 +0000 (19:00 +0100)]
Stop dopalt() reading off the end of the character bitmap

Spotted by GCC -Warray-bounds.

6 months agoUpdate editor to emit the new style of character bitmap
Ben Harris [Sat, 26 Oct 2024 17:58:25 +0000 (18:58 +0100)]
Update editor to emit the new style of character bitmap

6 months agoSwitch to using string constants for character bitmaps
Ben Harris [Sat, 26 Oct 2024 15:25:14 +0000 (16:25 +0100)]
Switch to using string constants for character bitmaps

Future versions of C are likely to make octal integer constants
obsolescent.  Switching to something non-obsolete seems wise, and also
using octal character constants saves eight characters per line that I
can use for other things.

I did consider just using one character per row, but I think that might
be a little too hard to read.

6 months agoTidy up Creative-Commons-related verbiage in HACKING
Ben Harris [Wed, 23 Oct 2024 21:45:29 +0000 (22:45 +0100)]
Tidy up Creative-Commons-related verbiage in HACKING

Specifically, "declaration" is not a usual noun for CC0, and "Creative
Commons" isn't usually followed by "Corporation".

6 months agoAdd some SPDX-License-Identifier headers
Ben Harris [Wed, 23 Oct 2024 20:17:04 +0000 (21:17 +0100)]
Add some SPDX-License-Identifier headers

In places where they don't get in the way.

6 months agoMake co-ordinate systems more sensible
Ben Harris [Mon, 21 Oct 2024 08:31:57 +0000 (09:31 +0100)]
Make co-ordinate systems more sensible

The SAA5050 character images appear at the bottom-right corner of the
character cell, with a blank pixel to the top and the left.  This can
be seen if you put am alphanumeric character and a mosaic graphics
character side-by-side, since mosaic graphics characters fill the
entire character cell.

However, when I first made Bedstead, I put the character images in the
top-right corner, and the co-ordinate system matched that.  When I
fixed this in 2013 (commit 7bea0c6fadc35de50ea08eb184d4b15a7b411ef3),
I just did it by adjusting the final transformation of the vector
co-ordinates, leaving all the internal co-ordinate systems intact.
This was visible when I added mosaic graphics, which had to be offset
by one pixel to compensate.

Now I've finally corrected the problem somewhat properly.  Pixel
co-ordinates count from (0,0) in the top-left corner of the character
cell.  Vector co-ordinates count from (0,0) in the bottom-left corner
and are offset to the baseline on emission.  The conversion between
the two forms is still weirdly spread all over the place though.

6 months agoUpdate version to 002.009 bedstead-002.009
Ben Harris [Sat, 19 Oct 2024 20:02:11 +0000 (21:02 +0100)]
Update version to 002.009

This release is just to give the Debian build a more sensible base to
work from.

6 months agoState default author/licence in HACKING
Ben Harris [Sun, 13 Oct 2024 15:09:28 +0000 (16:09 +0100)]
State default author/licence in HACKING

Now that all the files are either mine or have other explicitly stated
authorship.

6 months agoUpdate HACKING document for editor changes
Ben Harris [Sun, 13 Oct 2024 14:06:41 +0000 (15:06 +0100)]
Update HACKING document for editor changes

6 months agoeditor: miscellaneous source cleanups.
Simon Tatham [Sun, 13 Oct 2024 10:05:01 +0000 (11:05 +0100)]
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.

6 months agoeditor: better error message on paste failure.
Simon Tatham [Sun, 13 Oct 2024 09:52:47 +0000 (10:52 +0100)]
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.

6 months agoeditor: better ways to find the bedstead executable.
Simon Tatham [Sun, 13 Oct 2024 09:50:37 +0000 (10:50 +0100)]
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.

6 months agoeditor: put all the Tk work into a class.
Simon Tatham [Sun, 13 Oct 2024 09:36:22 +0000 (10:36 +0100)]
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.

6 months agoeditor: commit to Python 3.
Simon Tatham [Sun, 13 Oct 2024 09:16:31 +0000 (10:16 +0100)]
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.

6 months agoeditor.py: add a comment including authorship and licence.
Simon Tatham [Sun, 13 Oct 2024 09:19:31 +0000 (10:19 +0100)]
editor.py: add a comment including authorship and licence.

Ben is trying to make Bedstead into a Debian package, which involves
clarifying copyright and licences anywhere it's unclear. When I
contributed this editing tool I did it on a very informal basis ('look
at this fun hack!') and didn't make that clear. Time to fix that.

6 months agoRemove ZVBI-derived comment and code tables from NOTES
Ben Harris [Sat, 12 Oct 2024 22:35:54 +0000 (23:35 +0100)]
Remove ZVBI-derived comment and code tables from NOTES

For the most part they're not useful, and they're arguably under the GNU
GPL.  I've replaced them with an original prose description of some of
the interesting facts.  For everything else, you can go to ZVBI itself.

6 months agoProper licence etc for ZVBI bits in NOTES
Ben Harris [Sat, 12 Oct 2024 21:55:03 +0000 (22:55 +0100)]
Proper licence etc for ZVBI bits in NOTES

ZVBI is under LGPL v2, but the NOTES file isn't a library so I need to
licence the excerpt under GPL v2 instead.  But actually I think I want
to remove that text, so this is just to legitimise the distribution of
the Git history.

6 months agoCorrect SAA5050 ROM encoding
Ben Harris [Sat, 12 Oct 2024 16:05:57 +0000 (17:05 +0100)]
Correct SAA5050 ROM encoding

The character at 6/0 is emdash (5 pixels long), not endash (4 pixels
long).

6 months agoAdd a HACKING file that's a guide to the source code
Ben Harris [Sat, 12 Oct 2024 11:45:05 +0000 (12:45 +0100)]
Add a HACKING file that's a guide to the source code

Suggested by Ian Jackson.

7 months agoUpdate version to 002.008 bedstead-002.008
Ben Harris [Sat, 5 Oct 2024 11:53:24 +0000 (12:53 +0100)]
Update version to 002.008

7 months agoAdd U+2001 EM QUAD
Ben Harris [Sat, 5 Oct 2024 11:36:53 +0000 (12:36 +0100)]
Add U+2001 EM QUAD

It's canonically equivalent to U+2003 EM SPACE, so we should have
both.

7 months agoCSS: switch to monospace
Ben Harris [Thu, 3 Oct 2024 23:30:30 +0000 (00:30 +0100)]
CSS: switch to monospace

Safari badly misdisplays Bedstead in proportional mode.  This is
caused by a bug in WebKit, and I haven't found an acceptable
workaround.  Thus, I think the best thing to do is to turn off
proportional spacing on the Web page entirely.  I think it looks nice,
but even I'll admit that it's a little too tight, and I know others
prefer the monospaced version.

Also, I can't think of a way that a real chip anything like the
SAA5050 could produce proportionally-spaced text.  It's fundamentally
based on getting fed character data at a constant 1 MHz.  There's no
way it can ask for a character early because the previous one was
narrow.

7 months agoCSS: use "background" shorthand property
Ben Harris [Thu, 3 Oct 2024 23:06:49 +0000 (00:06 +0100)]
CSS: use "background" shorthand property

It's more compact and works just as well.  In fact, I think it might
work better on browsers that support background-image but not
background-size.  On such browsers the entire rule will be ignored,
which is what I want.  If the background image can't appear at
precisely the correct size, it shouldn't appear at all.

Of course, ideally on a browser that fails to display the background,
the title also wouldn't fade out to the left.  I wonder if there's a
sensible way to achieve that.

7 months agoMore details on WebKit bug, including link to bug tracker
Ben Harris [Thu, 3 Oct 2024 22:16:08 +0000 (23:16 +0100)]
More details on WebKit bug, including link to bug tracker

7 months agoLight HTML modernisation
Ben Harris [Fri, 27 Sep 2024 20:01:35 +0000 (21:01 +0100)]
Light HTML modernisation

The "sizes" attribute on the icon <links> wasn't allowed by XHTML 1.0
Strict, so I've removed the DOCTYPE for that.  Meanwhile HTML 5
doesn't want you declaring a <meta http-equiv="content-type">
specifying XHTML, so I've removed that as well.  So now it's
XML-syntax HTML 5, which seems sensible to me even if other people
don't like XML.