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]