sublime_text icon indicating copy to clipboard operation
sublime_text copied to clipboard

font_options: Support "slashed zero" OpenType layout feature

Open jenskutilek opened this issue 7 years ago • 22 comments

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.

jenskutilek avatar May 09 '18 07:05 jenskutilek

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

onum (old-style figures)

tonsky avatar May 28 '19 12:05 tonsky

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.

AlsoScratch avatar Jan 04 '20 06:01 AlsoScratch

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.

NetOpWibby avatar Jan 16 '20 16:01 NetOpWibby

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!

Sharklops avatar Jan 21 '20 12:01 Sharklops

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

AlsoScratch avatar Jan 21 '20 14:01 AlsoScratch

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,
}

NetOpWibby avatar Jan 21 '20 14:01 NetOpWibby

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

Sharklops avatar Jan 21 '20 14:01 Sharklops

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

NetOpWibby avatar Jan 21 '20 14:01 NetOpWibby

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.

wbond avatar Jan 21 '20 14:01 wbond

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

Sharklops avatar Jan 21 '20 14:01 Sharklops

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.

NetOpWibby avatar Jan 21 '20 14:01 NetOpWibby

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

Sharklops avatar Jan 21 '20 15:01 Sharklops

@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!

NetOpWibby avatar Jan 21 '20 15:01 NetOpWibby

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).

jenskutilek avatar Jan 21 '20 15:01 jenskutilek

@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.

Sharklops avatar Jan 21 '20 16:01 Sharklops

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...

be5invis avatar Feb 14 '20 03:02 be5invis

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

MatheusAvellar avatar Jul 29 '20 05:07 MatheusAvellar

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

bpsbais avatar Jun 29 '23 11:06 bpsbais

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

siddhpant avatar Aug 01 '23 16:08 siddhpant

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

njgwinter avatar Jan 09 '24 17:01 njgwinter

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

MrDowntempo avatar Mar 09 '24 00:03 MrDowntempo

Still nothing?

DeraJSP avatar Mar 15 '24 00:03 DeraJSP

+1. I think OpenType support should be a baseline expectation for a non-free text editor in 2024. Fingers crossed I'll see it in the changelogs soon.

markmcb avatar Aug 21 '24 22:08 markmcb

Fingers crossed I'll see it in the changelogs soon.

Won't hold my breath. This issue was opened in 2018. Clearly this is something they are unwilling to support or consider. It requires some refactoring -> https://github.com/sublimehq/sublime_text/issues/2302#issuecomment-576717416.

siddhpant avatar Aug 22 '24 05:08 siddhpant

Fingers crossed I'll see it in the changelogs soon.

Won't hold my breath. This issue was opened in 2018. Clearly this is something they are unwilling to support or consider. It requires some refactoring -> #2302 (comment).

Yeah, you're probably right. My license just expired. I think this is a "vote with my wallet" situation for me. I'll upgrade when this is supported.

markmcb avatar Aug 23 '24 17:08 markmcb

If this ever gets implemented I would really appreciate all the other options fonts like Fira Code support as well, such as the "cv02" option for a different letter "g".

VinzNL avatar Feb 12 '25 21:02 VinzNL

Found this issue because I just wondered why "font_options": ["zero"], did not change anything on "Source Code Pro".

thenktor avatar Mar 25 '25 13:03 thenktor