From 53ceff549544670e3d3a564cb3952740ee807c09 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Sun, 10 Sep 2017 16:02:03 +1200 Subject: [PATCH] Fix form and annotation borders not being drawn don't force border width to 0 when /W and/or /S are not present in /BS instead set missing fields to their default values as specified in the specs reverts commit 289679405 --- poppler/Annot.cc | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/poppler/Annot.cc b/poppler/Annot.cc index 87985675..9aab1605 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -628,39 +628,29 @@ AnnotBorderBS::AnnotBorderBS() { AnnotBorderBS::AnnotBorderBS(Dict *dict) { Object obj1, obj2; - // acroread 8 seems to need both W and S entries for - // any border to be drawn, even though the spec - // doesn't claim anything of that sort. We follow - // that behaviour by veryifying both entries exist - // otherwise we set the borderWidth to 0 - // --jrmuizel obj1 = dict->lookup("W"); + width = obj1.isNum() ? obj1.getNum() : 1; + obj2 = dict->lookup("S"); - if (obj1.isNum() && obj2.isName()) { - const char *styleName = obj2.getName(); - - width = obj1.getNum(); - - if (!strcmp(styleName, "S")) { - style = borderSolid; - } else if (!strcmp(styleName, "D")) { - style = borderDashed; - } else if (!strcmp(styleName, "B")) { - style = borderBeveled; - } else if (!strcmp(styleName, "I")) { - style = borderInset; - } else if (!strcmp(styleName, "U")) { - style = borderUnderlined; - } else { - style = borderSolid; - } + const char *styleName = obj2.isName() ? obj2.getName() : "S"; + + if (!strcmp(styleName, "S")) { + style = borderSolid; + } else if (!strcmp(styleName, "D")) { + style = borderDashed; + } else if (!strcmp(styleName, "B")) { + style = borderBeveled; + } else if (!strcmp(styleName, "I")) { + style = borderInset; + } else if (!strcmp(styleName, "U")) { + style = borderUnderlined; } else { - width = 0; + style = borderSolid; } if (style == borderDashed) { obj1 = dict->lookup("D"); - if (obj1.isArray()) + if (obj1.isArray()) parseDashArray(&obj1); if (!dash) { -- 2.14.1