I have found that the Kindle PaperWhite does not handle CSS font-size keywords well. If device font-size settings are not at the default, the Kindle will display fonts at uncomfortably extreme sizes. I have created a Calibre regex-function which maps keywords to ems.
1) Restrict search to style files. Apply "Beautify files" tool to make sure code is ready.
2) Set Mode to Regex-function.
3) Search:
font-size: \K([^\d.;]+)
4) Click "Create/Edit" button and paste the following into the code box:
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", ".85em", "1.2em", ".75em", ".75em", "1.3em", "1.5em", "1.1em", ".9em"]
return size[i]
5) Name the function and run.
You can see from the code snippet that you can adjust the mappings to meet your own requirements.