mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Take the /CIDToGIDMap data into account when computing the hash, in PartialEvaluator.preEvaluateFont
, for composite fonts (bug 1734802)
This is unfortunately *yet another* bug in the `preEvaluateFont`-implementation, and I've lost count of the number of times I've had to tweak this code over the years :-( I really cannot help thinking that PR 4423 was way too simplistic, since it missed a bunch of cases that leads to broken font rendering in many PDF documents. Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1734802
This commit is contained in:
parent
da8df646f5
commit
69a97bcba7
3 changed files with 21 additions and 1 deletions
|
@ -81,6 +81,7 @@ import {
|
|||
LocalTilingPatternCache,
|
||||
} from "./image_utils.js";
|
||||
import { NullStream, Stream } from "./stream.js";
|
||||
import { BaseStream } from "./base_stream.js";
|
||||
import { bidi } from "./bidi.js";
|
||||
import { ColorSpace } from "./colorspace.js";
|
||||
import { DecodeStream } from "./decode_stream.js";
|
||||
|
@ -3139,7 +3140,7 @@ class PartialEvaluator {
|
|||
}
|
||||
|
||||
const cidToGidMap = dict.get("CIDToGIDMap");
|
||||
if (isStream(cidToGidMap)) {
|
||||
if (cidToGidMap instanceof BaseStream) {
|
||||
cidToGidBytes = cidToGidMap.getBytes();
|
||||
}
|
||||
}
|
||||
|
@ -3790,6 +3791,16 @@ class PartialEvaluator {
|
|||
}
|
||||
hash.update(widthsBuf.join());
|
||||
}
|
||||
|
||||
const cidToGidMap =
|
||||
dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
|
||||
if (cidToGidMap instanceof Name) {
|
||||
hash.update(cidToGidMap.name);
|
||||
} else if (cidToGidMap instanceof Ref) {
|
||||
hash.update(cidToGidMap.toString());
|
||||
} else if (cidToGidMap instanceof BaseStream) {
|
||||
hash.update(cidToGidMap.peekBytes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue