1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge pull request #4259 from brendandahl/built-in-cmaps-squash

Adds built in CMaps and unifies the glyph mapping.
This commit is contained in:
Yury Delendik 2014-03-13 10:27:48 -05:00
commit 7963f22545
186 changed files with 414503 additions and 1138 deletions

View file

@ -28,6 +28,7 @@
// "firefox-bin: Fatal IO error 12 (Cannot allocate memory) on X server :1."
// PDFJS.disableWorker = true;
PDFJS.enableStats = true;
PDFJS.cMapUrl = '../external/cmaps/';
var appPath, masterMode, browser, canvas, dummyCanvas, currentTaskIdx,
manifest, stdout;

View file

@ -9,7 +9,9 @@ describe('font_fpgm', function() {
var font = new Font("font", new Stream(font2324), {
loadedName: 'font',
type: 'CIDFontType2',
differences: []
differences: [],
defaultEncoding: [],
cMap: CMapFactory.create(new Name('Identity-H'))
});
ttx(font.data, function(result) { output = result; });
runs(function() {

View file

@ -11,7 +11,7 @@ describe('font_post', function() {
loadedName: 'font',
type: 'TrueType',
differences: [],
baseEncoding: []
defaultEncoding: []
});
ttx(font.data, function(result) { output = result; });
runs(function() {
@ -26,7 +26,9 @@ describe('font_post', function() {
var font = new Font("font", new Stream(font1282), {
loadedName: 'font',
type: 'CIDFontType2',
differences: []
differences: [],
defaultEncoding: [],
cMap: CMapFactory.create(new Name('Identity-H'))
});
ttx(font.data, function(result) { output = result; });
runs(function() {

View file

@ -12,7 +12,8 @@ describe('font_post', function() {
loadedName: 'font',
type: 'CIDFontType2',
differences: [],
baseEncoding: []
defaultEncoding: [],
cMap: CMapFactory.create(new Name('Identity-H'))
});
ttx(font.data, function(result) { output = result; });
runs(function() {
@ -28,7 +29,7 @@ describe('font_post', function() {
loadedName: 'font',
type: 'TrueType',
differences: [],
baseEncoding: []
defaultEncoding: []
});
ttx(font.data, function(result) { output = result; });
runs(function() {
@ -44,7 +45,7 @@ describe('font_post', function() {
loadedName: 'font',
type: 'TrueType',
differences: [],
baseEncoding: []
defaultEncoding: []
});
ttx(font.data, function(result) { output = result; });
runs(function() {

View file

@ -28,6 +28,7 @@
<script type="text/javascript" src="../../src/core/crypto.js"></script>
<script type="text/javascript" src="../../src/core/pattern.js"></script>
<script type="text/javascript" src="../../src/core/evaluator.js"></script>
<script type="text/javascript" src="../../src/core/cmap.js"></script>
<script type="text/javascript" src="../../src/core/fonts.js"></script>
<script type="text/javascript" src="../../src/core/glyphlist.js"></script>
<script type="text/javascript" src="../../src/core/image.js"></script>

View file

@ -220,6 +220,11 @@ class TestHandlerBase(BaseHTTPRequestHandler):
self.sendIndex(url.path, url.query)
return
pieces = path.split(os.sep);
if pieces[len(pieces) - 2] == 'cmaps':
self.sendFile(path, '.properties');
return
if not (prefix == DOC_ROOT
and os.path.isfile(path)
and ext in MIMEs):

View file

@ -1,6 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* globals expect, it, describe, StringStream, Lexer, CMapFactory */
/* globals expect, it, describe, StringStream, Lexer, CMapFactory, Name */
'use strict';
@ -82,5 +82,22 @@ describe('cmap', function() {
expect(c[0]).toEqual(0x8EA1A1A1);
expect(c[1]).toEqual(4);
});
it('read usecmap', function() {
var str = '/Adobe-Japan1-1 usecmap\n';
var stream = new StringStream(str);
var cmap = CMapFactory.create(stream, null, '../../external/cmaps/');
expect(cmap.useCMap).toBeDefined();
});
it('parses wmode', function() {
var str = '/WMode 1 def\n';
var stream = new StringStream(str);
var cmap = CMapFactory.create(stream);
expect(cmap.vertical).toEqual(true);
});
it('loads built in cmap', function() {
var cmap = CMapFactory.create(new Name('Adobe-Japan1-1'),
'../../external/cmaps/',
null);
});
});

View file

@ -386,7 +386,7 @@ describe('font', function() {
var parser = new Type1Parser(stream);
var props = { overridableEncoding: true };
var program = parser.extractFontHeader(props);
expect(props.baseEncoding[33]).toEqual('arrowright');
expect(props.builtInEncoding[33]).toEqual('arrowright');
});
});
});