My normal screen font is set as OliveGreen Mono medium. When I italicize a word using command-i, then command-i again to get out of italics mode, my font is no longer OliveGreen Medium but OliveGreen regular. Here’s a picture:
Possibly relevant: I have three weights of the font on my computer, Regular, Medium and Italic. A description of the font says it has a “dynamic italic”.
After 7 years (!) of using Scrivener, did I finally find a bug?
Unfortunately, this one is down to how fonts work in the text system and to you not having enough variants of the font installed. To explain: the italicise and bold features just call on the text engine’s “change font trait” action, which calls through to Cocoa’s font manager. The font manager takes the existing font and applies either the italic or bold trait to the font, or removes the trait, as appropriate. It does this by altering the font face (switching from “Regular” to “Italic” or whatever). The problem is that in this case, you have no “OliveGreen Mono Medium Italic” variant installed, so that when you italicise the text, it gets converted to “OliveGreen Mono Italic”, which is the italic variant of the regular face. So once the italic trait is removed, it gets converted to OliveGreen Regular, which is seen as the non-italic variant of the font, because at this point the font manager has no idea that the italic font started out as a medium font and there are no clues in the italic variant being used.
In order for this to work correctly, there needs to be an “OliveGreen Mono Medium Italic” variant of the font installed. That way, when the italic trait is removed, the font becomes OliveGreen Medium. But if there’s no such variant and only an OliveGreen Italic, then it will return to regular when italics are removed.
Looking up the font in question, it seems that there is indeed an “OliveGreen Mono Medium Italic” variant available:
So I think the problem is just that you only have the Regular, Medium and Italic variants installed, which aren’t enough for the font manager to do its job properly. Purchasing and installing the italic variant of the medium font should fix the issue. (Though obviously I take no responsibility if you spend money and it still doesn’t work for some reason!)
I have to hand it to KB on the soft let downs. A lesser person, say like me or vic-k, would have said “NO! YOU DON’T HAVE THE RIGHT FONT! GO AWAY!” (ok, vic-k wouldn’t have said that, just me). Instead he not only explained how the OSX font system selects fonts, but provided a tip on how to fix a problem that isn’t his.