Proper glyph selection for CIDFontType0C fonts.
This commit is contained in:
parent
ea50c078b0
commit
f79c182314
@ -5529,18 +5529,22 @@ var CFFFont = (function CFFFontClosure() {
|
|||||||
var unassignedUnicodeItems = [];
|
var unassignedUnicodeItems = [];
|
||||||
var inverseEncoding = [];
|
var inverseEncoding = [];
|
||||||
var gidStart = 0;
|
var gidStart = 0;
|
||||||
// Even though the CFF font may not actually be a CID font is could have
|
// According to section 9.7.4.2 CIDFontType0C glyph selection should be
|
||||||
// CID information in the font descriptor.
|
// handled differently.
|
||||||
if (this.properties.cidSystemInfo) {
|
if (this.properties.subtype === 'CIDFontType0C') {
|
||||||
// According to section 9.7.4.2 if the font is actually a CID font then
|
|
||||||
// we should use the charset to map CIDs to GIDs. If it is not actually
|
|
||||||
// a CID font then CIDs can be mapped directly to GIDs.
|
|
||||||
if (this.cff.isCIDFont) {
|
if (this.cff.isCIDFont) {
|
||||||
|
// If the font is actually a CID font then we should use the charset
|
||||||
|
// to map CIDs to GIDs.
|
||||||
inverseEncoding = charsets;
|
inverseEncoding = charsets;
|
||||||
} else {
|
} else {
|
||||||
for (var i = 0, ii = charsets.length; i < charsets.length; i++) {
|
// If it is NOT actually a CID font then CIDs should be mapped
|
||||||
|
// directly to GIDs.
|
||||||
|
inverseEncoding = [];
|
||||||
|
for (var i = 0, ii = cff.charStrings.count; i < ii; i++) {
|
||||||
inverseEncoding.push(i);
|
inverseEncoding.push(i);
|
||||||
}
|
}
|
||||||
|
// Use the identity map for charsets as well.
|
||||||
|
charsets = inverseEncoding;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (var charcode in encoding) {
|
for (var charcode in encoding) {
|
||||||
|
BIN
test/pdfs/bug921409.pdf
Normal file
BIN
test/pdfs/bug921409.pdf
Normal file
Binary file not shown.
@ -1162,6 +1162,13 @@
|
|||||||
"type": "eq",
|
"type": "eq",
|
||||||
"about": "A CIDFontType0 font with a CFF font that isn't actually CID."
|
"about": "A CIDFontType0 font with a CFF font that isn't actually CID."
|
||||||
},
|
},
|
||||||
|
{ "id": "bug921409",
|
||||||
|
"file": "pdfs/bug921409.pdf",
|
||||||
|
"md5": "920e88dde0f5436ebe0df0281e1c30ca",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq",
|
||||||
|
"about": "A CIDFontType0 font that actually has a Type1C font file."
|
||||||
|
},
|
||||||
{ "id": "noembed-identity-2",
|
{ "id": "noembed-identity-2",
|
||||||
"file": "pdfs/noembed-identity-2.pdf",
|
"file": "pdfs/noembed-identity-2.pdf",
|
||||||
"md5": "13b7d9ab9579d45c10bc8d499d087f21",
|
"md5": "13b7d9ab9579d45c10bc8d499d087f21",
|
||||||
|
Loading…
Reference in New Issue
Block a user