Hi everyone, I’ve been trying to use custom fonts locally in Obsidian via a CSS snippet, but nothing is working — not even simple tests.
What I want:
Set custom fonts for UI, note text (English & Persian), and code blocks using a CSS snippet in my vault.
Have the fonts stored in the vault itself (not installed on the OS), so it works across devices.
Works with the default theme, desktop Obsidian.
What I tried:
-
Put fonts in a
fontsfolder at both vault root and later inside.obsidian/fonts/ -
Used
@font-facewith relative paths like:@font-face { font-family: "AmpleSoftVault"; src: url("../fonts/Ample Soft Pro/AmpleSoftPro-Regular.woff2") format("woff2"); } -
Tried quoting paths and escaping spaces (e.g.
"Ample Soft Pro"andAmple\ Soft\ Pro) -
Used CSS variables (
--font-text,--font-interface,--font-monospace) and applied to selectors:.markdown-preview-view, .markdown-source-view { font-family: var(--font-text) !important; } -
Validated that snippets are loaded (a border test on
.app-containerworked)
What is not working:
Custom font faces are not applied — not to text, UI, or code.
Files are in the correct relative folders.
Fonts are .woff2.
Even simple font‑family changes don’t affect rendering.
Setup details:
-
Vault path example (with spaces, Google Drive):
C:\Users\NightWatch\My Drive\Obsidian\The World\fonts\… -
Snippet is here:
…\The World\.obsidian\snippets\fonts.css -
Fonts used:
- Ample Soft Pro (English)
- Estedad (Persian)
- JetBrains Mono (monospace)
-
I ensured snippet loads (red border test works).
Example of full snippet I tried: (omitted here for brevity — I’ll include in comments if needed)
What I suspect but can’t confirm:
- Relative paths with spaces don’t resolve under Electron/Chromium.
- Snippets may load before fonts can be resolved.
- Variation between live preview vs reading mode selectors.
- Theme overrides even with
!important.
Questions:
- Does anyone know the correct way to reference vault‑local font files (with spaces in folder names) in an Obsidian snippet so that the fonts actually load?
- Should I be using absolute file paths (and if so, what format works cross‑platform)?
- Is there a different set of selectors required to override UI text, editor text, and code blocks?
- Has anyone successfully used Persian/Unicode fonts in code blocks with a snippet?
Thanks so much in advance — I’ve been stuck for a while and it’s driving me nuts! ![]()