966 Commits

Author SHA1 Message Date
Ben Harris
76462c8176 Update version to 3.261
Also polish release notes.
bedstead-3.261
2026-02-07 15:44:14 +00:00
Ben Harris
ebe341b928 Slightly re-organise comments around feature definitions
I was just looking at the code and finding it confusing.  Maybe more
comments will help, but maybe generating XML with enormous piles of
preprocessory is intrinsically confusing.
2026-01-30 00:40:05 +00:00
Ben Harris
e0c668da75 Private-use code points for new glyphs
Old-style numerals at U+F130..U+F139.  Small caps at U+F187..U+F18C.
2026-01-29 23:13:08 +00:00
Ben Harris
40a0f74a6d Add webstead.xhtml to HACKING 2026-01-29 22:42:02 +00:00
Ben Harris
7beb660125 Draft release notes for 3.261 2026-01-28 00:14:49 +00:00
Ben Harris
b893d49beb Do not build bedstead.mjs as part of a release
I think it would be unwise to make the editor usable on Bedstead's Web
page.  This avoids the danger of Bedstead's Web page turning into a
regulated user-to-user service under the Online Safety Act 2023, with
all the paperwork that would entail.

Specifically, if there were an editor on Bedstead's Web page then
users could use it to create glyph designs.  That would, indeed, be
the whole point.  They might also send those designs to me for
incorporation into Bedstead.  But if I accepted any of those designs,
then "content generated directly on the service by a user" might "be
encountered by another user, or other users, of the service" (OSA
s3(1)), making the site a user-to-user service.

Ofcom take the position that being hosted on a .uk domain name is
enough to give a service "links to the UK", and none of the exemptions
cover Bedstead's Web page.  So if the page were a user-to-user
service, it would be a regulated one.

Being a regulated user-to-user service brings requirements for
risk-assessment, record-keeping, and terms of service.  These might be
reasonable for a service of any significant size, but it's not worth
the effort for something that I expect will get me a few glyphs at
most.  And there seem to be moves afoot to require age assurance on
all regulated user-to-user services, which would be particularly
annoying.

The OSA is arranged such that even if no new content can be created on
a service, the continuing presence of user-generated content on a
service causes it to be a user-to-user service.  So ever accepting a
glyph designed on the Web page would permanently make it into a
user-to-user service.  Thus it's important that I shouldn't do that.
2026-01-24 19:33:21 +00:00
Ben Harris
562329c1b9 Make a couple more Unicode-related variables unsigned
This deals with some warnings when building with Emscripten.
2026-01-13 22:11:43 +00:00
Ben Harris
4832617c7d Add a NOTE on 19th-century pixel fonts 2026-01-13 21:55:10 +00:00
Ben Harris
06903fb652 Explicitly set font-weight to 500 in CSS
Bedstead's standard weight is 500, reflecting the fact that it's
naturally quite heavy.  CSS defaults to 400, so we were depending on
CSS's font-matching rules to fall back from 400 to 500.  That's fine
at the moment, where there is no 400-weight version.  But Bedstead
could be made lighter, and indeed the code to do it already exists.
And I hope that somewhere in the future is a variable Bedstead that
might allow for lighter weights.  So for future-proofing I think the
CSS should specify the weight that it actually wants.  Obviously I can
update my CSS if I ever introduce a 400 weight, but other people might
reasonably use my CSS as an example and I shouldn't lead them into
trouble.
2026-01-13 21:55:10 +00:00
Ben Harris
d418809b34 Tolerable rendering of variation sequences in glyph complement
I think I probably want a nice way to write "<= 0x10ffff" though.
2026-01-13 21:55:10 +00:00
Ben Harris
331392b073 Horizontal square brackets
I was looking for something completely different in the Unicode
Standard and found a note that U+23B4..U+23B6 can be used in terminal
applications with text printed vertically.  So obviously I had to add
them.

Apparently the same doesn't apply to the other horizontal brackets at
U+23DC..U+32E1, which are purely stretchy mathematical brackets and
not interesting to us.

The odd positioning in the character cell is based on the Unicode code
chart.
2026-01-13 21:55:10 +00:00
Ben Harris
15d1191aeb Emit a format-14 'cmap' subtable for variation sequences
Now I can put <U+0030, U+FE00> in an HTML file and Firefox will pick the
correct glyphs.
2026-01-13 21:55:10 +00:00
Ben Harris
69ac5c6bfd Beginnings of support for Unicode variation selectors
These are treated as particularly odd Unicode code points and packed
into the "unicode" field.  Currently only the encoding side is
implemented, withe the slashed zero, <U+0030, U+FE00>, as a motivating
example.

Generating a format 14 'cmap' subtable and properly formatting the
glyph complement are still to come.
2026-01-13 21:55:10 +00:00
Ben Harris
fa88f696c7 Add support for 'zero' (slashed zero) feature
This re-uses the old Oslash glyph I drew that had the slash entirely
inside the O.  I've seen something similar on simulations of old
character generators, though I'm not sure I've seen any actual character
generators using this shape.
2026-01-13 21:55:10 +00:00
Ben Harris
58496743a8 Switch to unsigned types for holding Unicode code points
We were only using negative numbers for the "no Unicode mapping"
constant, and even there it was mostly cast to unsigned before we used
it (because it needed to sort last).  So just using an unsigned type
throughout seems to be a bit cleaner.  It will also make me less dubious
about packing extra information in when I want to support variation
selectors.
2026-01-13 21:55:10 +00:00
Ben Harris
383a376372 Use a defined constant instead of -1 for "no Unicode mapping"
Partly on the principle that magic numbers should be avoided, but
mostly because I want to change it.
2026-01-13 21:55:10 +00:00
Ben Harris
0d85d45857 Use "unsigned long" when we need an unsigned Unicode type
On 16-bit systems, "unsigned int" won't get us beyond the Basic
Multilingual Plane.
2026-01-13 21:55:10 +00:00
Ben Harris
51ffa3eb33 Replace bare "unsigned" as a type name with "unsigned int"
I noticed some occasions where my attempts at 16-bit cleanliness had
failed because I hadn't noticed that "unsigned" was a species of "int"
and hence potentially only 16 bits.  So now I'm trying to be more
explicit and saying "unsigned int".

Next several of them will need to be replaced with something else.
2026-01-13 21:55:10 +00:00
Ben Harris
20d377ccb6 Correct formatting of a comment 2026-01-13 21:55:10 +00:00
Ben Harris
c43a34aaba Reduce MAXPOINTS a little
whitepixel() now generates at most 16 points per pixel, not 20.
2026-01-13 21:55:10 +00:00
Ben Harris
ce6d060613 Add assertions that we don't overflow the "points" array 2026-01-13 21:55:10 +00:00
Ben Harris
5f955f3c64 Remove a couple of spaces that just annoyed me 2026-01-13 21:55:10 +00:00
Ben Harris
36d6f142e1 Allow space for terminating null in struct glyph.data
GCC 15 gives a warning (-Wunterminated-string-initialization) if you
initialize an unsigned char array from a string constant such that the
terminating null character isn't included.  Bedstead does this in most
rows of the glyphs array, which is quite noisy.  I've chosen to work
around this by making the array one byte larger.  That doesn't
actually affect the size of the struct on systems that align struct
fields, so the major loss is that now we might not get warnings if we
overflow by one byte.

There are several other ways this problem could be solved.  One could
disable the warning entirely, but that would remove a valuable warning
from the rest of the program.  We currently disable two other warnings
for the sake of the glyphs array, but working around them would
require ugly changes on every line of the array.

Probably the ideal approach would be to tag the "data" field with
"[[gnu::nonstring]]".  That would not only suppress the warning but
also enable warnings if the array was ever passed to a function
expecting a null-terminated string.  However, I think Bedstead is
currently written in plain ISO C99, while attributes like that were
only standardised in C23.  I'm not averse to moving to a newer
standard, but C23 is a but _too_ new right now.  I'm also a little
reluctant to rely on the implementation-defined behaviour of
particular compilers, which is why I'm not using "#pragma GCC
diagnostic".
2026-01-13 21:55:10 +00:00
Ben Harris
557685b3d0 Remove "copyright" notice that isn't
I don't think it's appropriate to use 'name' string 0 (copyright
notice) for something that isn't a copyright notice.  Perhaps I should
have something other than a URL that explains Bedstead's copyright
situation, but that field isn't it.
2026-01-13 21:55:10 +00:00
Ben Harris
1b6203ed30 A few more 'name' strings
We now have a manufacturer, vendor URL, licensing URL, and sample text.
I've added an anchor to the Web page so to make the licensing URL more
useful.

Most of these are displayed by Firefox when listing the fonts used on a
page, so they seem like a good idea.
2026-01-13 21:55:10 +00:00
Ben Harris
8f969e4577 Use "rem" to set the base font size in CSS
This means that the font size will vary based on the user's selected
default font size even in the absence of zooming.
2026-01-13 21:55:10 +00:00
Ben Harris
f8b7e0a91f Add stylesheet to plain text files in .htaccess
It turns out that Firefox (version 140 at least) will happily use an
HTTP Link header for a CSS stylesheet on a plain text file.  It works
a bit weirdly because it applies the stylesheet to the HTML conversion
of the file, but that actually means that the existing bedstead.css
works pretty well.

This doesn't work on Chromium, but that's no worse than what we've
already got.
2026-01-13 21:55:10 +00:00
Ben Harris
2d27cef998 Add JavaScript and WASM to compressible file types in .htaccess 2026-01-13 21:42:18 +00:00
Ben Harris
940069cfe6 webstead: remove "test" from page title 2026-01-13 21:42:18 +00:00
Ben Harris
922af33a25 webstead: use .mjs for JavaSript module
This means that emcc automatically uses the correct mode, and seems
slightly more correct to me.
2026-01-13 21:42:18 +00:00
Ben Harris
277091df19 webstead: slightly more robust invocation of bedstead
Now we don't assume that stdout is line-buffered and that we'll
therefore get a single call to print().  Instead, we collect up all
the output in a string and use it when the program exits.
2026-01-13 21:42:18 +00:00
Ben Harris
d84ca8b4e7 webstead: add some instructions 2026-01-13 21:42:18 +00:00
Ben Harris
a9bceeb6e7 webstead: click handler for output side
It's kind of ugly because there's no :active, but I can't see a nice
way to fake that.
2026-01-13 21:42:18 +00:00
Ben Harris
0ecf8f3ebf webstead: style for #pixels input:focus-visible
The usual focus ring in Firefox and Chromium appears at the same
stacking level as the element it's attached to.  This means that it's
hidden by elements after it in the document, including pixels below it
and to its right.  Fiddling with the z-index of the focussed pixel
helps with this.
2026-01-13 21:42:18 +00:00
Ben Harris
3c097befba webstead: add page icon 2026-01-13 21:42:18 +00:00
Ben Harris
1078f31ad1 webstead: support arrow keys for navigation 2026-01-13 21:42:18 +00:00
Ben Harris
4c3abb66be More restrictive content security policy for Web site 2026-01-13 21:42:18 +00:00
Ben Harris
da628c5e44 webstead: visual distinction for input:checked:active too
It's a bit crude, but I think it helps.
2026-01-13 21:42:18 +00:00
Ben Harris
e3fca90c39 webstead: mark :active pixels
This makes it more obvious that something is happening when the mouse
button is pressed, even though the tickybox doesnt change state until
it's released.  Thus should make the UI feel less sluggish.
2026-01-13 21:42:18 +00:00
Ben Harris
d99c68a2ba webstead: enable strict mode in top-level script
Now that it's not a module, we need to do this explicitly.  Also fix
various undeclared variables that this exposed.
2026-01-13 21:42:18 +00:00
Ben Harris
96f2490058 webstead: JavaScript is not Perl
Remove some braces accordingly.
2026-01-13 21:42:18 +00:00
Ben Harris
4457cf5107 webstead: allow for editing C version of character
The new code triggers when the <input> is edited.  It updates the
pixel tickyboxes and the rendered glyph, but suppresses updating the
<input> itself.  This can be used for interactive editing, but is
mostly to allow for pasting in character bitmaps.
2026-01-13 21:42:18 +00:00
Ben Harris
212db5dd91 webstead: reset form at start of from_c()
That way we don't get fragments of the old glyph if it stops early.
2026-01-13 21:42:18 +00:00
Ben Harris
4d3b7ecc4c webstead: add a function to read a C string
Like pasting in the Python editor.  Now I just need to tie this into
the UI in a way that's not horrible.
2026-01-13 21:42:18 +00:00
Ben Harris
d6ccde8a4a webstead: use an <input> to display C code 2026-01-13 21:42:18 +00:00
Ben Harris
5ffd5b23ef Styling for text <input> in bedstead.css 2026-01-13 21:42:18 +00:00
Ben Harris
15f9f591a1 webstead: more sensible viewBox for <svg> 2026-01-13 21:42:18 +00:00
Ben Harris
e6b411252b webstead: use a non-module <script> and import()
According to <https://github.com/fuweichin/xhtml5-esm-support>, an
internal script (a <script> element with content) can't be a module in
an XHTML page in Safari.  So following the suggestion on that page, I
make the <script> on the page into a classic script, and use import()
to load the module containing the bedstead executable.  Maybe this
will work on a reasonable selection of modern browsers.
2026-01-13 21:42:18 +00:00
Ben Harris
1edf533277 Set a content security policy in .htaccess
My Web site disables JavaScript by default, so we need to override
that if the Web editor is going to work.
2026-01-13 21:42:18 +00:00
Ben Harris
b62b0454b5 webstead: add Emscripten and musl copyright notices
Programs compiled with Emscripten end up statically linked against the
Emscripten runtime, which includes musl libc.  So we need to comply with
their licences by including a copy of the licence and the relevant
copyright notices.  I think putting them on the webstead page in small
print is probably the best approach.

This might need updating each release to match the version of Emscripten
that I build the editor with.
2026-01-13 21:42:18 +00:00