1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

[api-minor] Refactor fetching of built-in CMaps to utilize a factory on the display side instead, to allow users of the API to provide a custom CMap loading factory (e.g. for use with Node.js)

Currently the built-in CMap files are loaded in `src/core/cmap.js` using `XMLHttpRequest` directly. For some environments that might be a problem, hence this patch refactors that to instead use a factory to load built-in CMaps on the main thread and message the data to the worker thread.

This is inspired by other recent work, e.g. the addition of the `CanvasFactory`, and to a large extent on the IRC discussion starting at http://logs.glob.uno/?c=mozilla%23pdfjs&s=12+Oct+2016&e=12+Oct+2016#c53010.
This commit is contained in:
Jonas Jenwald 2017-02-12 15:54:41 +01:00
parent b509a3f83c
commit 769c1450b7
10 changed files with 211 additions and 111 deletions

View file

@ -20,7 +20,9 @@ describe('font_post', function() {
});
it('has invalid selection attributes presence', function(done) {
CMapFactory.create(new Name('Identity-H')).then(function (cMap) {
CMapFactory.create({
encoding: Name.get('Identity-H'),
}).then(function (cMap) {
var font = new Font("font", new Stream(font1282), {
loadedName: 'font',
type: 'CIDFontType2',