summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-appearance.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-06-19 13:15:31 +0200
committerRobin Watts <robin.watts@artifex.com>2018-06-22 16:48:50 +0100
commitf7ace61076d0ab3c71e1d2bd70967ddb0b86f220 (patch)
tree8bd8b4fe4d7414685d162f66911e9951ea3dce16 /source/pdf/pdf-appearance.c
parent148b0934370336fc8b260e8c3aef83daf4d80ba4 (diff)
downloadmupdf-f7ace61076d0ab3c71e1d2bd70967ddb0b86f220.tar.xz
Keep copy of decoded utf8 text string in pdf_obj.
Removes the need to alloc/free text strings in the API, allowing for simple functions like pdf_dict_get_text_string.
Diffstat (limited to 'source/pdf/pdf-appearance.c')
-rw-r--r--source/pdf/pdf-appearance.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c
index c3e94baa..9753be92 100644
--- a/source/pdf/pdf-appearance.c
+++ b/source/pdf/pdf-appearance.c
@@ -906,11 +906,12 @@ pdf_write_free_text_appearance(fz_context *ctx, pdf_annot *annot, fz_buffer *buf
{
const char *font;
float size, color[3];
- char *text;
+ const char *text;
float w, h, t, b;
int q, r;
/* /Rotate is an undocumented annotation property supported by Adobe */
+ text = pdf_get_annot_contents(ctx, annot);
r = pdf_dict_get_int(ctx, annot->obj, PDF_NAME(Rotate));
q = pdf_annot_quadding(ctx, annot);
pdf_annot_default_appearance(ctx, annot, &font, &size, color);
@@ -933,13 +934,7 @@ pdf_write_free_text_appearance(fz_context *ctx, pdf_annot *annot, fz_buffer *buf
fz_append_printf(ctx, buf, "%g %g %g %g re\nS\n", b/2, b/2, w-b, h-b);
}
- text = pdf_copy_annot_contents(ctx, annot);
- fz_try(ctx)
- write_variable_text(ctx, annot, buf, res, text, font, size, color, q, w, h, b*2, 1);
- fz_always(ctx)
- fz_free(ctx, text);
- fz_catch(ctx)
- fz_rethrow(ctx);
+ write_variable_text(ctx, annot, buf, res, text, font, size, color, q, w, h, b*2, 1);
}
static void