[gs-commits] ghostpdl branch, pdfi, updated. jbig2dec-0.14-2335-g8626e2c
[email protected] (Nancy Durgin) Tue, 15 Oct 2019 21:45:26 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, pdfi has been updated
via 8626e2c124fb9d57c92df56d551f27aac7da7861 (commit)
from c4309825a1e77b5d54bc66de804d88c0b9b9fc48 (commit)
----------------------------------------------------------------------
commit 8626e2c124fb9d57c92df56d551f27aac7da7861
Author: Nancy Durgin <[email protected]>
Date: Tue Oct 15 13:30:26 2019 -0700
Add support for UserUnit in Page dict
This scales the page size and the CTM by the /UserUnit.
I separated the page setup and the CTM setup because it is separate
in the gs code.
This doesn't deal with Annotation scaling (see gs code).
Fixes tests_private/pdf/PDF_1.7_FTS/fts_01_0106.pdf
diff --git a/pdf/ghostpdf.h b/pdf/ghostpdf.h
index ac90c60..821fa2d 100644
--- a/pdf/ghostpdf.h
+++ b/pdf/ghostpdf.h
@@ -284,6 +284,7 @@ typedef struct pdf_context_s
bool page_needs_OP;
double PageSize[4];
+ double UserUnit;
/* Page level PDF objects */
pdf_dict *SpotNames;
diff --git a/pdf/pdf_page.c b/pdf/pdf_page.c
index 060f841..a6cbf44 100644
--- a/pdf/pdf_page.c
+++ b/pdf/pdf_page.c
@@ -120,6 +120,23 @@ page_error:
return code;
}
+/* Just dealing with UserUnit for now.
+ * See pdf_PDF2PS_matrix and .pdfshowpage_Install
+ */
+static void pdfi_set_ctm(pdf_context *ctx)
+{
+ gs_matrix mat;
+
+ mat.xx = ctx->UserUnit;
+ mat.xy = 0;
+ mat.yx = 0;
+ mat.yy = ctx->UserUnit;
+ mat.tx = 0;
+ mat.ty = 0;
+
+ gs_concat(ctx->pgs, &mat);
+}
+
static int pdfi_set_media_size(pdf_context *ctx, pdf_dict *page_dict)
{
gs_c_param_list list;
@@ -130,6 +147,7 @@ static int pdfi_set_media_size(pdf_context *ctx, pdf_dict *page_dict)
int code;
uint64_t i;
int64_t rotate = 0;
+ double userunit = 1.0;
gs_c_param_list_write(&list, ctx->memory);
@@ -162,8 +180,14 @@ static int pdfi_set_media_size(pdf_context *ctx, pdf_dict *page_dict)
if (a == NULL)
a = default_media;
+ if (!ctx->nouserunit) {
+ (void)pdfi_dict_knownget_number(ctx, page_dict, "UserUnit", &userunit);
+ }
+ ctx->UserUnit = userunit;
+
for (i=0;i<4;i++) {
code = pdfi_array_get_number(ctx, a, i, &d[i]);
+ d[i] *= userunit;
}
pdfi_countdown(a);
@@ -286,6 +310,7 @@ int pdfi_page_render(pdf_context *ctx, uint64_t page_num)
if (code < 0) {
goto exit2;
}
+ pdfi_set_ctm(ctx);
code = pdfi_dict_knownget_type(ctx, page_dict, "Group", PDF_DICT, (pdf_obj **)&group_dict);
if (code < 0)
Summary of changes:
pdf/ghostpdf.h | 1 +
pdf/pdf_page.c | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+)