summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-08-16 14:11:38 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-08-21 13:14:58 +0200
commitbb0efcaa51affbfc42f2c1c9c16ef646a27ee9db (patch)
tree51e7fb2d59a93089f37d64b31cfc769c30584258
parentd0128375e8a08c49d4d7e3e5612961237c696db8 (diff)
downloadmupdf-bb0efcaa51affbfc42f2c1c9c16ef646a27ee9db.tar.xz
Fix 699625: Apply more vertical padding for multiline form fields.
The exact value used by Adobe will need further investigation, but this gets pretty close.
-rw-r--r--source/pdf/pdf-appearance.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c
index 84c899cd..b19294bd 100644
--- a/source/pdf/pdf-appearance.c
+++ b/source/pdf/pdf-appearance.c
@@ -938,18 +938,18 @@ write_variable_text(fz_context *ctx, pdf_annot *annot, fz_buffer *buf, pdf_obj *
fz_append_string(ctx, buf, "BT\n");
fz_append_printf(ctx, buf, "%g %g %g rg\n", color[0], color[1], color[2]);
fz_append_printf(ctx, buf, "/%s %g Tf\n", fontname, size);
- if (comb > 0)
+ if (multiline)
+ {
+ fz_append_printf(ctx, buf, "%g TL\n", lineheight);
+ fz_append_printf(ctx, buf, "%g %g Td\n", xpadding, ypadding+h);
+ write_simple_string_with_quadding(ctx, buf, font, size, text, w, q);
+ }
+ else if (comb > 0)
{
float ty = (h - size) / 2;
fz_append_printf(ctx, buf, "%g %g Td\n", xpadding, ypadding+h-baseline-ty);
write_comb_string(ctx, buf, text, text + strlen(text), font, (w * 1000 / size) / comb);
}
- else if (multiline)
- {
- fz_append_printf(ctx, buf, "%g TL\n", lineheight);
- fz_append_printf(ctx, buf, "%g %g Td\n", xpadding, ypadding+h+(size-baseline));
- write_simple_string_with_quadding(ctx, buf, font, size, text, w, q);
- }
else
{
float tx = 0, ty = (h - size) / 2;
@@ -1045,15 +1045,15 @@ pdf_write_tx_widget_appearance(fz_context *ctx, pdf_annot *annot, fz_buffer *buf
b = 0;
}
- if (ff & PDF_TX_FIELD_IS_COMB)
+ if (ff & PDF_TX_FIELD_IS_MULTILINE)
+ write_variable_text(ctx, annot, buf, res, text, font, size, color, q, w, h, b+2, b+3, 1, 0);
+ else if (ff & PDF_TX_FIELD_IS_COMB)
{
int maxlen = pdf_to_int(ctx, pdf_dict_get_inheritable(ctx, annot->obj, PDF_NAME(MaxLen)));
write_variable_text(ctx, annot, buf, res, text, font, size, color, q, w, h, 0, 0, 0, maxlen);
}
- else if (ff & PDF_TX_FIELD_IS_MULTILINE)
- write_variable_text(ctx, annot, buf, res, text, font, size, color, q, w, h, b*2+2, b*2, 1, 0);
else
- write_variable_text(ctx, annot, buf, res, text, font, size, color, q, w, h, b*2+2, b*2, 0, 0);
+ write_variable_text(ctx, annot, buf, res, text, font, size, color, q, w, h, b+2, b, 0, 0);
fz_append_string(ctx, buf, "Q\nEMC\n");
}