ankit / stylebot

Change the appearance of the web instantly
https://stylebot.dev/
MIT License
1.4k stars 208 forks source link

[Bug] When we select a font-family that's not on our computer, the import statement doesn't import true bolds and italics, and there's no way to configure it otherwise #573

Closed saadrehman closed 4 years ago

saadrehman commented 4 years ago

Describe the bug When we select a font-family that's not installed on our computer, a google api important statement is inserted. However, that import statement only imports the one style and one face, resulting in faux bold and faux italics used throughout the page. Copying and pasting the import statement from Google Fonts site doesn't work, cause that supports css2 and Stylebot probably doesn't.

To Reproduce Steps to reproduce the behavior:

Expected behavior Either the import statement should already import all the variations (styles/weights) based on what's used on the page, or it should include them based on if I select that variation while configuring. Or it should allow the user to import them.

Screenshots image image

ankit commented 4 years ago

Thanks for reporting @saadrehman. I think you found a couple of issues:

pasting the import statement from Google Fonts site doesn't work, cause that supports css2 and Stylebot probably doesn't.

If you remove the quotes (or use double quotes) in the @import statement, it would work: @import url(https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;500&display=swap) or @import url("https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;500&display=swap")

I will fix the code so that it is able to parse @import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400&display=swap') correctly.

Either the import statement should already import all the variations (styles/weights) based on what's used on the page or it should include them based on if I select that variation while configuring.

This is a little non-trivial since I will have to look at the computed styles and the custom style for the selected elements. But I think including all the common variations should be feasible.

Thanks!

ankit commented 4 years ago

@saadrehman this should now be fixed in the latest update.