pourmand1376 / obsidian-custom-font

A plugin to set custom font for obsidian
https://obsidian.md/plugins?id=custom-font-loader
Apache License 2.0
49 stars 1 forks source link

Select a font only for monospace (codeblock, frontmatter) #13

Open BenRoe opened 2 months ago

BenRoe commented 2 months ago

In the Obsidian appearance settings i can select a font only codeblocks and frontmatter. Is it possible with this plugin?

pourmand1376 commented 2 months ago

Hi.

Yes. It is possible. I believe what you want is something like these three settings in obsidian: CleanShot 2024-04-30 at 00 09 23@2x

Also, In the plugin if you enable custom css mode, you will see something like this:

:root * {
        --font-default: Shabnam;
        --default-font: Shabnam;
        --font-family-editor: Shabnam;
        --font-monospace-default: Shabnam,
        --font-interface-override: Shabnam,
        --font-text-override: Shabnam,
        --font-monospace-override: Shabnam, 
    }

Here you can customize the css however you want. For example, if you want the font to only be applied as a monospace font and not applied any where else:

:root * {
        --font-monospace-default: Shabnam,
        --font-monospace-override: Shabnam, 
    }

And I think it is clear where I am going by this.

Feel free to change and tweak other css settings to see what each mean.

BenRoe commented 2 months ago

Thank you. Via standard settings, my font (Fira Code) is not in the list. If i use the following css, Fira Code font is used. Only problem is, ligatures are not active. Any idea how to do it?

:root * {
        --font-default: none;
        --default-font: none;
        --font-family-editor: none;
        --font-monospace-default: "Fira Code";
        --font-interface-override: none;
        --font-text-override: none;
        --font-monospace-override: "none";
                -webkit-font-feature-settings: "liga" on, "calt" on;
    }
pourmand1376 commented 3 days ago

I really have no idea. Could you fix it yourself somehow?