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
[lex] Use \textsc for Unicode character names #5077
Conversation
The "+" in "U+nnnn" could use some shrinking (akin to the "+" in "C++"). This is not yet ready to merge, because I haven't done the full makeover yet. |
I like the smaller text, but why does the "After" image show U+U+000B? |
@tkoeppe , do you have an opinion here? |
I saw that, let me think about it... it's a bit jarring to have the U+nnnn be so large by comparison -- could we perhaps make that smallcaps, too? |
@tkoeppe, tried that. The problem is that the digits stay the same size: |
@tkoeppe, here's everything with simply |
This last variant looks quite nice to me. |
Shame there are no real small-caps-sized numerals in our main font. I'll look a bit more. How are your scaled numerals looking for contrast and weight? |
(But I think we're onto something here.) |
@tkoeppe, see the latest screenshot three comments up. This has scaled digits. |
Can we use actual small-caps letters, and only use scaling for the numerals? That avoids the awkward spacing of capitals (captials aren't designed to be juxtaposed and would normally call for tracking). Can you try this:
(By contrast, the (upper-case) numreals are fine because they are designed to appear together.) |
b5d45dd
to
a738d9a
Compare
@tkoeppe, here's (I'm not seeing a difference compared to all-capitals scaled smaller, but that may be just me.) |
5d4205c
to
33eb7ff
Compare
Look closely, the scaled-down caps are too tight and too thin. The proper small caps are more widely spaced and have the same weight as the other letters. I think this is nice now, we can apply this. |
Hm, I don't think we have a monospaced roman font. How do you feel about using the typewriter font for the hexadecimal digits (but leaving everything else the same)? |
@tkoeppe, here is the monospace variant (including making the |
Yeah, I tried that, too. I'm not sure. Both versions have merit. Normal roman font blends in more nicely but doesn't give us fixed-width codepoints, whereas the codefont stands out a bit more (in the sense of being more disrupting). I think I could live with both versions -- any thoughts or preferences? @burblebee? |
We usually reserve code font for, well, code, i.e. snippets that could reasonably appear in a valid C++ program. U+nnnn is definitely not of that kind. I do see the advantage of using a fixed-width font here, but that doesn't outweigh the disadvantages (more visually disruptive; does not visually connect to/align with the following character name) for me. I do note that given the work applied to use macros for Unicode designators, we're at liberty to quickly change the layout down the road, should we so desire. |
I was also thinking with only making the hex digit sequence use code font, but it's also not that great. OK, let's go with the scaled roman capitals then, that definitely looked nice. And the lack of fixed would only be noticable in tabular settings. (As long as only decimal digits appear, we can use fixed-with numerals from the roman font, too -- that doesn't solve every problem, but maybe there'll be one or two situations where we can lean on that.) |
ff6818c
to
2f6c29d
Compare
and format them using \textsc
Also check for uppercase hex digits inside \ucode and \unicode, which do not work well with \textsc.
Now that we've got that settled, this feels ready to me. Please review carefully that I haven't introduced an accidental change in the numbers or names while restructuring the code to use the new macros. |
Thanks a lot! The smallest capitals for the biggest wins. |
@Eelis: That's because the (hex) numbers are manually scaled, whereas everything else is small-caps. The problem is ultimately that our font doesn't have small-caps numerals, so we're emulating those. The details could be tweaked of course; suggestions welcome. |
@tkoeppe For cxxdraft-htmlgen, I ended up using Eelis/cxxdraft-htmlgen@e5f612d because scaled down capital smallcaps seem to look good in Firefox and Chromium. But I see that in LaTeX, that approach creates too widely spaced letters, so I'm at a loss, sorry. |
Looks like Source Sans Pro has small-caps numerals: https://fonts.google.com/specimen/Source+Sans+Pro Not an option for us unfortunately :-) |
Fixes #5032
The presentation of Unicode character names is ... hurting the eye. Using \textsc improves the situation:
Before:
After:
We could also consider using fixed-width font for the "U+nnnn" part, but maybe it is better to limit fixed-width font to C++-level things, which "U+nnnn" most definitely is not.
@tkoeppe, I'd appreciate your opinion here.