chiark / gitweb /
bedstead.git
4 months agoEmit AlternateSets for 'aalt' overrides
Ben Harris [Wed, 1 Jan 2025 23:18:13 +0000 (23:18 +0000)]
Emit AlternateSets for 'aalt' overrides

These are just emitted after the standard AlternateSets, and because
of how TTX works, they end up overriding the standard ones.  This
seems a bit dodgy to me, so I might try to do better later.

4 months agoAdd data for overriding 'aalt' sometimes
Ben Harris [Mon, 30 Dec 2024 23:15:54 +0000 (23:15 +0000)]
Add data for overriding 'aalt' sometimes

Not used yet.

4 months agoSort glyph names in compatcheck
Ben Harris [Sun, 29 Dec 2024 18:45:47 +0000 (18:45 +0000)]
Sort glyph names in compatcheck

4 months agoNew shape for SAA5054 ugrave (now ugrave.roundjoined)
Ben Harris [Fri, 27 Dec 2024 18:56:38 +0000 (18:56 +0000)]
New shape for SAA5054 ugrave (now ugrave.roundjoined)

I just got an SAA5054 (date code 8510) and the character it has at 5/13
is different from the one in the datasheet.  The real one lacks the
pixel in the bottom right corner, so it's more like a Ugrave than a
ugrave.  However, it would be weird for a character set to include the
capital but not the lower case, and the corresponding character set in
ETS 300 706: May 1997 (the French option in table 36) is obviously
lower-case.  So I think it's semantically lower-case, whatever it looks
like.

As for the thing I was intending to check, yes the accent does join onto
the letter.

4 months agoAdd @font-feature-values to bedstead-faces.css
Ben Harris [Fri, 27 Dec 2024 12:08:37 +0000 (12:08 +0000)]
Add @font-feature-values to bedstead-faces.css

This means that users of this stylesheet can use declarations like
"font-variant: styleset(saa5051)" to request a particular stylistic set.
The separated graphics sets, 'ss14' and 'ss16', are not covered by this
because new applications should use the proper Unicode code points for
separated graphics instead.

4 months agoUse new generic glyph names in rom.ps
Ben Harris [Fri, 27 Dec 2024 11:58:32 +0000 (11:58 +0000)]
Use new generic glyph names in rom.ps

Output confirmed to be unchanged

4 months agoPut feature tag in a comment in each <Lookup> in TTX
Ben Harris [Tue, 24 Dec 2024 00:25:54 +0000 (00:25 +0000)]
Put feature tag in a comment in each <Lookup> in TTX

Now that the ssXX features don't have fixed suffixes it's useful to
have something to say which is which.

4 months agoCheck OS/2.achVendID in compatcheck
Ben Harris [Mon, 23 Dec 2024 23:39:20 +0000 (23:39 +0000)]
Check OS/2.achVendID in compatcheck

My GNU Emacs configuration ended up using this to select its default
font, so it should remain constant within a major version.

4 months agoAdd name checking to compatcheck
Ben Harris [Mon, 23 Dec 2024 23:22:45 +0000 (23:22 +0000)]
Add name checking to compatcheck

This tries to ensure that sensible ways of specifying a font by name
continue to work across an upgrade.

4 months agocompatcheck: actually exit with failure if a check fails
Ben Harris [Mon, 23 Dec 2024 14:32:09 +0000 (14:32 +0000)]
compatcheck: actually exit with failure if a check fails

4 months agoAdd a comment explaining what compatcheck does
Ben Harris [Mon, 23 Dec 2024 14:25:42 +0000 (14:25 +0000)]
Add a comment explaining what compatcheck does

4 months agoSN74S262/3 pinout
Ben Harris [Sun, 22 Dec 2024 00:53:37 +0000 (00:53 +0000)]
SN74S262/3 pinout

The XM11 application note mentions "two chip enables", which can only
be pins 14 and 15.

4 months agoMore descriptive names for variant characters
Ben Harris [Fri, 20 Dec 2024 21:41:29 +0000 (21:41 +0000)]
More descriptive names for variant characters

This means yet more compatibility aliases, but I think it's the right
way to go.

4 months agoRedesign how stylistic sets for particular chips work
Ben Harris [Fri, 20 Dec 2024 16:42:23 +0000 (16:42 +0000)]
Redesign how stylistic sets for particular chips work

The old approach was that each stylistic set had a distinct glyph-name
suffix, the same way that small caps or right-to-left mirrored glyphs
did. This meant that when several chips used the same alternative
glyph, there needed to be a separate alias for each chip.  This was
slightly awkward for just the SAA5051 and SAA5052, but I'd like to add
coverage for the SN74S262 and SN74S263, and those share some of the
same glyphs as well.

So now those stylistic sets have an explicit list of which variant
glyphs they include, and my plan is that each variant glyph will have
a single canonical name.  They'll still have to keep the existing
names for compatibility.  Indeed, for now that's what they're using
because that makes checking the output easier.

No change to the resulting font, though the lookups do end up in a
different order in the TTX file.

4 months agoSwap scripts and suffix members of struct gsub_feature
Ben Harris [Thu, 19 Dec 2024 13:46:58 +0000 (13:46 +0000)]
Swap scripts and suffix members of struct gsub_feature

Every feature must have a scripts list, but "suffix" is only one way
you might select lookups to generate.  Putting it at the end makes it
easier to leave it out.  Indeed, our existing 'aalt' lookup omits it.

This causes no change to the generated fonts.

4 months agoRemove ASCII dependency
Ben Harris [Tue, 17 Dec 2024 10:58:16 +0000 (10:58 +0000)]
Remove ASCII dependency

ISO C doesn't guarantee that the execution character set is ASCII, or
anything like it.  Bedstead tries to require only ISO C, but it used
strcmp() to sort glyph names and so the output depended on the sort
order of characters.  Moreover, the code for finding variants of
characters required that '.' have a lower value than any other
character that appeared in glyph names.

To avoid this dependency, we now have a table that assigns values to
each character that can appear in glyph names, and a strcmp-compatible
function that compares two strings after mapping through that table.
This means that our sort order is explicitly specified in the code,
and also provides a convenient place to catch unusual characters in
glyph names.

This change has no effect on the output TTX files (at least on an ASCII
system).  All remaining uses of strcmp() are testing solely for
equality.

4 months agoCorrect the size of the parameter to glyph_footprint()
Ben Harris [Mon, 16 Dec 2024 22:27:24 +0000 (22:27 +0000)]
Correct the size of the parameter to glyph_footprint()

4 months agoFix the length of an accidentally variable-length array
Ben Harris [Mon, 16 Dec 2024 22:22:01 +0000 (22:22 +0000)]
Fix the length of an accidentally variable-length array

4 months agoRange-check argument to --bdfgen
Ben Harris [Mon, 16 Dec 2024 21:49:16 +0000 (21:49 +0000)]
Range-check argument to --bdfgen

4 months agoChange parameters of moveto() and lineto() to signed
Ben Harris [Mon, 16 Dec 2024 21:40:36 +0000 (21:40 +0000)]
Change parameters of moveto() and lineto() to signed

The corresponding members of struct vec are signed, as are most of the
arguments passed to the functions, so it's silly that the parameters
themselves are unsigned.  This takes the number of warnings under
clang -Weverything down from 126 to 30.

This doesn't cause any change to the output TTX files.

4 months agoRemove an unnecessary shadowing variable
Ben Harris [Mon, 16 Dec 2024 21:31:21 +0000 (21:31 +0000)]
Remove an unnecessary shadowing variable

4 months agoAdd a few missing "static" keywords
Ben Harris [Mon, 16 Dec 2024 21:26:35 +0000 (21:26 +0000)]
Add a few missing "static" keywords

4 months agocompatcheck: detect vanished code points from fonts
Ben Harris [Sat, 14 Dec 2024 16:41:51 +0000 (16:41 +0000)]
compatcheck: detect vanished code points from fonts

4 months agoAdd a script to check backward compatibility
Ben Harris [Sat, 14 Dec 2024 16:04:46 +0000 (16:04 +0000)]
Add a script to check backward compatibility

4 months agoSome notes on TIFAX
Ben Harris [Wed, 11 Dec 2024 22:34:53 +0000 (22:34 +0000)]
Some notes on TIFAX

4 months agoNote the existence of HACKING in CONTRIBUTING
Ben Harris [Mon, 9 Dec 2024 21:45:36 +0000 (21:45 +0000)]
Note the existence of HACKING in CONTRIBUTING

5 months agoSmall caps for new additions
Ben Harris [Sun, 8 Dec 2024 18:48:30 +0000 (18:48 +0000)]
Small caps for new additions

5 months agoA few modified Bs
Ben Harris [Sun, 8 Dec 2024 18:19:52 +0000 (18:19 +0000)]
A few modified Bs

5 months agoAssign a PUA code point to Tbar.c2sc
Ben Harris [Tue, 3 Dec 2024 18:44:07 +0000 (18:44 +0000)]
Assign a PUA code point to Tbar.c2sc

5 months agoMerge new characters and minor fixes
Ben Harris [Tue, 3 Dec 2024 18:38:39 +0000 (18:38 +0000)]
Merge new characters and minor fixes

Converted to the new string-constant format in the process.

5 months agoA few additions, mostly to fill out Teletext character sets
Neil Williamson [Mon, 25 Nov 2024 00:14:52 +0000 (00:14 +0000)]
A few additions, mostly to fill out Teletext character sets

[ from email ]

2. Regular unicode characters: a few additions, mostly to fill out
compatibility with Teletext character set ranges that were otherwise
almost-complete (which is basically everything except Arabic at this point)
per this reference page: https://al.zerostem.io/~al/ttcharset/[al.zerostem.io]  
Some of the cyrillic additions are a bit dubious, but hopefully close enough
to pass.

5 months agoAdd some warning flags to the C compiler
Ben Harris [Tue, 3 Dec 2024 13:58:25 +0000 (13:58 +0000)]
Add some warning flags to the C compiler

I've chosen ones under which bedstead.c is currently clean, at least
using the versions of GCC and Clang currently in Debian stable.

5 months agoCorrect a printf %lX argument type
Ben Harris [Tue, 3 Dec 2024 13:07:01 +0000 (13:07 +0000)]
Correct a printf %lX argument type

Also change another from "long" to "unsigned long" for consistency.

5 months agoSet -dNOSAFER when running .bdf.ps programs
Ben Harris [Wed, 27 Nov 2024 13:43:42 +0000 (13:43 +0000)]
Set -dNOSAFER when running .bdf.ps programs

Ghostscript 10.03.1 and later disable the "makeimagedevice" operator
when running under -dSAFER.  Even --permit-devices='*' isn't enough to
get it back.  The release notes say that makeimagedevice has been
removed entirely, but that seems not to be correct.

5 months agoStop using %stdout for writing BDF files
Ben Harris [Wed, 27 Nov 2024 10:41:17 +0000 (10:41 +0000)]
Stop using %stdout for writing BDF files

Instead, pass the destination filename to the bdf.ps program and have it
open the file itself.  This avoids capturing Ghostscript's own
diagnostics in the output file.

5 months agoCorrect a comment in rom.ps
Ben Harris [Wed, 27 Nov 2024 10:30:20 +0000 (10:30 +0000)]
Correct a comment in rom.ps

It can make all ROM images now.

5 months agoConvert ZVBI Private Use codepoints to compatibility aliases
Ben Harris [Tue, 26 Nov 2024 22:11:11 +0000 (22:11 +0000)]
Convert ZVBI Private Use codepoints to compatibility aliases

That saves 4K of font file, which is nice.

5 months agoCorrect compatibility mapping of Wdieresis.sc
Ben Harris [Tue, 26 Nov 2024 21:06:51 +0000 (21:06 +0000)]
Correct compatibility mapping of Wdieresis.sc

It will be generated if 'smcp' is applied to Wdieresis, and the
correct result of that is no change, since 'smcp' doesn't affect
capitals.

5 months agoConvert 6-cell ".sep6" glyphs into compatibility aliases
Ben Harris [Tue, 26 Nov 2024 20:59:47 +0000 (20:59 +0000)]
Convert 6-cell ".sep6" glyphs into compatibility aliases

5 months agoAdd COMPAT to a bunch more aliases
Ben Harris [Tue, 26 Nov 2024 20:29:09 +0000 (20:29 +0000)]
Add COMPAT to a bunch more aliases

5 months agoAdd a flag to explicitly mark compatibility aliases
Ben Harris [Tue, 26 Nov 2024 14:34:15 +0000 (14:34 +0000)]
Add a flag to explicitly mark compatibility aliases

Only used on a few characters for now, though.

5 months agoMark obsolete characters in the glyph complement
Ben Harris [Tue, 26 Nov 2024 02:03:23 +0000 (02:03 +0000)]
Mark obsolete characters in the glyph complement

A technique only slightly spoiled by the fact that nothing flags
obsolete characters yet, so it's actually marking every alias instead.
Still, it puts a nice diagonal bar across the affected characters
telling you to use a different one, which looks nice but may
obliterate the character rather _too_ effectively.

5 months agoActual aliases for old names of separated 4-cell graphics
Ben Harris [Mon, 25 Nov 2024 22:44:19 +0000 (22:44 +0000)]
Actual aliases for old names of separated 4-cell graphics

That saves a few hundred bytes from the OTF.

5 months agoMove *.sep4 glyphs to compatibility aliases
Ben Harris [Mon, 25 Nov 2024 22:24:35 +0000 (22:24 +0000)]
Move *.sep4 glyphs to compatibility aliases

We've now got proper Unicode versions of them.

5 months agoCorrect separated vs contiguous flag in ZVBI compat mappings
Neil Williamson [Mon, 25 Nov 2024 00:14:52 +0000 (00:14 +0000)]
Correct separated vs contiguous flag in ZVBI compat mappings

[ from email ]

One thing I wanted to query was the ZVBI mosaic graphics codepoints at
0xEE00 to 0xEE7F.  The ZVBI code says (in lang.c):

" Table 47 G1 Block Mosaic is not representable
* in Unicode, translated to private code U+EE00 ... U+EE7F.
* (contiguous form has bit 5 set, separate form cleared)."

My reading of this is that the separated forms should therefore sit at
0xEE00-0xEE1F and 0xEE40-0xEE5F, with the contiguous forms at 0xEE20-0xEE3F
and 0xEE60-0xEE7F.  This is indeed what the teletext1/2/4 fonts commonly
seen in teletext recoveries do; see for example
https://al.zerostem.io/~al/teletext/bbc1/1996-12-28-0008.1/100.html.
Bedstead maps these the opposite way around, however, and if you swap it in
on the linked page, all the contiguous and separated mosaics will swap
places.

5 months agoBeginning of notes on HP terminal large letters
Ben Harris [Mon, 25 Nov 2024 19:40:15 +0000 (19:40 +0000)]
Beginning of notes on HP terminal large letters

5 months agoAdd 4-cell separated graphics at their proper Unicode code points
Ben Harris [Mon, 25 Nov 2024 10:35:39 +0000 (10:35 +0000)]
Add 4-cell separated graphics at their proper Unicode code points

I hadn't noticed that they're included in the Symbols For Legacy
Computing Supplement as well.  Apparently they were part of the Sharp
MZ character set.

5 months agoUpdate version in which Wdieresis.sc alias was added
Ben Harris [Sun, 24 Nov 2024 20:17:17 +0000 (20:17 +0000)]
Update version in which Wdieresis.sc alias was added

5 months agoSomething I missed from the 3.246 release notes
Ben Harris [Sun, 24 Nov 2024 20:15:05 +0000 (20:15 +0000)]
Something I missed from the 3.246 release notes

Too late for the actual release, sadly.

5 months agoUpdate version to 3.246 bedstead-3.246
Ben Harris [Sun, 24 Nov 2024 16:23:45 +0000 (16:23 +0000)]
Update version to 3.246

New major version for vendor and foundry IDs and removing Mac Roman
support.  Minor version indicates the sixth release of 2024.

5 months agoAdjust bitmap of supported code pages
Ben Harris [Sat, 23 Nov 2024 20:03:36 +0000 (20:03 +0000)]
Adjust bitmap of supported code pages

I've removed the Turkish code pages because I don't have letters with
breves yet.  And I've removed the Latin-2 code pages because I haven't
come up with a good way to distinguish accented upper- and lower-case
'S'.

5 months agoRemove some Unicode Character Range bits
Ben Harris [Sat, 23 Nov 2024 15:04:56 +0000 (15:04 +0000)]
Remove some Unicode Character Range bits

I don't think Bedstead has enough coverage of these ranges to consider
them to be "functional":

47: Dingbats
62: Alphabetic Presentation Forms
68: Halfwidth and Fullwidth Forms
69: Specials
88: Musical Symbols + Byzantine + Ancient Greek
89: Mathematical Alphanumeric Symbols

5 months agoNote what the various Unicode-range and code-page bits in 'OS/2' mean
Ben Harris [Fri, 22 Nov 2024 14:17:55 +0000 (14:17 +0000)]
Note what the various Unicode-range and code-page bits in 'OS/2' mean

I haven't actually checked whether they're right, though.

5 months agoComment explaining sFamilyClass
Ben Harris [Fri, 22 Nov 2024 13:49:06 +0000 (13:49 +0000)]
Comment explaining sFamilyClass

5 months agoMerge line-drawing changes into pre-release trunk
Ben Harris [Thu, 21 Nov 2024 21:02:34 +0000 (21:02 +0000)]
Merge line-drawing changes into pre-release trunk

5 months agoMusical stave characters should join to the left
Ben Harris [Sun, 27 Oct 2024 11:21:05 +0000 (11:21 +0000)]
Musical stave characters should join to the left

5 months agoSeparate flags for copying left column and top row
Ben Harris [Sat, 26 Oct 2024 21:42:27 +0000 (22:42 +0100)]
Separate flags for copying left column and top row

Having a way to specify that the half-brackets extend upwards but not
leftwards avoids all the rendering problems they were previously
suffering from.  And I've spotted the VT100 scan-line characters,
which should be extended to the left but not upwards.  Since the
middle scan-line is unified with a line-drawing character, they really
need to extend leftwards for symmetry, but extending scan-line 1
upwards would be a disaster.

So now there are two flags, JOIN_U and JOIN_L, to specify joining in
each direction.  I've renamed the both-directions flag as JOIN,
because it's not just specific to line-drawing any more.  I might
eventually want a JOIN_D to suppress hinting of the bottom edge of the
character, but I need to do some testing first.

5 months agoTurn on line-drawing mode on long brackets etc
Ben Harris [Sat, 26 Oct 2024 14:58:01 +0000 (15:58 +0100)]
Turn on line-drawing mode on long brackets etc

It doesn't work quite properly: some characters hit the left side of the
character cell, so I might want to separate the joins-leftward and
joins-upward flags.

5 months agoStop bold line-drawing characters overflowing character cell
Ben Harris [Sat, 26 Oct 2024 11:23:28 +0000 (12:23 +0100)]
Stop bold line-drawing characters overflowing character cell

In XLFD terms, Bedstead is a "character cell" font, where every
character fits entirely within its cell (defined by advance width,
ascent, and descent).  Bedstead Bold maintained this because it
thickened into the unused column to the left of each character.
However, combining the new continuous line-drawing with emboldening led
to bold line-drawing characters that extended beyond their character
cell.  This led FontForge to make the SPACING property of the BDF file
"M" (for monospace) rather the "C".

This commit simply clips the X co-ordinate of points in a bolded
character at zero.  That's safe because line-drawing characters are
guaranteed not to be doing anything diagonal in the left-most column.
This is slightly ugly, in that the bold characters aren't quite so
algorithmically derived from the non-bold ones, but in most cases
there'll be another line-drawing character to the left anyway.

5 months agoMake line-drawing characters join up
Ben Harris [Sun, 20 Oct 2024 17:10:52 +0000 (18:10 +0100)]
Make line-drawing characters join up

This is done my duplicating the top row of pixels upwards and the left
column leftwards.  This is analogous to what MDA and other IBMish
adaptors do to expand eight-pixel wide characters to nine pixels on screen.

5 months agoIncrease version number for a potential pre-release
Ben Harris [Wed, 20 Nov 2024 20:17:55 +0000 (20:17 +0000)]
Increase version number for a potential pre-release

5 months agoTurn on the ForceBold flag for bold fonts
Ben Harris [Wed, 20 Nov 2024 20:06:02 +0000 (20:06 +0000)]
Turn on the ForceBold flag for bold fonts

As far as I can tell, FreeType ignores it, but I may as well turn it
on in case something pays attention.

5 months agoSlightly ugly hack to bias middle stems upwards
Ben Harris [Wed, 20 Nov 2024 14:25:46 +0000 (14:25 +0000)]
Slightly ugly hack to bias middle stems upwards

By default, FreeType 2.12.1 prefers to move the middle stems of
characters like 'B' and 'e' downwards, which is ugly.  By applying a
tiny tweak to the "hstem" commands for such stems we can persuade
FreeType to move them upwards instead.  This wasn't a problem when we
were using FontForge because FontForge didn't use proper stem hints on
the baseline.

5 months agoFix vertical stem hints on bold condensed fonts
Ben Harris [Tue, 19 Nov 2024 23:38:46 +0000 (23:38 +0000)]
Fix vertical stem hints on bold condensed fonts

The weight needed to be adjusted to allow for the change in width.

5 months agoCorrect bold outlines
Ben Harris [Tue, 19 Nov 2024 23:34:47 +0000 (23:34 +0000)]
Correct bold outlines

The weight-changing code in adjust_weight() depended on the direction
that outlines were drawn in, so when I changed the direction to match
that required by CFF, it started lightening the font when it should have
been boldening it.  A lot of swapping "next" and "prev" has corrected
that.

5 months agoFix left and right edge hints at non-default widths
Ben Harris [Tue, 19 Nov 2024 23:27:05 +0000 (23:27 +0000)]
Fix left and right edge hints at non-default widths

The magic numbers -21 and -20 shouldn't be scaled when the width of the
characters changes.  The easiest way to fix this is to switch to
calculating the hints in actual font units.  Only now of course that
will get bold fonts wrong...

5 months agoQuell a few compiler warnings
Ben Harris [Tue, 19 Nov 2024 23:02:35 +0000 (23:02 +0000)]
Quell a few compiler warnings

5 months agoRemove glyph footprint comment from XML output
Ben Harris [Tue, 19 Nov 2024 23:00:19 +0000 (23:00 +0000)]
Remove glyph footprint comment from XML output

It was only there for debugging and isn't generally helpful.

5 months agoAn idea about version numbers
Ben Harris [Tue, 19 Nov 2024 16:00:00 +0000 (16:00 +0000)]
An idea about version numbers

5 months agoSupport cntrmask and hintmask operators in editor
Ben Harris [Tue, 19 Nov 2024 22:31:57 +0000 (22:31 +0000)]
Support cntrmask and hintmask operators in editor

5 months agoSkip XML comments when reading charstrings in editor
Ben Harris [Tue, 19 Nov 2024 22:27:47 +0000 (22:27 +0000)]
Skip XML comments when reading charstrings in editor

5 months agoEmit cntrmask operators
Ben Harris [Tue, 19 Nov 2024 21:53:16 +0000 (21:53 +0000)]
Emit cntrmask operators

5 months agoCounter-mask support in select_hints()
Ben Harris [Mon, 18 Nov 2024 23:29:57 +0000 (23:29 +0000)]
Counter-mask support in select_hints()

It detects evenly-spaced runs of at least three stems, which is a
surprisingly fiddly thing to code.

5 months agoUse self-explanatory constants to specify alignment zones
Ben Harris [Mon, 18 Nov 2024 14:13:15 +0000 (14:13 +0000)]
Use self-explanatory constants to specify alignment zones

This adds ALEFHEIGHT for the height of Hebrew letters.

5 months agoRemove lower alignment zone at +1 pixel
Ben Harris [Mon, 18 Nov 2024 13:56:58 +0000 (13:56 +0000)]
Remove lower alignment zone at +1 pixel

I think I added it because a lot of mathematical operators (like '+')
have their bottom edge there.  But such operators don't really need
their bottom edges aligned: it's much more important that they should
have their proper shapes and should have their centre lines aligned.

This only slightly improves the rendering of '+' in FreeType 2.12.1:
it's still asymmetric but the asymmetry is in a better direction.
Moreover, some glyphs with descenders like "section" are substantially
improved.

5 months agoMore-or-less functional edge hints
Ben Harris [Sun, 17 Nov 2024 14:03:47 +0000 (14:03 +0000)]
More-or-less functional edge hints

This gets me to the milestone where the new version isn't uniformly
worse than the old one when rendered by FreeType at 10.5 ppem (the
worst size I've found).

The big problem I still have is that letters with three horizontal
stems (like 'B') get their middle stem rounded down in this version
and up in 002.009.  I think this is because FontForge generates and
edge hint and not a stem hint at the bottom of the character, which
also makes bottom stems rather fuzzy.  This version gives sharper
stems, but the characters all end up looking top-heavy.

5 months agoSupport for edge hints in select_hints()
Ben Harris [Sun, 17 Nov 2024 13:43:08 +0000 (13:43 +0000)]
Support for edge hints in select_hints()

Which demonstrated plenty of bugs in the code generating them.
Currently edge hints only appear in a helpful comment.

5 months agoProcess pixels in raster order
Ben Harris [Sun, 17 Nov 2024 10:11:23 +0000 (10:11 +0000)]
Process pixels in raster order

If we're imitating a CRT character generator, obviously we should
process pixels line-by-line, not column-by-column.  But that means
writing "for (y ...)" before "for (x ...)" which isn't the instinctive
way I did it.

So now that's corrected and the Y loops are outside the X loops, which
should make any debugging output easier to follow.  This has been
confirmed not to change FreeType rendering at 10.5 ppem.

5 months agoReverse (almost) all the paths
Ben Harris [Sun, 17 Nov 2024 09:32:14 +0000 (09:32 +0000)]
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

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