Ensure that we fully load Type3 fonts in PartialEvaluator.getTextContent

This is necessary now, since with the previous patch the /FontBBox potentially depends on the contents of the /CharProcs-streams.
Note that if `getOperatorList` is called *before* `getTextContent`, this patch doesn't matter since the font is already fully loaded/parsed. However, for e.g. the `text` test-cases this is necessary to ensure correct reference images.
This commit is contained in:
Jonas Jenwald 2021-05-29 20:01:52 +02:00
parent 20770cb06a
commit eefc94ceb7

View File

@ -2251,6 +2251,20 @@ class PartialEvaluator {
function handleSetFont(fontName, fontRef) {
return self
.loadFont(fontName, fontRef, resources)
.then(function (translated) {
if (!translated.font.isType3Font) {
return translated;
}
return translated
.loadType3Data(self, resources, task)
.catch(function () {
// Ignore Type3-parsing errors, since we only use `loadType3Data`
// here to ensure that we'll always obtain a useful /FontBBox.
})
.then(function () {
return translated;
});
})
.then(function (translated) {
textState.font = translated.font;
textState.fontMatrix =