From b1a5cbd6273af2f81afa690292135c16b9fe735f Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Fri, 20 Jul 2018 10:40:31 +0200 Subject: [PATCH] Allow tags other than "ZaDb" to specify ZapfDingbats While the PDF specification does use "ZaDb" to specify ZapfDingbats for the text operator (Tf) in its examples, others are valid as well, so only replace existing values with "ZaDb" if they actually don't refer to a ZapfDingbats font when ZapfDingbats is enforced. Bug #107303 --- poppler/Annot.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/poppler/Annot.cc b/poppler/Annot.cc index d37824c1..88777438 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -4092,7 +4092,11 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da if (tfPos >= 0) { tok = (GooString *)daToks->get(tfPos); - if (tok->cmp("/ZaDb")) { + // set Tf to "/ZaDb" if it's not yet referring to a valid ZapfDingbats font, + // a fake one will then be created below + const bool hasZapfDingbatsFont = tok->getLength() >= 1 && tok->getChar(0) == '/' && resources + && (font = resources->lookupFont(tok->getCString() + 1)) && font->getName()->cmp("ZapfDingbats") == 0; + if (!hasZapfDingbatsFont && tok->cmp("/ZaDb")) { tok->clear(); tok->append("/ZaDb"); } -- 2.18.0