It seems that the call to FT_Select_Charmap at read.c:231 does not work for
some fonts, at least. I tried it with a Latin-1 encoded BDF font.
By default, fonttosfnt wants to reencode as Unicode, which is fine. Freetype
finds the Latin-1 encoding of the BDF font, and thus decides it needs to be
reencoded, although for some reason it records the charmap as Unicode (which
is fine, being a superset of Latin-1).
The logic at read.c:228 then tries to select the ft_encoding_none charmap,
which is only valid for bitmap fonts with no encoding (reading the freetype
source, ftobjs.c:3512). But this bitmap font has an encoding, so it is not
allowed.
I think the test at line 228 is bogus: for a symbol font (i.e. one that
declares no encoding) it’s OK to use ft_encoding_none. Otherwise, if we’re
recoding (i.e. we have a mapping) then we should use ft_encoding_unicode. If
we’re in neither case, then we should just use the existing charmap, i.e.
not call FT_Select_Charmap. Hence, this stanza should look something like:
rc = 0; // In case we do nothing
if(symbol)
rc = FT_Select_Charmap(face, ft_encoding_none);
else if(mapping)
rc = FT_Select_Charmap(face, ft_encoding_unicode);
Of course in my case, the selection of a Charmap is a no-op, since it merely
reselects the only charmap in the font.