From 0d6739f742310aee9e3aa8ca06895849d7e64648 Mon Sep 17 00:00:00 2001 From: Paul Gardiner Date: Mon, 29 Jul 2013 11:43:57 +0100 Subject: Add support for freetext annotations This initial commit doesn't entirely complete the task: 1) There are a couple of ucs<->winansi conversions left out, 2) The text displayed by the appearance string can slightly overflow the annotation rectangle. --- include/mupdf/pdf/annot.h | 8 +++++++- include/mupdf/pdf/appearance.h | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/mupdf/pdf/annot.h b/include/mupdf/pdf/annot.h index b0086773..d6950970 100644 --- a/include/mupdf/pdf/annot.h +++ b/include/mupdf/pdf/annot.h @@ -86,11 +86,17 @@ void pdf_delete_annot(pdf_document *doc, pdf_page *page, pdf_annot *annot); void pdf_set_markup_annot_quadpoints(pdf_document *doc, pdf_annot *annot, fz_point *qp, int n); /* - fz_set_ink_annot_list: set the details of an ink annotation. All the points of the multiple arcs + pdf_set_ink_annot_list: set the details of an ink annotation. All the points of the multiple arcs are carried in a single array, with the counts for each arc held in a secondary array. */ void pdf_set_ink_annot_list(pdf_document *doc, pdf_annot *annot, fz_point *pts, int *counts, int ncount, float color[3], float thickness); +/* + pdf_set_free_text_details: set the position, text, font and color for a free text annotation. + Only base 14 fonts are supported and are specified by name. +*/ +void pdf_set_free_text_details(pdf_document *doc, pdf_annot *annot, fz_point *pos, char *text, char *font_name, float font_size, float color[3]); + fz_annot_type pdf_annot_obj_type(pdf_obj *obj); /* diff --git a/include/mupdf/pdf/appearance.h b/include/mupdf/pdf/appearance.h index ead8bfa5..19a7ffbf 100644 --- a/include/mupdf/pdf/appearance.h +++ b/include/mupdf/pdf/appearance.h @@ -30,6 +30,12 @@ void pdf_set_annot_appearance(pdf_document *doc, pdf_annot *annot, fz_rect *rect */ void pdf_set_markup_appearance(pdf_document *doc, pdf_annot *annot, float color[3], float alpha, float line_thickness, float line_height); +/* + pdf_update_free_text_annot_appearance: update the appearance stream for a free text + annotation, basing it on the annoations rectangle and contents. +*/ +void pdf_update_free_text_annot_appearance(pdf_document *doc, pdf_annot *annot); + void pdf_set_ink_appearance(pdf_document *doc, pdf_annot *annot); #endif -- cgit v1.2.3