609 Commits

Author SHA1 Message Date
Ben Harris
46a5c05885 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.
2024-11-10 09:29:29 +00:00
Ben Harris
c2e45853f7 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.
2024-11-10 09:27:31 +00:00
Ben Harris
cba03ce5fd Make it safe to call fullname_to_fontname() twice 2024-11-10 09:23:15 +00:00
Ben Harris
79cbd69c83 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.
2024-11-01 20:36:23 +00:00
Ben Harris
602c0aba1b 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.
2024-10-29 22:39:04 +00:00
Ben Harris
b7a13dd61b 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.
2024-10-29 00:42:27 +00:00
Ben Harris
be0055420f 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.
2024-10-27 11:56:30 +00:00
Ben Harris
b2bda72f72 Stop dopalt() reading off the end of the character bitmap
Spotted by GCC -Warray-bounds.
2024-10-26 19:00:39 +01:00
Ben Harris
e303c792d3 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.
2024-10-26 16:25:14 +01:00
Ben Harris
32079c7b75 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.
2024-10-21 09:31:57 +01:00
Ben Harris
6bac55c65b Update version to 002.009
This release is just to give the Debian build a more sensible base to
work from.
2024-10-19 21:02:11 +01:00
Ben Harris
6bf599f447 Update version to 002.008 2024-10-05 13:06:39 +01:00
Ben Harris
69ccb47499 Add U+2001 EM QUAD
It's canonically equivalent to U+2003 EM SPACE, so we should have
both.
2024-10-05 12:36:53 +01:00
Ben Harris
9c346371c7 Correct PANOSE Letterform value and extend to implausible weights 2024-09-27 10:57:22 +01:00
Ben Harris
11d38bb34e Rework PANOSE generation
The code predated the introduction of bold variants, so it was
significantly incorrect.  Also it appears that some software uses the
PANOSE classification to distinguish monospaced fonts.  After careful
study of the specification, I think all the variants of Bedstead can
be classified as text fonts, so I've removed the code that described
some variants as decorative.  Then I did some calculations and a lot
of playing around with GeoGebra to work out which parts of the design
space give which values of Stroke Variation, Letterform, and Midline.
2024-09-27 10:12:56 +01:00
Ben Harris
157eece073 A few more subscript letters 2024-09-26 17:50:34 +01:00
Ben Harris
1809b33380 Generate the backward-compatibility *.sep6 glyphs correctly
They should actually be separated, but I forgot to fix some pasted
text and so they weren't.
2024-09-26 17:24:26 +01:00
Ben Harris
74e4de5b33 Add U+2003 EM SPACE as a blank mosaic graphics character
At least Noto Sans and Noto Sans Symbols2 think that EM SPACE should
be the same width as mosaic graphics characters, and I think we could
do with a space that doesn't get changed by 'palt'.
2024-09-26 13:31:51 +01:00
Ben Harris
b8afbee0dc Update version to 002.007 2024-09-24 14:26:49 +01:00
Ben Harris
413f3839ec Improve comment to explain glyph ordering 2024-09-23 20:02:45 +01:00
Ben Harris
ac5d5697d8 Add PUA code points for extra real glyphs 2024-09-23 16:28:35 +01:00
Ben Harris
c5b858632b Add PUA mappings for separated 4-cell graphics
I'm a bit uncertain about this because I currently think these glyphs
shouldn't be in Bedstead at all.  They're not based on any real system
or standard, so they don't really have any good reason to be here.
But here they are nonetheless, at least until Bedstead 003.000.  So
while I don't really want to encourage their use, I think gratuitously
leaving them difficult to use will just annoy anyone who actually has
a use for them and they thus deserve encodings.
2024-09-23 16:22:59 +01:00
Ben Harris
9ef892af51 Assign PUA code points for new small-cap glyphs 2024-09-23 15:52:01 +01:00
Ben Harris
6478104be6 Generate *.sep6 aliases the same way as contiguous versions
That is, not generating aliases at all, becuase that's simpler and
actually makes the OTF file smaller.  Which makes me wonder if all
aliases should be done the same way, leaving FontForge to
automatically factor out common bits.
2024-09-23 15:16:36 +01:00
Ben Harris
5abc741345 Complicate the macro that generates contiguous mosaic graphics
It's now inkvoked the same way as the one that generates separated
graphics, which means those invocations can fit into eight fewer
lines.
2024-09-23 14:36:32 +01:00
Ben Harris
8c0b64ea58 Slight mosaic graphics rationalisation
All the *.sep6 glyphs are now aliases for their proper Unicode 16
names.  And the 6-cell mosaic graphics are now in the section for
glyphs from real character generators, because that's what they are.
2024-09-23 14:17:21 +01:00
Ben Harris
79d845618b Add separated mosaic graphics at Unicode 16.0 code points
That's U+1CE51 .. U+1CE8F.
2024-09-22 11:15:30 +01:00
Ben Harris
874a12b047 Put bitmap data and alias target into a union
A character can't both be an alias and have its own bitmap data, so we
may as well overlap them.  Wrapping them in a union doesn't require any
changes to the syntax of the glyphs array because C allows for
incomplete bracketing of initialisers.  Because the union doesn't have a
name, its members can be accessed as though they're members of the
containing struct, which means that accesses to them don't need to
change.

There is a new flag to mark a glyph as an alias since "alias_of == NULL"
no longer works, and a corresponding change to the ALIAS() macro.

This saves about 20K of bedstead's data segment on a 64-bit system,
which is kind of silly but it's satisfying nonetheless.
2024-08-18 14:25:10 +01:00
Ben Harris
f6a4441d41 Output glyphs in an order that FontForge won't change
FontForge has opinions about what order glyphs in an OpenType font
should appear in, at least some of them being mandated by the OpenType
spec (for instance that .notdef must by glyph 0).  When outputting an
OpenType font, FontForge re-orders it in accordance with these opinions.

I expect that this will be a problem if I want to emit a table that
FontForge doesn't understand, since it won't be able to correct the
glyph indexes in that table.  Thus I've added code to re-order the
glyphs in Bedstead such that FontForge won't re-order them.  This should
mean that bedstead.c can safely use the glyph indexes that it generates
without worrying that FontForge might change them.

I don't think FontForge minds what order unencoded glyphs appear in, but
I've defined them to be in strcmp() order of glyph name so that they're
at least somewhat stable.  Before this, they were in the same order as
in the source file.
2024-08-18 13:29:07 +01:00
Ben Harris
214c39a929 Tidy up function definitions
Consistently put a newline before each function name, and use "void"
as the parameter list of functions that take no parameters.
2024-08-18 13:18:50 +01:00
Ben Harris
d196eef561 Use the global nglyphs variable in glyph_complement() 2024-08-17 00:11:11 +01:00
Ben Harris
cbbb1a6533 Convert indentation to tabs where it had been spaces
Now that at least my own edits shouldn't break this.
2024-07-10 21:01:45 +01:00
Ben Harris
69dafd7b02 Add Emacs file variables to bedstead.c
These set the C indentation style and tab usage to what's traditional
in this file.
2024-07-10 20:57:27 +01:00
Ben Harris
e6128359b5 Condense weight and width tables
They're really very small and putting each weight and width on a
single line makes them much more readable.
2024-07-10 14:58:15 +01:00
Ben Harris
1281b34c53 16-bit safety, maybe
Bedstead claims to be written in ISO C.  ISO C allows "int" to be only
16 bits wide, which is a bit of a problem.  In fact, it's not much of
a problem because Bedstead mostly deals in small numbers.  The main
exception is Unicode code points, which can exceed 16 bits.

To hopefully fix this, Bedstead now mostly uses "long" for Unicode
code points.  The main exception is in the gklph table where that
seems a bit profligate on 64-bit systems so I've used int_least32_t
instead.

The fiddliest bits of this are around uses of printf(), which cares
whether it's being passed an "int" or a "long".

This is untested on an actual 16-bit system, but at least on a 64-bit
system it continues to produce correct results.
2024-07-10 14:57:49 +01:00
Ben Harris
08bbcb04f6 Use bool, true, and false in more places
There were still places where I was storing booleans in int variables
and explicitly using 0 and 1.
2024-07-10 14:47:34 +01:00
Ben Harris
c9ce6d79a9 Adjust comments to match case of characters
Specifically this changes the comments on IPA characters to refer to
them in lower-case even though the official names of these characters
are upper-case.  I did this because it was annoying not being able to
tell the case of a letter from its comment.
2024-07-07 16:14:56 +01:00
Ben Harris
3a5f15e112 Latin small caps complete (probably) 2024-07-07 00:33:31 +01:00
Ben Harris
036d2b3e15 New question mark for SAA5051 and SAA5052
It's a different shape from the one used by the other chips.  Checked
against the 1982 datasheet and a real SAA5051.
2024-06-24 23:24:30 +01:00
Ben Harris
1d7a9aa164 Improvements to SAA5051 and SAA5052 characters
In addition to their obviously distinctive national characters, the
SAA5051 and SAA5052 also change the shape of some standard characters
compared to the SAA5050.  I had spotted some of these, but noticed
several more when using an actual SAA5051 in my Acorn System 3.  The
unusual characters are apparently much easier to spot on screen than
in a datasheet.

Now, I think, we actually have the correct characters for each of
these chips.  In many cases, they're the same as one another, and in
those cases I've aliased the glyphs.
2024-06-20 23:06:14 +01:00
Ben Harris
fb5e209f40 U+2139 TURNED NOT SIGN 2024-06-04 14:59:09 +01:00
Ben Harris
6700ff3672 Re-order OpenType lookups to be more sensible
The small-caps and 'rtlm' lookups now come before the stylistic sets.
This is appropriate because the former make changes to the semantics
of characters and so should take priority over mere stylistic changes.
'palt' comes last because it can only reasonably be applied to the
actual glyphs being rendered.
2024-06-03 00:50:38 +01:00
Ben Harris
3da2d72ab3 Small caps for Latin Extended-A 2024-06-02 21:57:14 +01:00
Ben Harris
8a95a216d3 Latin-1 small caps
Almost no new glyphs, because the existing accented caps glyphs are
themselves small.  I'm not quite sure which glyphs small caps need to
be visually distinct from, so for now I won't worry about that.
2024-06-02 20:55:38 +01:00
Ben Harris
ae6caa5bd8 Re-organise Latin small caps (no functional change)
I liked the approach I took with 'rtlm' of putting variant glyphs next
to the standard ones in the glyph array.  So I've tried doing the same
with small caps.  Each small cap appears at least twice.  For ones with
real Unicode code points, the 'c2sc' version is an alias for the native
one.  For small caps without Unicode code points, the 'c2sc' version is
the actual small cap glyph.  In either case, the 'smcp' version is an
alias for the 'c2sc' one.  This is a change from the previous setup,
where the 'c2sc' version was an alias for the 'smcp' one instead.  I've
swapped them because the small cap glyph is generally based on the full
cap, so putting them together seems sensible.
2024-06-02 20:16:27 +01:00
Ben Harris
4757465cde Stop trying to create a 'gasp' table
As far as I can tell, the "GaspTable" line that I put in the SFD file
has never actually worked.  I don't think I want it to anyway: even
when the source pixels line up precisely with the display pixels, it's
still worth having anti-aliasing on the diagonal lines.  And of course
none of this would work properly for any width other than the default
one.

So overall, it doesn't work, and if it did I'd want it to stop.  So
let's remove it.
2024-06-02 17:55:08 +01:00
Ben Harris
0f03141ebd Redesigned U+2203 THERE EXISTS
There seems to be a consensus that the three bars should be the same
length, and that distinguishes the 'rtlm' version from a capital 'E'.
2024-06-02 16:55:05 +01:00
Ben Harris
a8f205ad4c Add Private Use Area mapping for 'rtlm' glyphs
I've gone for U+F100 upwards because I expect there to be more than the
31 I've currently got.
2024-06-02 16:50:51 +01:00
Ben Harris
1c64ed5016 New 'rtlm' versions of subset/superset tilde
These versions have the tilde reversed, which I think is the right
thing to do.
2024-06-02 14:21:57 +01:00
Ben Harris
aa596a604b Alias mappings for 'rtlm'
These are characters that have the Bidi_Mirroring_Glyph but don't
appear in the OpenType Mirroring Pairs List (OMPL).  In a couple of
cases, these are listed by Unicode as "best fit" and I think I should
actually redraw the tildes the other way around.
2024-06-02 14:21:57 +01:00