Choose font manually when writing?

Is it possible to install multiple fonts and choose manually when writing?

I add 3 new fonts

Yes. You can activate different fonts by switching between different vaults since settings are vault specific.

Another option is to use Settings profiles community plugin.

https://github.com/4Source/settings-profiles-obsidian-plugin
obsidian://show-plugin?id=settings-profiles

1 Like

Markdown doesn’t support changing fonts in most implementations. You could get partially there by using CSS to style some of the available style options to a given font. I.e. you could choose to let highlight styling be another font.

You could use html-tags to set the font, but then you can’t use markdown syntax within that tag.

A last option could potentially be to use some anchor in your text for CSS to target, and use that to change the font. I’ve used tags to this extent quite successfully in some context. I.e. you could add #f/caveat to a paragraph, and use CSS to style that paragraph to use the caveat font.


So markdown doesn’t really allow it, but there are some clunky workarounds which could work in some cases.

There also exists some plugins, I think, which also can add CSS classes to text parts.

2 Likes

You can also change the font per note by using the cssclasses property in combination with a CSS snippet.

2 Likes

Sorry, can you give an example?

Some things may need adjusting; the Properties in document font, etc., if
you are bothered by it, but the snippet would look something like this for all three viewing modes (it could be condensed if you wanted the same font for all views):

/* source mode font */
.markdown-source-view.mod-cm6:not(.is-live-preview).cfont .cm-editor .cm-scroller {
    font-family: 'Consolas'; }

/* live preview font */
.markdown-source-view.mod-cm6:is(.is-live-preview).cfont .cm-editor .cm-scroller {
    font-family: 'Calibri'; }

/* reading view font */
.markdown-preview-view.cfont {
    font-family: 'Comic Sans MS'; }

and in any note where you want the fonts changed, add cfont in the cssclasses section of the YAML/Properties. (The cssclass cfont can be mostly anything; it just seemed easier than writing custom-font :smiley:).

---
cssclasses: cfont
---

Source mode → Live Preview → Reading view

1 Like