Quote:
Originally Posted by retiredbiker
I have a blunt-instrument approach that works for cases where the css is in em and there are small fonts:
Search for font-size: 0\.\d+em;
Replace with: font-size: 1em;
I run this on the css file(s) to get rid of those small sizes in quotations and so on. It doesn't fix everything, but it's helpful on many books. All the "0.nnem" sizes become 1em.
There is a regex function that was posted here some long time ago that is also quite helpful, so probably worth repeating, that lets you redefine font size key words to em, and roll your own mapping:
Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
# Match from list of size keywords
i = ["medium", "small", "large", "x-small", "xx-small", "x-large", "xx-large", "larger", "smaller"].index(match.group(1))
# Map of corresponding sizes. Adjust as needed.
size = ["1em", "1em", "1.2em", ".9em", ".9em", "1.3em", "1.5em", "1.1em", ".9em"]
return size[i]
|
But that mapping can screw things up. For example, I've seen plenty of cases where a font size of small is used for the copyright page. Also, small is sometimes used for smallcaps.
What I do is remove any funky font sizes. So if small is used for the base font size, I'll dump it and also fix x-small to small. I prefer no font size specified for the base font. Sometimes offset text is in a smaller size and I'll fix that as well. The more you work with the CSS, the more you'll learn and then you'll be able to edit better especially when the code is a mess (aka Vellum).