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

Change the way Type 2 CID fonts are encoded. Move the cmap glyphs above the first 255 unicode values so that fillText does not change them and create an encoding to map characters to the glyphs.

This commit is contained in:
Adil Allawi 2011-08-19 14:04:34 +01:00
parent 170871bbfa
commit 5a528944f0
4 changed files with 616 additions and 39 deletions

7
pdf.js
View file

@ -4028,14 +4028,15 @@ var PartialEvaluator = (function() {
if (subType.name == 'CIDFontType2') {
var cidToGidMap = descendant.get('CIDToGIDMap');
if (cidToGidMap && IsRef(cidToGidMap)) {
// Extract the charset from the CIDToGIDMap
// Extract the encoding from the CIDToGIDMap
var glyphsStream = xref.fetchIfRef(cidToGidMap);
var glyphsData = glyphsStream.getBytes(0);
var i = 0;
// Glyph ids are big-endian 2-byte values
encodingMap[0] = 0; //set this to 0 to verify the font has an encoding
for (var j = 0; j < glyphsData.length; j++) {
var glyphID = (glyphsData[j++] << 8) | glyphsData[j];
charset.push(glyphID);
if (glyphID != 0)
encodingMap[j>>1] = glyphID;
}
}
}