View Single Post
Old 01-18-2009, 01:53 PM   #1
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Conditional CSS rules

Hi all,

Today I uploaded my first epub file with embedded fonts, and while I think it works fine, there are some things I miss.

I wanted the code for using the embedded fonts in the CSS to something like an add-on, something that could be activated or deactivated, like a line that could be commented out. I arrived at a not so satisfying solution: Use an "@import" statement at the beginning of the standard .css file (it has to be at the beginning) directing to an auxiliary file and tag the rules in this auxiliary file with "!important", so that they override the rules in the standard one. I could have added a "<link>" in each file's "<head>" instead, but that would mean modifying the file for every chapter.

The other problem is that I would like to apply some modifications (font size, margins... defined in the auxiliary .css) only if the embedded font is being used, and use the normal parameters in the normal .css otherwise. If a system does not support embedded fonts or if the user somehow disables it, I don't want the books to use settings "optimized" for a font that's not being used.

Any thoughts on how this could be improved (if possible)?
Jellby is offline   Reply With Quote