mozilla/pdf.js — pull request #1202 by ironymark (2012-02-13 02:21:00+00:00)
Title: I fixed up some issues with bidi selection

Corrected bidi algorithm to match PDF special case and tidied code
Fixed an issue calculating the number of characters in the text
integrated the call to bidi in function that creates the div
set the bidi direction of the div to match the enclosed text

more controversially - I now scale the text div to match the PDF text using transforms instead of using letter-space. This gives much smoother selection and better text matching. As Arabic fonts have mandatory and optional ligatures it is impossible to predict the number of characters for the letter-spacing calculation.

The problem is that I have to use the proprietary moz-transform style. I need to modify the code to use the equivalent style on webkit, ie and opera - but I don't know the right way.