I have some content which is displayed at at a preview scale, by using em for everything and then scaling the root font size when I want to reduce/enlarge, so can you see the full content by clicking on the preview, at which point I use jQuery to animate the font-size up to 100%:
So basically:
CSS:
.example section {
font-size: 30%;
}
JS:
zoomed.animate({
fontSize: '100%'
});
But see the fiddle to get a better idea.
The problem is, that although the container is scaling with the font size, the browser will wrap the text at slightly different points throughout the animation - I understand the logistics of why this happens (different proportions of characters when rendered at different sizes/hinting etc.), but it looks awful. It's much more noticeable in Chrome than it is in Firefox. Interestingly IE10 doesn't change where the lines wrap at all. This is on Windows - possibly the font rendering on OSX doesn't have this issue.
Can anyone think of some kind of fix or workaround?
One workaround that I considered initially was:
Create the preview at 100% font size, split the text on whitespace, add it to the container one word at a time, when the container increases in height store the position, then wrap each line in an element with whitespace no-wrap and give the container overflow: hidden.
However as I want to use arbitrary HTML (including images sized in ems) for the previews, this isn't really feasible.