Skip to content
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

Make tnum punctuation context sensitive #647

Open
HolgerGerhardt opened this issue Nov 25, 2023 · 6 comments
Open

Make tnum punctuation context sensitive #647

HolgerGerhardt opened this issue Nov 25, 2023 · 6 comments
Labels
Add Enhancement, Improvement, addition or new feature technical About a technical aspect like font file format details

Comments

@HolgerGerhardt
Copy link

HolgerGerhardt commented Nov 25, 2023

Describe the bug
Activating tabular figures changes kerning/spacing of hyphen and other glyphs—such as quotation marks adjacent to periods or commas.

To Reproduce
Select tabular figures for (some part of) your text, including characters, punctuation, and hyphens—that is, not only for figures. More precisely, the hyphen becomes exactly as wide as the tabular figures. This can also be observed on https://rsms.me/inter/lab/?compare=system&feat-tnum=1&sample=Kerning%20misc.

Expected behavior
The spacing of the hyphen in-between words should not change. If anything, it should only change in-between numbers. Using contextual alternatives does not help: All it does is moving the hyphen upward in-between figures.

Screenshots
Inter-hyphen

Environment

  • OS: macOS 13.6.2
  • Microsoft Word
  • Version of font: Inter[-Regular, -Bold, -Italic, …] Version 4.000;git-a52131595
@HolgerGerhardt
Copy link
Author

An additional remark: I am not sure what motivated this design choice. Is it because some people use the hyphen as a minus sign? If so, maybe you could implement the figure-wide hyphen as a contextual alternate that is activated only if it is sandwiched by two figures or preceded by a space and followed by a figure.

@TaigaYamada
Copy link

I think #227 is the context behind the design decision.

@HolgerGerhardt
Copy link
Author

HolgerGerhardt commented Nov 25, 2023

Thanks for the pointer! The issue is that hyphen.tf has figure width, not punctuation width. The hyphen is not a minus sign—even if people often use it in that way—so I am not sure whether it should be treated as such.

As @rsms mentioned himself,

users generally enable tnum carte blanche on text,

leading to the issue that I reported.

Foreseeing this very type of “compromises in spacing,” @thomas-lowry stated

I do like the idea of a stylistic set, that way it doesn't become a default for tnum that a designer is forced to use.

@HolgerGerhardt
Copy link
Author

By the way, I realised that the spacing of /hyphen__ (U+2010) and /hyphennobreak (U+2011) is reduced in comparison to the spacing of /hyphen (U+002D).

Is this intended?

@rsms
Copy link
Owner

rsms commented Nov 27, 2023

This is indeed by design. tnum should be enabled only for text ranges that are actual numeric values & punctuation, not for entire paragraphs of text.

@HolgerGerhardt: I am not sure what motivated this design choice. Is it because some people use the hyphen as a minus sign? If so, maybe you could implement the figure-wide hyphen as a contextual alternate that is activated only if it is sandwiched by two figures or preceded by a space and followed by a figure.

Indeed this is the reason; lots of people use hyphen instead of minus. You can even see this in places where you would expect proper typography, like online bank statements. Inter is designed to work well in "the real world" and sometimes compromises like this is needed. Same goes for lots of the technical aspects. For example, the variable font uses format 1 STAT records to be compatible with Microsoft Word, even though it means not supporting advanced style linking supported by other software.

So I'd much rather have users apply tnum to ranges of numeric text and the implementation be reliable rather than supporting "apply tnum to paragraph" with potentially unexpected results.

What you're suggesting—with adding OT code to smartly insert tabular glyphs only where needed— is a good idea but is quite a bit of work, both implementation and QA. There are lots of glyphs that participate in tnum which would need inter-dependent rules. i.e. just "checking" for surrounding digits wouldn't be enough; e.g. 12.- (currency without cents in some locales) would not be correct in that case as the "wrong" hyphen would be used.

@HolgerGerhardt
Copy link
Author

HolgerGerhardt commented Nov 30, 2023

First of all, a big thank you, @rsms, for creating—and continuously extending—this amazing typeface and making it available as an open-source font!

I fully understand the compromises involved.

  1. I understand the choice to enable proportional figures by default.
    On the one hand, this will puzzle some users—who will wonder why the numbers in a table are not aligned, why the page numbers in a table of contents are not aligned, or why the dates in a tabular CV are not aligned.
    On the other hand, it improves the aesthetic of body text.

  2. Given that proportional numbers are the default, I also understand the design choice to adjust the spacing of the hyphen (and other punctuation marks) when tabular figures are enabled.
    I still think, however, that it would be great to be able to enable/disable the adjusted spacing via a stylistic set, as you suggested yourself in Additional monospaced characters when using tabular figures #227 (comment).

  3. Given the de facto hybrid role of the hyphen-minus, why not go “all the way”? That is, why only adjust its spacing when tabular figures are enabled—why not also adjust its shape when proportional figures are enabled?
    What I have in mind is making hyphen.tf a bit wider than the default hyphen.
    Earlier versions of MATLAB included a wide hyphen that was de facto a minus sign, which makes sense given that the hyphen-minus is primarily used as a minus sign in a mathematical software package. See the axis ticks in this example plot: http://www.ece.northwestern.edu/local-apps/matlabhelp/techdoc/ref/graphiaa.gif.
    I think a wider hyphen.tf would also make sense for Inter and would make Inter, with tnum enabled, a perfect font for labelling axes in plots and for formatting numerical input and output fields that may include negative values on web pages (like in the online bank statements that you mentioned).

PS: I have seen tnum-dependent spacing once before, in Akkurat. In Akkurat, all punctuation marks, the plus sign, and also the interword space become figure-wide when tabular figures are enabled. Funnily, in Akkurat, the hyphen-minus is not affected:

Akkurat

@rsms rsms changed the title Activating tabular figures in Inter v4.0 changes kerning/spacing of hyphen and other glyphs Make tnum punctuation context sensitive Mar 23, 2024
@rsms rsms added Add Enhancement, Improvement, addition or new feature technical About a technical aspect like font file format details labels Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Add Enhancement, Improvement, addition or new feature technical About a technical aspect like font file format details
Projects
None yet
Development

No branches or pull requests

3 participants