View Single Post
Old 09-15-2009, 11:57 AM   #18
frabjous
Wizard
frabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
frabjous's Avatar
 
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
Quote:
Originally Posted by Jellby View Post
Yes, that's a consequence of how CSS works. To fully control the format of a (let's call it) "badly structured" book, one would need some knowledge of CSS rules and of the classes used in the document, etc. I don't see a way out of it, other than including a full-feature CSS parser/editor/creator, which, well, I'm absolutely not going to write
I know how CSS works in general; I just didn't know about the !important flag and how it worked until now.

But what I had in mind above is something that went through all the CSS of the source and just changed any "font-family: XXX" attributes to "font-family: inherit" (and stripped any obsolete <font face="XXX"> tags) or something like that. I recognize (as I admitted in an earlier post) that this might be dangerous, since there might be a good reason for it changing it in a particular portion (e.g., in a multilingual document). The idea is that this would be an optional feature of the script that one would have to enable "force font change" or something like that.

I don't think that would require a full CSS parser/editor. A couple regex search and replace should handle it, no? Actually, I think I could probably alter your script accordingly with a few sed lines.

Quote:
This does not mean it's not possible to override anything (and everything) in the book, just that it may be not so straightforward and "drag-and-drop" as wished. In this particular case I guess you could include in your default.css:

Code:
.mypararagraph { font-family: inherit !important; }
That was just an example. I'm not going to guess what class names the CSS of the book uses. If I open the source CSS to look, I might as well just alter the source CSS directly.

Quote:
Before adopting it, however, it would be desirable to discuss the name a bit. Maybe "pdf-style" is too broad, and something like "prince-style" would be better, since there might be other XHTML-to-PDF converters one could use.
prince-style is probably better, unless there's any indication that the Prince extensions are being picked up by other software, which I suppose is a possibility, since they're fairly straightforward and reasonable.
frabjous is offline   Reply With Quote