pourmand1376 / obsidian-custom-font

A plugin to set custom font for obsidian
https://obsidian.md/plugins?id=custom-font-loader
MIT License
62 stars 2 forks source link

Set font per page #7

Closed diatche closed 9 months ago

diatche commented 11 months ago

Thanks for writing this. This helps me to display Church Slavonic text correctly. The problem is that I only need the font loaded in those files which use Church Slavonic. So it would be great if there was a way to specify the font per file.

Using the font property seems like a great way to set the font per page, instead of setting the font globally.

pourmand1376 commented 11 months ago

This is easy.

First, Use Custom CSS style and define it like this:

.custom-font * {
font-family: YourFontName !important;
}

Then, you can set this custom-font CSS style in any file you want. For this, you need to set cssclasses in the frontmatter to custom-font. Something like this:

image

And this is the settings page: image

winged-voices commented 10 months ago

Just to check (because I know CSS, but not WELL) -- is it possible to create several different defined classes here for each different font, on the off chance I end up wanting to use a couple different fonts but only for certain things? (I can think of some use cases since I do writing/roleplaying/mood boards etc and could use handwriting fonts for example.)

If in the Custom CSS style, I also defined .custom-font2 and .customfont3, etc etc (or .whatevername) with an additional font-family, and labeled them in the css-class front matter, would it let me use multiple fonts on a page by page basis?

pourmand1376 commented 10 months ago

Yes, This should be okay in theory. But, currently my plugin only loads one external font. For this to work, I should work on #2.

winged-voices commented 10 months ago

That would be awesome and much appreciated!

pourmand1376 commented 10 months ago

This is now added. You can easily do what you want by using custom css classes.

winged-voices commented 10 months ago

Thank you so much!!

On Sat, Jan 20, 2024 at 8:14 AM Amir Pourmand @.***> wrote:

This is now added. You can easily do what you want by using custom css classes.

— Reply to this email directly, view it on GitHub https://github.com/pourmand1376/obsidian-custom-font/issues/7#issuecomment-1902110988, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYILT6LSX75QJIF2QPA5JSDYPPGODAVCNFSM6AAAAABAL7CJLWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGEYTAOJYHA . You are receiving this because you commented.Message ID: @.***>

diatche commented 9 months ago

It works great! Thank you

Rick1029 commented 7 months ago

Hi, using the multiple font options to try to set a bigger font size and different font for Arabic only notes, it all works an doesn't alter the font of my notes unless I have "custom-font" written.

image

However doing this makes Obsidian freak out as the plugin says it is "processing fonts" and it gets so slow you'd think it froze, but things just take 5-10 seconds to happen. It goes back to normal when you quit and restart and it works fine. It freezes again if you open the plugin settings menu and you have to slowly change fonts, quit, then restart. I notice in the background when you open the plugin settings your font scrolls through every single one you have installed (I have five for Arabic) then settles on the one you selected, and unfreezes, unless you try picking a new one where it freezes until you reopen Obsidian.

Ske-Man1149 commented 4 months ago

Hi, using the multiple font options to try to set a bigger font size and different font for Arabic only notes, it all works an doesn't alter the font of my notes unless I have "custom-font" written.

image

However doing this makes Obsidian freak out as the plugin says it is "processing fonts" and it gets so slow you'd think it froze, but things just take 5-10 seconds to happen. It goes back to normal when you quit and restart and it works fine. It freezes again if you open the plugin settings menu and you have to slowly change fonts, quit, then restart. I notice in the background when you open the plugin settings your font scrolls through every single one you have installed (I have five for Arabic) then settles on the one you selected, and unfreezes, unless you try picking a new one where it freezes until you reopen Obsidian.

@pourmand1376 we want an answer,

pourmand1376 commented 4 months ago

Hey, Thanks for mentioning your issue.

I really can not replicate this issue (so I can't solve it). Could you please upload your files and configurations so that I can replicate this on my own device?

majnooni commented 3 months ago

Hi.

I would like to thank you for such a brilliant idea that led to the plugin. When I try to export an obsidian note to PDF, the custom font is not embedded. Is there a way to do that? I have attached a PDF file so you can clearly understand me.

Thanks Meysam کتابخوانی و توصیه هایی برای آن.pdf

pourmand1376 commented 3 months ago

Hi. Thanks you for mentioning it.

This is the problem I've been aware of. I don't know any solutions.

I'll create a new issue for it in case anyone knows how to fix this bug.