summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-annot-edit.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-02-27 11:24:02 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-03-22 14:58:01 +0100
commit21e0da7e2715df87c93433ba9f99be308e6ec814 (patch)
tree4a4c65af79dd7175c6c23ec628504c133bbd069e /source/pdf/pdf-annot-edit.c
parentf3b0e4373af7500155e470931e5a50060f5b4612 (diff)
downloadmupdf-21e0da7e2715df87c93433ba9f99be308e6ec814.tar.xz
Load most annotations, even if they are missing appearances.
Filter out Link and Popup annotations. Links are not comments, popup annotations are auxiliary information for other annotations, so neither of these types should be present in our list of annotations, but all other annotations should be there, whether they have appearance streams or not. Ensure has_new_ap is zero when first loaded, and changed if either the active AP object is changed or the current AP content stream is updated.
Diffstat (limited to 'source/pdf/pdf-annot-edit.c')
-rw-r--r--source/pdf/pdf-annot-edit.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c
index 4f5ffadd..7708f9d7 100644
--- a/source/pdf/pdf-annot-edit.c
+++ b/source/pdf/pdf-annot-edit.c
@@ -129,9 +129,6 @@ pdf_create_annot(fz_context *ctx, pdf_page *page, enum pdf_annot_type type)
/* Make printable as default */
pdf_dict_put_int(ctx, annot_obj, PDF_NAME_F, PDF_ANNOT_IS_PRINT);
- annot = pdf_new_annot(ctx, page);
- annot->ap = NULL;
-
/*
Both annotation object and annotation structure are now created.
Insert the object in the hierarchy and the structure in the
@@ -141,7 +138,9 @@ pdf_create_annot(fz_context *ctx, pdf_page *page, enum pdf_annot_type type)
pdf_update_object(ctx, doc, ind_obj_num, annot_obj);
ind_obj = pdf_new_indirect(ctx, doc, ind_obj_num, 0);
pdf_array_push(ctx, annot_arr, ind_obj);
- annot->obj = pdf_keep_obj(ctx, ind_obj);
+
+ annot = pdf_new_annot(ctx, page, ind_obj);
+ annot->ap = NULL;
/*
Linking must be done after any call that might throw because
@@ -1099,20 +1098,6 @@ pdf_add_annot_ink_list(fz_context *ctx, pdf_annot *annot, int n, fz_point p[])
pdf_dirty_annot(ctx, annot);
}
-static void find_free_font_name(fz_context *ctx, pdf_obj *fdict, char *buf, int buf_size)
-{
- int i;
-
- /* Find a number X such that /FX doesn't occur as a key in fdict */
- for (i = 0; 1; i++)
- {
- fz_snprintf(buf, buf_size, "F%d", i);
-
- if (!pdf_dict_gets(ctx, fdict, buf))
- break;
- }
-}
-
void
pdf_set_text_annot_position(fz_context *ctx, pdf_annot *annot, fz_point pt)
{
@@ -1299,6 +1284,20 @@ pdf_set_annot_author(fz_context *ctx, pdf_annot *annot, const char *author)
pdf_dirty_annot(ctx, annot);
}
+static void find_free_font_name(fz_context *ctx, pdf_obj *fdict, char *buf, int buf_size)
+{
+ int i;
+
+ /* Find a number X such that /FX doesn't occur as a key in fdict */
+ for (i = 0; 1; i++)
+ {
+ fz_snprintf(buf, buf_size, "F%d", i);
+
+ if (!pdf_dict_gets(ctx, fdict, buf))
+ break;
+ }
+}
+
void
pdf_set_free_text_details(fz_context *ctx, pdf_annot *annot, fz_point *pos, char *text, char *font_name, float font_size, float color[3])
{