New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-detect monospace fonts #99

Open
wspr opened this Issue Feb 27, 2011 · 2 comments

Comments

Projects
None yet
2 participants
@wspr
Owner

wspr commented Feb 27, 2011

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

This comment has been minimized.

Owner

wspr commented Feb 28, 2011

See additional (excellent) comments here.

@khaledhosny

This comment has been minimized.

Contributor

khaledhosny commented Mar 4, 2013

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:

  • 3 (stretch): 0pt
  • 4 (shrink): 0pt
  • 7 (extra space): the same as 2 (space)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment