Is it possible to create a TrueType font that just contains a bitmap font and no vector outlines? I have been attempting to create one using a bdf font in FontForge on Ubuntu, but it doesn't seem to be working. The generated TTF file gives an illegible preview. The bdf font is
here. I am hoping to find a way to somehow use it in Visual Studio Code on Ubuntu.
Comments
I imagine the preview is going to be at some arbitrary size… which might not be the size at which the bitmap(s) are optimized for.
Worse, many modern rendering environments don’t even support embedded bitmaps in TTF, these days. In some cases the embedded bitmaps get removed before rasterizing, for example with Chrome and Firefox, they run the OpenType Sanitizer which specifically removes the EBDT and EBLC tables (that is, the bitmaps).
VS Code uses Electron and therefore Chromium (not Chrome) for rendering, and Chromium uses Blink. I expect Blink uses either FreeType (old!) or Harfbuzz (newer evolution of the same rendering code). Both FreeType and Harfbuzz supported bitmap-only TrueType fonts last time I checked, but that does not mean that every client environment does.
OpenType fonts that contain TrueType outlines should use the value of 0x00010000 for the sfntVersion. OpenType fonts containing CFF data (version 1 or 2) should use 0x4F54544F ('OTTO', when re-interpreted as a Tag) for sfntVersion. [So which magic number would you use for one which contains neither?]
Whether TrueType or CFF outlines are used in an OpenType font...
OpenType fonts may also contain bitmaps of glyphs, in addition to outlines. [my emphasis]
All from https://learn.microsoft.com/en-us/typography/opentype/spec/otff
“.otb” is an invention of the X Consortium; you could call it an unofficial extension as it is not part of the OpenType spec. I would not expect non-Linux environments to support it, but it might work for you?
Maybe you could share your own OTB here to see if it is any different? It seems the distorted shapes you get in the preview at least have a relation to the letters in the original font
(OK, I mean, you can DO it, but the file content will not survive the experience intact.)
In the rather specialized case of pixel fonts, having separate contours when two pixels only touch at a corner is almost certainly preferable, IMO. I am suggesting one could try different apps to see whether one or another does that.