latex3 / fontspec

Font selection in LaTeX for XeTeX and LuaTeX
http://latex3.github.io/fontspec/
LaTeX Project Public License v1.3c
276 stars 34 forks source link

Auto-detect monospace fonts #99

Open wspr opened 13 years ago

wspr commented 13 years ago

By testing the widths of the i and m 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.

wspr commented 13 years ago

See additional (excellent) comments here.

khaledhosny commented 11 years ago

I think we should not bother with auto-detection and just set the correct \fontdimens 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: