abridge: Bug: can't seem to change the main font
I’ve tried importing in the fonts via config.toml file, such as “FireCode-Regular”, and then modifying the font face via the theme:
fonts_load = true # used to import fonts
fonts = [
{url = "font/FiraCode-Regular.woff2"},
]
:root {
// Typography
--ff: "FiraCode", "FiraCode-Regular", system-ui, -apple-system, "Segoe UI",
...
No avail. Do you know how I’m meant to do this? While we’re at it, might want to propose README changes (that could wait for an entire README refresh) or present this as a config.toml setting.
And a follow-up (insignificant) issue would be how to change the monospace font used in code blocks from Markdown.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 33 (33 by maintainers)
Commits related to this issue
- Fix External Font Resources — committed to Jieiku/abridge by Jieiku 2 years ago
- Font Updates — committed to Jieiku/abridge by Jieiku 2 years ago
- update — committed to Jieiku/abridge by Jieiku 2 years ago
OK, so in case your curious. I have completely figured out how to get lazy load of the fonts, and thus non blocking so the page renders right away.
What lighthouse complains about next is Content Layout Shift, the effect of the page shifting or reformatting from loading another font. With the Jost font this is particularly bad, and lighthouse marks it yellow instead of green, they allow for a little bit of CLS without marking it as an issue.
I believe the way to make certain fonts have less of a Content Layout Shift is by defining backup fonts that have similar character widths so that the page does not shift much when the font finally loads.
I took the time to load every single Zola Theme demo, and check for font resource load, every single theme that had fonts that load slow, as you originally pointed out, except for 4 of them. (Average 3G speed: 5,622 ms)
Here are the ones that did not have the delay and their respective Content Layout Shift:
For Now I am going to commit these changes using the font declaration similar to hallo, the fonts on that page look good, and they have the least CLS, however we can add additional fonts with minimal CLS over time, we just have to find the other fonts that behave well.
P.S. Why did you get rid of the “local” src for font load? Did it not help load times?
Yeah, no problem. I am getting ready to commit the changes now, and yes I will probably just strategically pick fonts that most operating systems have as well so that I do not need to define custom fonts.
Doing this deep dive was still worth it though because I am sure this question would come up again and now we know all the details and can get it documented.
yeah, what I am doing now seems to work, I will push this up this evening, going to do a bit more testing first.
You could clone my blog and checkout the commit starting with 53f76 (a few commits back, before I removed it all)
I think the issue is because I loaded like 4 fonts IIRC.
( a bold font, italic font, regular font, source font )
It seems like they must be downloaded before the first paint of the page, which is why the first paint is so slow.
Without getting into the weeds so much, I really Abridge would benefit from having colors and fonts specified in the theme’s config.toml
If someone wants to do advanced things like set the backup fonts then they are on their own.
However, some reasons I’m suggesting this:
fonts_loadandfontsprobably doesn’t need to be 2 settings, since loading a font impliesfonts_loadis trueon_load. This would be a super-convenience to users who don’t know the intricacies of this cruft, and unsuspectingly walk into a trap using the current method: