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

Ligature for 0x (hexadecimal) prefix #98

Closed
hugoferreira opened this issue Jan 27, 2020 · 28 comments
Closed

Ligature for 0x (hexadecimal) prefix #98

hugoferreira opened this issue Jan 27, 2020 · 28 comments
Labels
enhancement New feature or request
Milestone

Comments

@hugoferreira
Copy link

Congratulations on the great job so far! Here's a proposal for enhancement: add a ligature for the 0x prefix used in hexadecimal notation, as found in the Fira Code font. Bonus points for sequences like 128x128.

@philippnurullin philippnurullin added the enhancement New feature or request label Jan 27, 2020
@philippnurullin
Copy link
Member

@hugoferreira Sure, will be added in the future.

@alexeyten
Copy link
Contributor

tonsky/FiraCode#944

@OmegaRogue
Copy link

ligatures for 0b and 0B as binary prefixes would also be nice, and 0X as another hexadecimal prefix

@philippnurullin philippnurullin added this to the v2.002 milestone Jul 16, 2020
philippnurullin added a commit that referenced this issue Oct 21, 2020
Major changes
— Added Greek alphabet #58
— Reworked diacritics #228
— Removed x-height increasing from hinting. Affects non Retina screens. #286 #265 #272 #262 #275
— A lot of tiding up of contours to meet Google Fonts criteria
Other updated and fixes
— Ligature for 0x (hexadecimal) prefix #98
— Lowered horizontal bar in Florin to make it more distinguishable form italic f #129
— Changes the 8 construction to make it more distinguishable from B and 0 #188
— Added Changelog #263
— Variable font correctly grouped in one family with Italics #270
— Reverted to previous construction of f #273
— Corrected OneNote line height #278
— Removed kerning pair #297
— Add Overline #298
— Increased difference between hyphen, en-dash, and em-dash #318
— Removed the "tail" in the italic a
@Ilis
Copy link

Ilis commented Oct 22, 2020

Centered × looks controversial and contradicts other number base specifications

b = 0b1001
o = 0o1067
x = 0×10FF

× means multiplication or dimension, and loose the initial meaning of heX

As an idea I propose such a ligatures:

b = 0₂1001
o = 0₈1067
x = 0₁₆10FF

it may be much nicer

@Omnieboer
Copy link

Omnieboer commented Oct 22, 2020

However attractive and accurate that looks, the problem there would be typing an 'x' on your keyboard, and getting a subscript 16 the width of any other monospace character. Than suddenly, the 2 and 8 have to be the same width as a 16, which has two characters. I've seen some arguing on FiraCode's issues (don't remember which) about also making the b and o smaller and vertically centred, which would solve the consistency problem.

Personally I'd take the subscripts, I think they are much clearer to read and way more 'accurate', but I think that's not a feasible generalized option.

Edit: tonsky/FiraCode#1080 :The issue I was talking about.

@Ilis
Copy link

Ilis commented Oct 22, 2020

Anyway, if we deal with letters, “x” should remain x-letter, not cross.

@mvasilkov
Copy link
Contributor

Yeah, why would "0xFF" turn to "0 times FF"? That's not the meaning of the 0x prefix, never was.

@Omnieboer
Copy link

tonsky/FiraCode#944

Exactly this discussion, most people there seemed to say a cross-looking small x is preferable, judging by the votes. Though I'm not impartial and part of the votes in favour of the cross looking option.

I'm not sure how you mean "x" should remain a letter instead of a cross @Ilis. Are they substantially different?
x X ✕ ☓ ✖ ✗ ✘
I think a difference between a cross product sign and a hexadecimal ligature should be visible, but I'm not sure how it would be possible with 'just a plus turned 45 degrees', unless my lack of experience (as in, none) of designing is showing.

@mvasilkov
Copy link
Contributor

Fira

There's a reason people want JB Mono — the font used for professional software development, and motivated by needs of developers, such as distinguishing things that are fundamentally different.

Fira Code, by contrast, is basically a Comic Sans MS Mono.

@philippnurullin
Copy link
Member

Ok, looks like this feature not making everyone happy.
I will wait a bit more and collect more feedback don't hesitate to leave it. It helps if constructive.

Here is a point from @mvasilkov

Just wanted to point out that the new ligature for the 0x prefix in hexadecimal is misleading:

the multiplication sign between numbers is commonly used for, well, multiplying numbers
0 × N == 0 in most cases
therefore misrepresenting "0xFF" as "0 × FF" actually changes the meaning of the text as written: 255 != 0.
This is also inconsistent with the other prefix notations, such as 0b, 0o, and with the uppercase notation 0X (which stays correct and doesn't turn into multiplication sign).

Please fix / revert.

@Omnieboer
Copy link

Omnieboer commented Oct 22, 2020

Fira

There's a reason people want JB Mono — the font used for professional software development, and motivated by needs of developers, such as distinguishing things that are fundamentally different.

Fira Code, by contrast, is basically a Comic Sans MS Mono.

Hey, there's no need to sling such incredibly hurtful insults at FiraCode 😮
Besides, I wasn't necessarily saying that Fira == right, I was just linking to the exact same discussion that was had before. It seems pointless to simply have the same arguments pro and con when a copy of it already exists on another similar repo.

However, do you actually have something specific to say? Or do you think the whole ligature should just be removed?

The fact is that 0xFF was chosen for hexadecimal at some point in the past and we have to deal with it.
An opinion (that I share) is that it would be nice to have a distinction via ligature for hexadecimal numbers.
My argument for this opinion is that I find it easier to register and 'ignore' the 0x prefix with a ligature, so I can just realise the number following it is hexadecimal and read it as is. It's easier to see the length of the actual number, for instance. The length of a hexadecimal number is otherwise artificially lengthened by the 0x characters. The break in the bottom continuity of the number makes that really easy for me.

If there is another ligature that isn't confused with multiplication, but still makes both the meaning and the character that is present in the background obvious, I'm all for it.

Do you have any ideas for such a ligature?

Otherwise, this discussion may never be resolved. At least, until variable fonts are widespread and one can decide for themselves how they want to see the 0x prefix.

@Omnieboer
Copy link

the multiplication sign between numbers is commonly used for, well, multiplying numbers
0 × N == 0 in most cases
therefore misrepresenting "0xFF" as "0 × FF" actually changes the meaning of the text as written: 255 != 0.
This is also inconsistent with the other prefix notations, such as 0b, 0o, and with the uppercase notation 0X (which stays correct and doesn't turn into multiplication sign).

But how often is there actually going to be confusion in the use case?
I'm not a super seasoned developer, so I might be wrong. Please tell me if so.

But I feel like the case 0xFF being read as 0 times FF(hexadecimal) is non-existent. It makes no sense to ever write that. Besides, if the language requires the prefix, the reader would be looking for the 0x in any hexadecimal number. I'd argue finding the prefix and starting to read the actual number after it, is easier with the ligature as it is in 2.200.

Most people don't read character by character, actual reading is done way faster and by shape. Identifying the shape of the prefix and ignoring it should be easier with the ligature. And finding a hexadecimal and suddenly separating it into an multiplication seems unnatural, but that is just my limited point of view. I'm just saying that things that seem wrong on their own in the change notes may not seem as wrong in context and use.

I do still agree a different ligature would be optimal, but I would have no idea what would convey a hexadecimal number consistently without looking like a multiplication sign. Maybe it's possible to incorporate the leading 0 into the ligature as well, change the entirety of the first two characters to signify the base of the number. Similar as to how the >= ligature completely hides the underlying characters in favour of meaning and readability.

This would also give an opening for other number bases, such as binary and octal.

@mvasilkov
Copy link
Contributor

Re:@Omnieboer Look, I get that ligatures are cool. But if we change the meaning of the text as written in order to get in more ligatures, — is the trade off really worth it?

Sure, like you say, => also turns into an arrow, and hides the equals and greater-than sign. As long as we don't have a competing identical arrow thing meaning something else entirely, it's great.

In this case, it's not; the 0x (which is, zero-ex) gets replaced with 0× (zero multiplied-by). The notation M×N has a pretty universal meaning, and literally nobody gets confused whether 2×4 is a multiplication, or a misspelled hexadecimal 0x04. I think it's as clear cut a case as could be.

But I feel like the case 0xFF being read as 0 times FF(hexadecimal) is non-existent.

It's not what I read, it's what you write. It makes no sense to ever write that. 0 times FF is not a thing.

However, do you actually have something specific to say? Or do you think the whole ligature should just be removed?

IMO it should be removed to improve readability.

Hey, there's no need to sling such incredibly hurtful insults at FiraCode

But everyone loves Comic Sans! :)

@Omnieboer
Copy link

I wonder what is possible in the two character space of the prefix for non-decimal numbers.
The main cases are base 16, 8 and 2.

Please observe my obvious lack of design skills:
octFF
hexFF
8FF
16FF
0oFF
0xFF

After just making these, I do realise FF in octal doesn't make any sense whatsoever, but I think what I mean is still conveyed.

Please someone who is actually good at this, take a crack at it?

But most importantly @philippnurullin is it even possible to have a ligature for both the first characters? Or only for the second character i.e. the x/o/b in 0xFF, 0o33 or 0b11?

@mvasilkov
Copy link
Contributor

mvasilkov commented Oct 22, 2020

OK, I think I have a good explanation for why I think it's a bug. The zero-multiplied-by ligature gets the cause and effect of ligatures backwards.

When we write =>, what we wanted to write is an arrow, ⇒. But it's not on the keyboard, so we do the => thing, and the font renders it for us — as we intended. If we were writing this on paper, we'd draw an arrow.

Same goes for >= being ≥, and all others.

But when you write hexadecimal, what you wanted was 0x, and it's on the keyboard, so you write 0x. There was no intent here to write a multiplication sign. When writing hex numbers by hand, you write 0x, not a "zero by something" math notation.

So in this case the ligature goes against the intent of the person typing at the keyboard.


If anything, let's maybe not center the thing after the 0, and instead make it a subscript:

  • 0b101010
  • 0o1234
  • 0xFF (this looks more hideous than I imagined lol)

Or like you proposed above,

  • bin101010
  • oct1234
  • hexFF

(At smaller sizes this will probably be unreadable though.)

@Omnieboer
Copy link

I think we disagree on this base want. What I want to write (and read) personally is FF16, but I think in coding it's easier to prefix than suffix. In that case I'd want to read/write 16FF. The x in 0x feels kind of choses out of necessity.
In writing by hand or in LaTeX I've personally mostly seen the 16 notation. The whole 0-something prefix business seems out of constrictions by keyboards. This is exactly the reason I love ligatures, to overcome those shortcomings, like in >= as you said.

The unreadability in smaller sizes is true though, I wonder if an actual design-smart person (so definitely not me) could come up with a design if unrestricted by the 0-something notation.

@philippnurullin
Copy link
Member

@Omnieboer Looks like Control codes #241
There is a big problem i see. In programming ligatures there is one main rule. The space occupied by ligature must be the same as without it. Or maybe i didn't understand your idea.

@Omnieboer
Copy link

Omnieboer commented Oct 22, 2020

I should have specified, I think the 0x prefix (and 0b and 0o) could be replaced with a different sign/glyph that is 2 characters wide and shows the intent: base 16/8/2 number. Buy maybe instead of just moving the x in 0x, go the route of >= and <=, where an entirely 'new' glyph/character replaces the actual typed characters. Thus the ideas in the pictures I shared above, those prefixed are still supposed to be 2 characters wide.

I am just saying that two characters worth of prefix for hex/oct/bin is plenty of room for creativity and out of the box thinking.

Edit: So the 0x would be completely replaced, not just the x.

@hugoferreira
Copy link
Author

As the OP of this request, it's amazing for me how far people go to disagree, up to the point of attacks based on "professionalism", whatever that is.

This said, I believe every ligature should adhere to some kind of principles and guidelines. @philippnurullin already mentioned one that seems sensible: the space occupied by the ligature must be the same without it.

I would add another one: the ligature must be as close as possible to the original text, minor cosmetic changes, up to the point that a programmer knows which character originated it. If we accept this guideline, things like base subscript should be out of the question.

A third possible one: the ligature should not assume semantics that are not present in the language. Verilog doesn't use 0b as a prefix for binary, for example. And <= is a common assignment operator, which forced me to disable the ligature based on language context in my IDE. This may or may not be a good guideline, as it may be impossible to have ligatures that make sense for every programming language.

My suggestion is that we first stick to the discussion of these guidelines (perhaps in a different thread), before we start brainstorming specific ligatures.

@Omnieboer
Copy link

Omnieboer commented Oct 22, 2020

Though I appreciate that you started this thread, that is only because you beat me to it ;)

But I guess it is fair to have the discussion "Should there be a ligature for 0x in the case of Hexadecimal?" first.

The space occupied by the ligature must be the same without it.

This is necessarily true and I don't think anyone was arguing that it shouldn't be so. As far as I can tell there was only a minor miscommunication about that (my bad).

The ligature must be as close as possible to the original text, minor cosmetic changes.

I think this is true to a degree, but as argued above: sometimes the characters typed are there strictly due to shortcoming of keyboards, where ligatures can make the meaning explicitly clear. Besides, discussion about the specific options for the ligature is exactly about this point: trying to make the language as readable as possible, without disturbing meaning and disturbing the actual written text as little as possible. But taking the as close as possible to the original text approach too far (not saying you are arguing for this) would make the concept of connected ligatures pointless.

The ligature should not assume semantics that are not present in the language.

This is indeed an unsolvable problem, as there will probably always be at least some esoteric language that uses a combination of symbols for something else. I'm not saying languages that use these different assignments are esoteric or not as valid. But looking at the 2020 StackOverflow Survey, the most popular languages are JavaScript, Python, Java, and C# and all of those use 0x for hexadecimals. Trying to conform to all languages will lead to 0 ligatures, as @hugoferreira said. Until variant fonts are in widespread use, conforming to the majority seems reasonable.

Edit: At least, that's my take on it. Please help me broaden my horizon if necessary!

@hugoferreira
Copy link
Author

hugoferreira commented Oct 22, 2020

@Omnieboer all your considerations seem sensible to me :) If @philippnurullin agrees with our suggestion, maybe this conversation should spawn its own thread.

@philippnurullin
Copy link
Member

@hugoferreira Sure, have fun. )

What bothers me is that by creating a too complex substitution the code become unreadable/strange in some languages.
The change in => leaves an ability to understand from what symbols it was created.
The hexFF looks very different from 0xFF even we keep the same width.

The font don't have ability to understand the programming language you using. So solution of this problem can create a "frankenstein" of a font (someone create a "clever" workaround), or it lies on the part of IDE.

@Omnieboer
Copy link

Then what is the decision for the current ligature? I'd prefer the current x to no ligature.

@lunacookies
Copy link

I’d like to chime in that I also don’t like the ligature. In my opinion, the best course of action is either to leave the ligature out, or to use a subscript for 0b, 0o and 0x. I fear that this issue will devolve into ‘+1’-style comments, so vote on this comment by reacting with emoji:

  • 🚀 for no ligature
  • 👀 for just the ligature
  • ❤️ for small centre letter ligatures
  • 🎉 for subscript ligatures

@Omnieboer
Copy link

I would like to offer the following: vote for each option you'd be okay with, not just the top option. That way the most people get an option they're down with. For example, I'd like the centre letter ligatures, but I'd maybe vote for just the 0x ligature as a tactical vote, hoping more people agree there. So 'okay with these' votes make more sense to me, with 1 "no ligatures" vote, and 3 "yes ligatures, but" votes.

I'd also like to add for posterity that this is obviously non-binding unless @philippnurullin supports this specific way of handling things. I'd say that the GitHub Issue comments from an issue from January might not be the most representative in the long run.

@philippnurullin
Copy link
Member

I will remove the 0x ligature in the next update.

Sadly i'm not an expert in a lot of programming languages, if in any at all) and changing the 0xFF sequence to the 12FF, same with 0b, 0o, seems like not an universal expression. Is it valid for all programming languages? If so i can experiment with that. If no, sadly i don't see a bright future for this ligature now.

@VioletJewel
Copy link

Why isn't there a way to disable this? It is objectively confusing in more than one context (I'd argue most) even if it looks cool (to some) in some circumstances. I write code. 0x is a prefix for hex numbers. It looks really stupid to have zero cross product the-number.

@yvvt0379
Copy link

What version are you using? This has been removed a long time ago. Maybe you should better update your font.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

10 participants