sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
799 stars 35 forks source link

font_options: Support "slashed zero" OpenType layout feature #2302

Open jenskutilek opened 6 years ago

jenskutilek commented 6 years ago

I was happy to see support for OpenType Stylistic Sets in the current ST version. Could you also add support for the "slashed zero" OpenType feature (feature tag: "zero")? The code for stylistic sets should be the same that's needed to support "zero".

Font makers could duplicate the "slashed zero" replacement into a stylistic set and thus make it accessible in the current ST builds, but it is better to use a more specific OT feature than a general one. The contents of stylistic set is not specified, and varies between different fonts, while the slashed zero feature is identical across fonts.

tonsky commented 5 years ago

Just want to add it would be great to see other open-type features as well, namely:

onum (old-style figures)

AlsoScratch commented 4 years ago

I really hope these brilliant suggestions are not being plainly ignored! Just because it's trivial does not mean we can pretend they don't exist.

NetOpWibby commented 4 years ago

Is there any progress on this? I opened an issue on the JetBrains Mono repo for slashed-zero support in the typeface and it apparently already has it.

I found this reference guide on enabling stylistic sets in Fira Code for usage in Sublime Text helpful, but the suggestion doesn't seem to work.

I don't know much about native software development but it seems like additional ligature support is relatively minor to implement. Hopefully, Panic's Nova comes out supporting what we want.

Sharklops commented 4 years ago

Is there any progress on this? I opened an issue on the JetBrains Mono repo for slashed-zero support in the typeface and it apparently already has it.

I found this reference guide on enabling stylistic sets in Fira Code fur usage in Sublime Text helpful, but the suggestion doesn't seem to work.

I thought it wasn't working either, but then realized that the stylistic sets don't work on JSON files for some reason. And I was doing all my testing right there in the Settings file.

When I created a new Plain Text file it worked just fine, and seems to work on the majority of extensions that can be selected in the bottom right corner of the Sublime Text window. Hope that helps!

AlsoScratch commented 4 years ago

Curious... Are you saying there is actually a way to do it?

NetOpWibby commented 4 years ago

I was doing my testing on several file extensions and the zero never changed. Here are the relevant settings:

{
  "font_face": "JetBrains Mono Regular",
  "font_options":
  [
    "dlig",
    "ss01",
    "ss02",
    "ss03",
    "ss04",
    "ss05",
    "ss06",
    "ss19",
    "ss20",
    "onum",
    "zero"
  ],
  "font_size": 13,
}
Sharklops commented 4 years ago

Ah, I'm sorry. I originally linked to this issue from the Fira Code page and had assumed it was specific to that font.

I definitely recommend it if you aren't married to JetBrains. It's got a working slashed zero by default as well as programming ligatures

image

NetOpWibby commented 4 years ago

Oh yeah I know about Fira Code and while I've tried it before I really like how JetBrains Mono feels.

wbond commented 4 years ago

I was doing my testing on several file extensions and the zero never changed. Here are the relevant settings:

Currently only ss01 to ss10 are implemented. zero and onum are not. This is currently an implementation detail in that font_options is implemented as a 32bit int using bits as flags. To add support for ss11 to ss20 plus other open type flags, we'd have to refactor a number of chunks of code to use a 64bit int or some other data structure.

Generally such changes happen because we are doing a chunk of related work (in this case on font handling), we have a bug that needs to be fixed, or we get more than a few people asking for a feature.

I'm not opposed to adding such support in the future, I just don't know exactly when that will happen. Partially just because there are plenty of competing feature requests and bug reports to pay attention to also.

Sharklops commented 4 years ago

I guess you could use something like FontForge (free and open source) to edit the zero glyph to bake in the slash.

NetOpWibby commented 4 years ago

To add support for ss11 to ss20 plus other open type flags, we'd have to refactor a number of chunks of code to use a 64bit int or some other data structure.

Ahh, I was under the incorrect assumption that implementation would be trivial. Thanks for the insight.

For my end, I could see about swapping the default zero with the slash. A small bit of legwork but a helluva lot easier than flagging bits.

EDIT: FontForge doesn't seem to support ttf files. Oh well.

Sharklops commented 4 years ago

It definitely supports ttf files, but I'm pretty sure the stylistic sets this issue is discussing pertains only to Opentype fonts.

NetOpWibby commented 4 years ago

@Sharklops Ah, must be an issue with the app (it's been installed for a while). I just installed the latest FontLab and am using the trial to figure things out.

EDIT: My fudging around in FontLab worked!

jenskutilek commented 4 years ago

You can remap characters in a font without using a graphical font editor. It’s better to do it with scripting because that way you can be fairly sure nothing else is changed/broken in the fonts. I have an example Python script to switch a slashed zero with the default zero in my Sudo font repo. You can switch any other character by adding its info like in line 36, you just have to know its Unicode value (0x0030) and the glyph name of the glyph to substitute (zero.zero).

Sharklops commented 4 years ago

@jenskutilek - thanks, I only just realized that after messing around in FontForge for way too long.

But I did manage to get the slashed/dotted zero in Fira Code working right with Sublime Text. Fira Code uses the zero and ss19 flags, but doesn't have anything set for ss10. I just copied over the info from ss19 into a new lookup for ss10 I created and it seems to be working just fine.

be5invis commented 4 years ago

Iosevka has a set of non-standard tags for language-specific ligations, 14 ss## stylistic set features and 87 cv## character-variant cherry-picking features. The mechanism of enabling OT features really needs to be more flexible...

MatheusAvellar commented 3 years ago

Just had the same issue trying to toggle specific character variants (cv##) with Iosevka... 😪

I get that this is probably not a very high priority issue since it's mostly an aesthetics thing, but hopefully it's tackled at some point

bpsbais commented 1 year ago

It's 2023, still waiting for "slashed zero" support.

siddhpant commented 11 months ago

This is needed for Verilog assignment ligature (<= is an assignment arrow to the left, and not ≤).

njgwinter commented 5 months ago

Just adding a 2024 bump to this request for more complete opentype feature support. Thanks!

MrDowntempo commented 3 months ago

Cascadia Code is another font affected by this. https://github.com/microsoft/cascadia-code

DeraJSP commented 3 months ago

Still nothing?