Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fonts not displaying #127

Open
ronilaukkarinen opened this issue Sep 24, 2024 · 9 comments
Open

Fonts not displaying #127

ronilaukkarinen opened this issue Sep 24, 2024 · 9 comments
Labels
can't replicate Unable to replicate the issue at my end display issue My note doesn't display correctly

Comments

@ronilaukkarinen
Copy link

I have set my Obsidian Text font to Inter. It seems sharing feature has no fallback if custom font is set. Can you set it as system-ui somehow? Now it seems to revert to Times or similar.

@ronilaukkarinen ronilaukkarinen added the display issue My note doesn't display correctly label Sep 24, 2024
@alangrainger
Copy link
Owner

alangrainger commented Sep 24, 2024

Did you follow the steps in the troubleshooting link in the Issue creation screen?

https://docs.note.sx/Troubleshooting#force-a-full-re-upload-of-all-note-data

You can use any custom font you like, you most likely didn't re-upload your CSS (it's in the steps above) or it's a caching issue of your new CSS not showing in your browser (also in the link above)

@ronilaukkarinen
Copy link
Author

ronilaukkarinen commented Sep 25, 2024

Yes I did follow the steps. Here is an example note: https://share.note.sx/rflluu49#e6+nFhQ5yKNHhcf7LKNp8msHUuL9PoU2S8fFRIybbDU

@alangrainger alangrainger added the can't replicate Unable to replicate the issue at my end label Sep 26, 2024
@alangrainger
Copy link
Owner

alangrainger commented Sep 26, 2024

Are you using a custom theme? I am using the default theme, and this is what is set as fallback for <p>:

image

You can check the shared note here:

https://share.note.sx/nv523t5v#oO8g9TkniYxyRY+Z7FS4cqOlGOGzBcVcKQYs2c43kVk

If you're using a custom theme or custom CSS, those fallback options need to be specific in there.

However I realised thanks to your issue that default fonts aren't uploaded since they aren't part of the theme. I might see if I can upload the Obsidian set font also.

@ronilaukkarinen
Copy link
Author

I'm using the default theme with obsidian-minimal-settings, some CSS variables changed in snippets (no fonts though) and that's it.

However I realised thanks to your issue that default fonts aren't uploaded since they aren't part of the theme. I might see if I can upload the Obsidian set font also.

Yes, I have only set my fonts via Obsidian Core settings, Text is set as Inter. That's it. I think there is no way to set fallback fonts there? So what do you suggest I'll try?

I think you can reproduce this like this:

  1. Go to Appearance > Font > Text Font > Manage
  2. Change to some font you have downloaded from Internet, any font that is not a system font
  3. Try sharing a link

For me it seems to have font-family: Inter (I've set the Text Font as Inter) so the browser falls back to Times... or somethin like that. In the example my monospace font shows because it is installed on my system.

image

@alangrainger
Copy link
Owner

alangrainger commented Sep 26, 2024

I think you can reproduce this like this

That's exactly how I shared the last note, those exact 3 steps.

So maybe you can try in a Sandbox vault? You can see that my default Obsidian installation does send a fallback font option.

What OS are you using?

@ronilaukkarinen
Copy link
Author

In the test vault it works.
https://share.note.sx/jc96ufqn#VhDhR0pjnjZ2LZU6s4OV9fF/PIB7uvmgmutc9J5JcYE
https://share.note.sx/smexzdmr#lem43ebnhyaj/Iiz0oyiuQJRS/aNZut4fnXUGy7NGCI

I'm using macOS, Linux, Windows and iPhone but the behaviour seems to be the same.
It's very strange because the font settings are correct in the test vault share page and my actual vault share page... I have no idea where that Times font comes from. The h1 is font-family: var(--h1-font); and --h1-font is inherit, the .markdown-preview-section has fallback fonts exactly like it should. I don't get it. Have to look at it further...

@ronilaukkarinen
Copy link
Author

I figured it out. I have multiple fonts set up. If the font contains spaces, it breaks it and reverts to browser default.

image

If I set Inter, Alliance No 2, SN Pro, it doesn't work. The setting prints out it like this to the shared page:

--font-text-override: Inter, Alliance No .2, SN Pro;

image

If I only set Inter, it works:

--font-text-override: Inter;

https://share.note.sx/1zd49xzt#vGmIa7o+ZgmyQHmM8eOuh/ug8eP7eQvgQxoMlKoMdUs

image

@alangrainger
Copy link
Owner

alangrainger commented Sep 27, 2024

Based on your syntax highlighting here, it might actually be the font with the dot . in it:

--font-text-override: Inter, Alliance No .2, SN Pro;

If you open up the Developer console in Obsidian and look at the CSS for those elements, does Obsidian quote the font strings? I'm getting the CSS directly from Obsidian's DOM, so it should be an exact replica. However I'm not sure why Obsidian can correctly display the unquoted fonts.

@ronilaukkarinen
Copy link
Author

My examples were directly from devtools. So no, Obsidian doesn't quote fonts. That is seemingly the culprit here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can't replicate Unable to replicate the issue at my end display issue My note doesn't display correctly
Projects
None yet
Development

No branches or pull requests

2 participants