|
|
@ -1,5 +1,6 @@ |
|
|
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
|
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
|
|
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ |
|
|
|
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ |
|
|
|
|
|
|
|
/* globals CFFDictDataMap, CFFDictPrivateDataMap, CFFEncodingMap, CFFStrings, Components, Dict, dump, error, isNum, log, netscape, Stream, warn */ |
|
|
|
/* Copyright 2012 Mozilla Foundation |
|
|
|
/* Copyright 2012 Mozilla Foundation |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
@ -15,6 +16,8 @@ |
|
|
|
* limitations under the License. |
|
|
|
* limitations under the License. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* The Type2 reader code below is only used for debugging purpose since Type2 |
|
|
|
* The Type2 reader code below is only used for debugging purpose since Type2 |
|
|
|
* is only a CharString format and is never used directly as a Font file. |
|
|
|
* is only a CharString format and is never used directly as a Font file. |
|
|
@ -33,7 +36,7 @@ function readCharset(aStream, aCharstrings) { |
|
|
|
|
|
|
|
|
|
|
|
var format = aStream.getByte(); |
|
|
|
var format = aStream.getByte(); |
|
|
|
var count = aCharstrings.length - 1; |
|
|
|
var count = aCharstrings.length - 1; |
|
|
|
if (format == 0) { |
|
|
|
if (format === 0) { |
|
|
|
charset['.notdef'] = readCharstringEncoding(aCharstrings[0]); |
|
|
|
charset['.notdef'] = readCharstringEncoding(aCharstrings[0]); |
|
|
|
|
|
|
|
|
|
|
|
for (var i = 1; i < count + 1; i++) { |
|
|
|
for (var i = 1; i < count + 1; i++) { |
|
|
@ -250,7 +253,7 @@ var Type2Parser = function type2Parser(aFilePath) { |
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
xhr.open('GET', aFilePath, false); |
|
|
|
xhr.open('GET', aFilePath, false); |
|
|
|
xhr.mozResponseType = xhr.responseType = 'arraybuffer'; |
|
|
|
xhr.mozResponseType = xhr.responseType = 'arraybuffer'; |
|
|
|
xhr.expected = (document.URL.indexOf('file:') == 0) ? 0 : 200; |
|
|
|
xhr.expected = (document.URL.indexOf('file:') === 0) ? 0 : 200; |
|
|
|
xhr.send(null); |
|
|
|
xhr.send(null); |
|
|
|
this.data = new Stream(xhr.mozResponseArrayBuffer || xhr.mozResponse || |
|
|
|
this.data = new Stream(xhr.mozResponseArrayBuffer || xhr.mozResponse || |
|
|
|
xhr.responseArrayBuffer || xhr.response); |
|
|
|
xhr.responseArrayBuffer || xhr.response); |
|
|
@ -365,7 +368,7 @@ var Type2Parser = function type2Parser(aFilePath) { |
|
|
|
// Read Charset
|
|
|
|
// Read Charset
|
|
|
|
dump('Read Charset for ' + charStrings.length + ' glyphs'); |
|
|
|
dump('Read Charset for ' + charStrings.length + ' glyphs'); |
|
|
|
var charsetEntry = font.get('charset'); |
|
|
|
var charsetEntry = font.get('charset'); |
|
|
|
if (charsetEntry == 0) { |
|
|
|
if (charsetEntry === 0) { |
|
|
|
error('Need to support CFFISOAdobeCharset'); |
|
|
|
error('Need to support CFFISOAdobeCharset'); |
|
|
|
} else if (charsetEntry == 1) { |
|
|
|
} else if (charsetEntry == 1) { |
|
|
|
error('Need to support CFFExpert'); |
|
|
|
error('Need to support CFFExpert'); |
|
|
|