0
Completed

Theme - Use new font

hidea 10 years ago updated by Tom 10 years ago 11
I'd like to know how to create a theme with custom fonts (open sans font and others)

I've posted a comment on the Customized Modern theme thread but i guess it is more appropriate to post it here
Under review
The CSS you wrote is very likely to be correct, but you can't server custom fonts with Ubooquity 1.7.0.
I'll have to do a few modifications so that Ubooquity can serve font files in additions to the other theme files.

In the meantime, if you want to use custom fonts anyway, you can active the "Raw files" sharing, share your font files this way and include the corresponding URL in your CSS. Quite ugly but it should work.
Thanks for the update :)

i was wordering if it was possible to use google fonts in this case as the Ubooquity cannot server font files or is this still the same issue ?

By the way Ubooquity rocks thank you so much for such a great piece of soft ! I would love to see more updates, for example the ability to read epub files too, put ratings, save the progress and sync all this with an android client (challenger viewer for example)

A collaboration with plex would be neat too !
 

Yes Google fonts will work as they are not provided by the Ubooquity server but directly by the Google servers.

I have included the modification to allow fonts in theme in the next version (which is a few days away). I even allowed "eot" fonts, although I stringly discourage their use as they are only supported by IE.
Thanks ! i've been working with google fonts on my theme and some fonts are working (Oswald) and some other don't (Open Sans), it seems to be related to server setting as i have this error in the browser console :

Redirect at origin 'http://fonts.gstatic.com' has been blocked from loading by Cross-Origin Resource Sharing policy: The request was redirected to a URL ('about:blank') which has a disallowed scheme for cross-origin requests.

Google has some details on this :

https://developers.google.com/fonts/docs/troubleshooting
Thank for your work ! i'm updating my theme to support additional fonts but it seems that there is a pb with the load of the fonts, the text is loaded 1 second after the content of the page.

Do you have any idea on how to solve this ? i guess it is required to preload the font in a certain way as it is local...

By the way, i don't know why some google fonts are not rendered, for info i use the following :

@import url(http://fonts.googleapis.com/css?family=Open+Sans:400);
with
font-family: 'Open Sans', sans-serif;
font-weight:400;

and there is still an error in the console

Redirect at origin 'http://fonts.gstatic.com' has been blocked from loading by Cross-Origin Resource Sharing policy: The request was redirected to a URL ('about:blank') which has a disallowed scheme for cross-origin requests.

seems related to the header ... http://sixrevisions.com/css/font-face-web-fonts-issues/
Do you have the 1 second delay on font stored locally or on front downloaded from an external server (e.g. Google fonts) ?

As for the error in the console: from what I understand of Cross-Origin Resource Sharing, the HTTP header allowing the access has to come from the server hosting the font, not from Ubooquity server. So there is nothing I can do here. Let me know if I missed something.
I have the once second delay on the font stored locally

funny thing is that the delay appears only on chrome for windows, not for firefox for windows/mac or chrome mac
I did not see the delay in Chrome nor in Firefox (both on Windows 7).
No idea what your problem could be.