From 8eb356906b06a5cd31a0677909da33fda094fca3 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 20 Feb 2018 21:58:23 +0100 Subject: Return correct default icon names for optional annotation property. --- source/pdf/pdf-annot-edit.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'source/pdf') 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 -- cgit v1.2.3