arrowtype / recursive

Recursive Mono & Sans is a variable font family for code & UI
https://recursive.design
SIL Open Font License 1.1
3.29k stars 53 forks source link

Rec Mono SemiCasual: Check on "bold" style linking in TextEdit #501

Closed arrowtype closed 2 years ago

arrowtype commented 2 years ago

This issue has shifted a few times, so I wanted to make the first comment reflect what it is currently indicating.

TL;DR: macOS TextEdit is being weird about Bold style-linking for the Rec Mono SemiCasual family. I need to investigate!

Original first comment (Click to expand) https://twitter.com/nedbat/status/1509118060719972352?s=21 ![image](https://user-images.githubusercontent.com/45946693/160875068-aa959ee8-8155-437b-8fa3-609378d0dfaa.jpeg)
nedbat commented 2 years ago

Since you opened the issue with a tweet of mine, I'll suggest that you close the issue with a tweet of yours!

https://twitter.com/ArrowType/status/1509988022699401224

image
nedbat commented 2 years ago

Though maybe I should mention the problem I'm having which led me here. For some reason, vim won't use the bold weights of SemiCasual. I don't know why, but I also note that SemiCasual lists its variants in an unusual order in Font Book. The other Recursive fonts are not in strict weight order either, so maybe this is a red herring?

image
arrowtype commented 2 years ago

Thanks, Ned! I should have closed this issue, but I’ll adapt it while we try to figure out what’s going wrong with vim on your end.

The difference between style ordering in Font Book could be a related symptom, for sure. I’m not entirely surprised that these subfamilies would act a little differently, though, because the build processes are pretty different.

The main subfamilies are created from the build that is in this repo (via scripts in the mastering directory). The "Rec Mono" subfamilies are actually slices of the full variable font, via the instantiate-code-fonts.py script of arrowtype/recursive-code-config. Basically, the static families in the release are made in a time-tested, fairly industry-standard way, while the Rec Mono fonts are made with much newer tools, and might not be setting some bit of metadata that Font Book and vim are looking for.

A few questions for you...

arrowtype commented 2 years ago

PS, I’ve just updated the Readme’s instructions for using these fonts in code editors. It may or may not be helpful:

https://github.com/arrowtype/recursive/blob/eb821735e66402b4b485ce97ed32b09a8555341e/README.md#font-usage-in-code-editors

Ideally, it would include some suggestions for using Recursive in Vim, if we learn anything new here!

nedbat commented 2 years ago

My Mac version is 10.15.7. TextEdit does something unusual with Rec Mono Semicasual:

image

With Regular selected, the font menu has Bold selected, but also grayed out? Pressing Command-I makes italics, but Command-B just beeps.

I can change the font selector from Regular to Bold, and I get bold, but Bold in the menu is still disabled:

image

Finally, yes, using a static font ("1.047;ARRW;RecursiveMonospaceCasual-Medium") works properly in vim. My Python keywords are in bold.

arrowtype commented 2 years ago

Hmm, that is odd... I guess this issue needs to be adjusted again! I'll adjust the title and look again into how the current font metadata is indicating style-linking.

nedbat commented 2 years ago

Let me know if I can do any more experiments. I'm happy to run build tooling or whatever if you can give me instructions.

arrowtype commented 2 years ago

Ahh I think I've found (at least one cause of) the problem...

My Mac version is 10.15.7

As far as I can tell, this is now working well in TextEdit on macOS 12:

image image

I totally get that people have valid reasons for running an older OS. I was still on Catalina until quite recently, because some of my font software relied on it! But, unfortunately, I have limited time and would be spending unpaid labor to try to support older software.

I spent a lot of time earlier in this project fighting to solve issues that were really on Apple’s side, like the fact that the substring “cursive” in the name “Recursive” got interpreted to mean that the font was only Italic. This was based on a heuristic that was nowhere in the OpenType spec, and probably came from some engineer taking a shortcut to make some font work, probably many years ago. (And in fact, this is why the “Rec Mono” fonts are named the way they are, to avoid the bug from the “Cursive” substring.)

With macOS 11, a bunch of font handling issues were fixed. I bet that probably even more issues have been fixed in 12.

All that said, if you wish to hack on this and figure out if there is a fix of some kind that would better support Mac 10.15.7 without harming support in newer versions, then I’d be happy to incorporate a PR! The conversion from general Recursive desktop fonts to Rec Mono fonts happens at https://github.com/arrowtype/recursive-code-config in scripts/instantiate-code-fonts.py

A potential workaround, no hacking required

For your specific problem – “SemiCasual” not playing well with “Bold” style linking – one guess is that there may be a heuristic that looks for the substring “Semi” and assumes that such a font is already “SemiBold.” That would potentially explain this behavior, I think... So, a potential fix would be to make a custom Code configuration (instructions in that readme) with a different custom name, such as Rec Mono Ned (or any name that doesn’t include Semi in it).

If that works, I’d be super interested to hear about it.

All the best, and please reach out if anything else comes up!

nedbat commented 2 years ago

Your guess was right! I made a custom font called Rec Mono HalfCasual, and it works properly with bold. Thanks :)

arrowtype commented 2 years ago

Oh wow, haha, I can’t believe it worked! And yet I can. 😅 Thanks for giving it a try and letting me know!