Apply OpenType features to one font but not another

I’m working on a custom theme and I have embedded multiple fonts in my CSS file. I’d like to apply an OpenType feature to only one of the fonts, so I’m trying to set font-feature-settings in @font-face but it gets ignored when I do so.

This is what I have in my theme.css file as a reduced reproduction case:

@font-face {
    font-family: "sourcesans3vf-upright";
    font-feature-settings: "ss01" on;
    src: url(data:font/woff2;base64,<long base64 string here>);
}

body {
    --font-text-theme: "sourcesans3vf-upright";
    /* font-feature-settings: "ss01" on; */
}

If I uncomment the font-feature-settings line in the body, I get the expected results (a serif-ied upper-case I). If I use the code as above (attempting to set the font-feature-settings from within the @font-face), I get the normal sans serif upper case I.

The font in question is Source Sans 3 if it matters, and I’ve encoded the variable font to base64 for use in my CSS file with “Font to Base64 CSS Converter - Obsidian Custom Font Tool.“

Is there a better way to achieve what I’m trying to accomplish?

I’m happy to report that this is now working (I just tried in Obsidian 1.12.4). It appears to have been resolved by upstream changes in Chromium (bug ID 40398871).

So I can now apply, for example, lining numbers (lnum) to every instance of a font by managing font-feature-settings in the @font-facedeclaration instead of having to find every html element that uses a given font and managing it there:

@font-face {
    font-family: "MyFont";
    font-feature-settings: "lnum" on;
    src: url(data:font/woff2;base64,<long base64 string here>);
}

Unfortunately this only appears to work with font-feature-settings. When I try using font-variant-numericthe changes are not recognized, but I’ll take it!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.