Hi, I want to share how I added a custom font to Android/iOS devices. This technique employs Obsidian’s CSS snippet feature so you do not need to install or create a custom theme.
You need a WOFF2 file for your custom font. If you only have TTF file or something, convert them to WOFF2. There are plenty of tools online to do this.
Convert WOFF2 to base64-encoded string and embed it in fonts.css file (you can name this file as you want). You can do this on https://hellogreg.github.io/woff2base/. Copy the generated string to your CSS file.
Add your fonts.css under .obsidian/snippets/ folder.
Open Obsidian and go to Settings > Appearance > CSS snippets and enable your fonts.css.
Now Obsidian will recognize your custom font even if your phone does not have it. You can go to Settings > Appearance > Font and change the font to yours.
If Obsidian does not recognize your font, check the font-family property in your fonts.css. font-familiy property and Settings > Appearance > Font setting must exactly match.
This is very useful for Samsung devices, because they do not allow installing system fonts (unless you buy one for $4.00 in the Galaxy Store arrrgggh).
I am a bit confused about this, though. I have always used encoded TTF files for snippets and they have always worked.
@621 Hey there. I’m trying to set up a custom font on iOS using the technique you came up with, but have run into an odd issue. For some reason the font I’m trying to use (Karla) keeps showing up as bold/italic across all of my notes in Obsidian. Using Woff2Base: Convert .woff2 to accurate Base64 css., I’ve tried:
Generating CSS snippets from woff2 files
Generating CSS snippets from TTF files
Using a single CSS file that contains the snippets for regular, bold, and italic fonts (this led to the font being italic globally)
Using a CSS file that contains the snippet for only the regular font
The last configuration I tried - a CSS file containing only the snippet for the regular font, generated from a woff2 file - has gotten me close to final solution. Now when I open up a note, I can see that the font has been appropriately applied. But as soon as I click on the note to edit it, the entire note changes to bold italic font. Do you have any sense of why this might be happening?
Strangely enough, it just started working out of the blue. So to anyone else who tries this out, if it seems buggy at first, just give it a little while.
Hi, for those struggling to create a your-font.css file: You can ask ChatGPT to generate the .css file for you. Simply download it and then upload it to your snippets folder.