Change font weight for italics in all notes

What I’m trying to do

I’m using a specific font VictorMono Nerd Font, which has many font weights like thin, thin italic, medium oblique, etc. The issue is that, for italics, obsidian used to use by default Medium Italic instead of Medium Oblique. This difference is important, because Italics weight in this font are handwritten, while the obliques are script. After updating to 1.4.16, obsidian is using the oblique font weight instead of the italic weight for formatting italics.

Things I have tried

I have tried creating a css custom snippet, but I’m not sure how to specify the specific font weight, instead of just the family font. So far I have this, which hasn’t worked at all.

/* of italics in Preview  all notes in a vault */
em {
    font-family: "VictorMono Nerd Font Medium Italic", sans-serif;
}

I also looked up this obsidian snippets documentation regarding on how to format fonts, but I haven’t found anything specific about overriding to a specific font weight.

Give this a try

/* italic text */
.cm-em, em {
    font-family: 'Victor Mono Medium';
    font-weight: 100;
    color: var(--color-blue);
}

/* bold text */
.cm-strong, strong {
    font-family: 'Victor Mono';
    font-weight: 600;
    color: var(--color-green);
}

Screenshot 2023-10-17 082851


I put the colors and /* bold */ section in there to see what was happening for myself; you can of course remove or comment out those parts.

For the handwritten italics, the Victor Mono Medium, I only see two font weights: 100500 and 600900. I’d have to fire up Font Forge to have a closer look, but I suspect there’s only two weights for that style. The Victor Mono seems fine with 100900. On Windows now, but will check later on mac.

Hope this helps.

So, on the mac, font-family: 'Victor Mono Medium'; doesn’t work for me using italics. It needs to be this (the PostScript Name):

/* italic text */
.cm-em, em {
    font-family: 'VictorMono-MediumItalic';
    font-weight: 600;
    color: var(--color-blue);
}

I also see a difference in font weights of 500, 600, and 700.

Ahh, the wonderful world of mac, Windows, and typography. :face_with_spiral_eyes:

1 Like

Thank you this worked really well! I tested the mac solution because that’s what I have, but I think if someone has Windows, the first answer will work for them.

@Lilith_97 Glad it worked out! For next time, or for anyone else stumbling in here, on the mac, the PostScript Name is generally what you want to declare in the CSS.

P.S. Thanks for the introduction to a great looking font.

2 Likes

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