mupdf/0001-Write-placeholder-appearance-streams-for-digital-sig.patch
Martin Pluskal aa442929d8 Accepting request 684259 from home:guoyunhe:branches:Publishing
- Add build dependencies:
  * liblcms2-devel
  * Mesa-libGL-devel
  * freeglut-devel
  * pkgconfig(openssl)
  * pkgconfig(xi)
  * pkgconfig(xrandr)
- Change COPYING to %licnese instead of %doc
- Update mupdf-no-strip.patch
- Add patches from Fedora project:
  * mupdf-CVE-2018-16647.patch
  * mupdf-CVE-2018-16648.patch
  * mupdf-CVE-2018-18662.patch
  * 0001-Fix-699840-Use-saved-sig_widget-pointer-to-sign-sign.patch
  * 0001-Write-placeholder-appearance-streams-for-digital-sig.patch
  * 0001-fix-build-on-big-endian.patch
- Update to version 1.14:
  * New features:
    * Added "Source Han Serif" CJK fallback font.
    * Added more scripts to the Noto fallback fonts.
    * Multi-page PNM support.
    * "mutool show" now supports a path syntax for selecting objects to show.
  * Build system simplifications:
    * Auto-generated CMap, ICC, and JS source files are checked in to git.
    * Embedded CMap resources are now generated by a python script.
    * Embedded font resources are linked directly if using GNU ld or windows.
    * Namegen tool replaced by use of C macros.
    * Simplified Makefile.
  * Annotation editing:
    * New annotation editing mode in mupdf-gl.
    * Can create, edit, and delete most annotation types.
    * Can create appearance streams for most annotation types.
    * Can create appearance streams for Tx form fields.
    * Can create appearance streams for Ch form fields.
  * Form filling in mupdf-gl:
    * Can click buttons, checkboxes, and radioboxes.
    * Can fill out text fields using dialog box.
    * Can select choice options using dialog box.
    * Can verify and sign digital signatures.
  * Improved UI for mupdf-gl:
    * Password dialog.
    * Error dialog.
    * Open/save file dialog.
    * Snap selection to words or lines by holding control or control+shift.
    * Save and restore current location, bookmarks, and navigation history.
  * Bug fixes:
    * Improved CJK character fallback handling in EPUB.
  * API changes:
    * Pass rectangle and matrix structs by value.
    * Replaced PDF_NAME_Xxx macros with PDF_NAME(Xxx).
    * Added PDF_TRUE, PDF_FALSE, and PDF_NULL constant pdf_obj* macros.
    * Added helper functions: pdf_dict_get_int, etc.
    * Removed 'doc' argument in pdf_new_int, etc.
    * Quads instead of rects when highlighting and searching text.
    * mutool run: Pass arguments to script in scriptArgs global.

OBS-URL: https://build.opensuse.org/request/show/684259
OBS-URL: https://build.opensuse.org/package/show/Publishing/mupdf?expand=0&rev=81
2019-03-12 13:41:52 +00:00

58 lines
2.1 KiB
Diff

From 7f5ccdee1f8a990e1cd675bd1a7ab4673e797f46 Mon Sep 17 00:00:00 2001
Message-Id: <7f5ccdee1f8a990e1cd675bd1a7ab4673e797f46.1542275308.git.mjg@fedoraproject.org>
From: Tor Andersson <tor.andersson@artifex.com>
Date: Wed, 7 Nov 2018 19:46:54 +0100
Subject: [PATCH] Write placeholder appearance streams for digital signatures.
A proper appearance stream is written when signing with a certificate.
This is just to create a placeholder appearance when the original document
did not write one.
---
source/pdf/pdf-appearance.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c
index ceadfd09..c18d5860 100644
--- a/source/pdf/pdf-appearance.c
+++ b/source/pdf/pdf-appearance.c
@@ -1066,6 +1066,25 @@ pdf_write_ch_widget_appearance(fz_context *ctx, pdf_annot *annot, fz_buffer *buf
pdf_write_tx_widget_appearance(ctx, annot, buf, rect, bbox, matrix, res, text, ff);
}
+static void
+pdf_write_sig_widget_appearance(fz_context *ctx, pdf_annot *annot, fz_buffer *buf,
+ fz_rect *rect, fz_rect *bbox, fz_matrix *matrix, pdf_obj **res)
+{
+ float x0 = rect->x0 + 1;
+ float y0 = rect->y0 + 1;
+ float x1 = rect->x1 - 1;
+ float y1 = rect->y1 - 1;
+ float w = x1 - x0;
+ float h = y1 - y0;
+ fz_append_printf(ctx, buf, "1 w\n0 G\n");
+ fz_append_printf(ctx, buf, "%g %g %g %g re\n", x0, y0, w, h);
+ fz_append_printf(ctx, buf, "%g %g m %g %g l\n", x0, y0, x1, y1);
+ fz_append_printf(ctx, buf, "%g %g m %g %g l\n", x1, y0, x0, y1);
+ fz_append_printf(ctx, buf, "s\n");
+ *bbox = *rect;
+ *matrix = fz_identity;
+}
+
static void
pdf_write_widget_appearance(fz_context *ctx, pdf_annot *annot, fz_buffer *buf,
fz_rect *rect, fz_rect *bbox, fz_matrix *matrix, pdf_obj **res)
@@ -1115,6 +1134,10 @@ pdf_write_widget_appearance(fz_context *ctx, pdf_annot *annot, fz_buffer *buf,
fz_catch(ctx)
fz_rethrow(ctx);
}
+ else if (pdf_name_eq(ctx, ft, PDF_NAME(Sig)))
+ {
+ pdf_write_sig_widget_appearance(ctx, annot, buf, rect, bbox, matrix, res);
+ }
else
{
fz_throw(ctx, FZ_ERROR_GENERIC, "cannot create appearance stream for %s widgets", pdf_to_name(ctx, ft));
--
2.19.1.1238.g4b45f61cc0