Open mircea3 opened 5 years ago
The TrueType implementation is limited. One of those limitations is that the glyphs are expected to have PostScript names, but names are not required by the TrueType specification. This limitation is actually documented in section 2.1 of the User's Manual. However, the significance is not emphasized: If the characters do not have PostScript names, they will not be found. (Some alternate names are supported, though.)
The PostScript name for the space character is "space", but in Liberation Sans it is named "uni00A0" (as shown in your example), which results in the missing space glyph. The hyphen-minus and semicolon are similarly affected. These are base PostScript glyphs, and the normal practice is to give them the standard PostScript names. Liberation Sans does not do that for these three. However, the other base glyphs do have the standard names.
It is possible to remap the non-space characters using .ftr
:
.ftr R -\[uni00AD]
.ftr R ;\[uni037E]
But the only way I know of to fix the space character is to change the glyph name in the font file, using a font editor like FontForge.
A Rube Goldberg-style workaround might be to set .fspacewidth R 274
in the document (to get the correct space size) and then send the PostScript file through
sed 's/\/uni00A0/\/space/g'
.
It would take considerable effort to fix the TrueType anomalies. I think this is something worth doing, but until it happens my recommendation is to not use TrueType fonts at all--especially non-professionally designed free ones--unless they have been checked for compatibility first.
Thank you for the useful information. (I deleted one comment because of a silly mistake.)
.ftr
is a long request name, so long names need to be enabled with .do xflag 3
near the beginning of the document. Other than that, I'm not aware of any issues with it.
Given the following test file:
The postscript output shows a missing ("box") character between the letters 'a' and 'b'. Manually editing the postscript file seems to fix the problem:
I am not sure whether the problem would be in the software, the font file, etc. The font comes from package fonts-liberation (or ttf-liberation) on Debian.