Open wspr opened 13 years ago
I think we should not bother with auto-detection and just set the correct \fontdimen
s with \setmonofont
and may be provide and option to do the same for other font loading comments. For documentations purposes, the dimensions to be set are:
By testing the widths of the
i
andm
glyphs, we should be able to check whether the current font is monospaced. In which case, we should specify sensible defaults for the WordSpace and PunctuationSpace options -- for the latter, even an option to add two ‘spaces’ instead of one might be a nice customisation.These should also be controlled by an explicit fontspec font feature that is not passed to fonts loaded with \setmonofont but can be if desired (because the heuristic fails or the user wants to bypass the test, for efficiency). I.e., \setmonofont will still detect monospace fonts according to the feature above, but if you load a non-monospace font here (the command should really be called
\setcodefont
) we don't want the spaces to be screwed up.