diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-02-20 21:58:23 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-02-27 14:08:02 +0100 |
commit | 8eb356906b06a5cd31a0677909da33fda094fca3 (patch) | |
tree | 8013b4552da601acc5f74bc4f9f75c736b33b0cd | |
parent | 5dc382759fb49d7f47e6337f774f85986f2a83ba (diff) | |
download | mupdf-8eb356906b06a5cd31a0677909da33fda094fca3.tar.xz |
Return correct default icon names for optional annotation property.
-rw-r--r-- | source/pdf/pdf-annot-edit.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c index 92a3646d..ccaf1c1c 100644 --- a/source/pdf/pdf-annot-edit.c +++ b/source/pdf/pdf-annot-edit.c @@ -323,8 +323,22 @@ pdf_annot_has_icon_name(fz_context *ctx, pdf_annot *annot) const char * pdf_annot_icon_name(fz_context *ctx, pdf_annot *annot) { + pdf_obj *name; check_allowed_subtypes(ctx, annot, PDF_NAME_Name, icon_name_subtypes); - return pdf_to_name(ctx, pdf_dict_get(ctx, annot->obj, PDF_NAME_Name)); + name = pdf_dict_get(ctx, annot->obj, PDF_NAME_Name); + if (!name) + { + pdf_obj *subtype = pdf_dict_get(ctx, annot->obj, PDF_NAME_Subtype); + if (pdf_name_eq(ctx, subtype, PDF_NAME_Text)) + return "Note"; + if (pdf_name_eq(ctx, subtype, PDF_NAME_Stamp)) + return "Draft"; + if (pdf_name_eq(ctx, subtype, PDF_NAME_FileAttachment)) + return "PushPin"; + if (pdf_name_eq(ctx, subtype, PDF_NAME_Sound)) + return "Speaker"; + } + return pdf_to_name(ctx, name); } void |