mozilla/pdf.js — pull request #4512 by fkaelberer (2014-03-24 09:42:31+00:00)
Title: Clean up duplicate string conversion functions

This PR does the following:

1. Move `fonts.js->Font.string32` and `fonts_loader.js->FontLoader.string32` to `Utils.js->string32`
2. Move `fonts.js->Font.stringToArray` and `fonts.js->CFFCompiler.stringToArray` to `Utils.js->stringToArray`
3. remove `fonts.js->Font.arrayToString` and use `Utils.js->bytesToString` instead
4. Use `String.fromCharCode(a, b)` instead of `String.fromCharCode(a) + String.fromCharCode(b)`
5. In `Utils.js->bytesToString`, use `String.fromCharCode.apply(null, bytes)` instead of pushing chars to an array if "possible" (because its >10x faster for longer arrays).
If the bytes array is too long, a "too many arguments" warning will appear. **Question**: What is the maximum number of function arguments that is accepted by all browsers? FF/chrome/ie7 accept 500000/120000/120000 arguments, so I felt that a maximum of 65000 should be safe.