Quote:
Originally Posted by kovidgoyal
I find that ADE doesn't resize text if absolute font sizes are used (e.g. px or pt). So I've written code to convert absolute font sizes to relative font sizes. But I had to reverse engineer the algorithm ADE uses to calculate the final rendered font size.
|
Yes, this is a common problem. Digital Editions EPUB engine is pretty much a CSS 2.1 text processor. When user changes the font size we simply feed different font-size value to the root element and then it gets inherited according to CSS rules. There is nothing special that we do.
To keep text resizable you pretty much always have to use em unit or percentage. For most content, it is sufficient to just scale the absolute value to the fraction of the default font size (which I think is somewhat what you are doing). However this does not work well if there is a block of text that uses a particular font size and a subblock in it that also sets its own font size. The problem there is that per CSS rules relative font size is given relative to the parent element, so relative font size for the inner element has to be given relative to the outer element, not relative to the default size. When size comes from CSS, this may be pretty hard to fix.
Longer term, I think we need to support CSS3 "rem" unit which is font size relative to the root element. It would work much more reliably, but we'll need to get IDPF blessing for that.