summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-04-26 17:49:07 +0000
committerKarl Berry <karl@freefriends.org>2020-04-26 17:49:07 +0000
commitdf977d08809720abcaaca4fd60c90be5da5696e5 (patch)
tree1dd0b1ca94578dc8a71c5262aab677cc4edcceb7
parent125c39ffcc5f6dacdbae6a87fd3061af41acf92a (diff)
xetex: use our own pplib instead of poppler
git-svn-id: svn://tug.org/texlive/trunk@54889 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/xetexdir/ChangeLog10
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.c14
-rw-r--r--Build/source/texk/web2c/xetexdir/am/xetex.am13
-rw-r--r--Build/source/texk/web2c/xetexdir/pdfimage.cpp99
4 files changed, 83 insertions, 53 deletions
diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog
index 411b995da33..66e25e77c7d 100644
--- a/Build/source/texk/web2c/xetexdir/ChangeLog
+++ b/Build/source/texk/web2c/xetexdir/ChangeLog
@@ -1,3 +1,13 @@
+2020-04-26 Karl Berry <karl@freefriends.org>
+
+ * am/xetex.am (xetex_cppflags, xetex_ldadd, xetex_dependencies):
+ use pplib instead of poppler.
+
+2020-04-26 Akira Kakuto <kakuto@w32tex.org>
+
+ * XeTeX_ext.c,
+ * pdfimage.cpp: use pplib instead of poppler.
+
2020-03-27 Karl Berry <karl@tug.org>
* TeX Live 2020.
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
index 0aee4ee38a4..4e7d113ad7a 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -38,9 +38,11 @@ authorization from the copyright holders.
#include <w2c/config.h>
-#ifndef POPPLER_VERSION
-#include <poppler-config.h>
-#endif
+/*
+ * From TeX Live 2021, we use pplib by Pawe\l Jackowski instead of
+ * libpoppler
+ */
+#include <ppapi.h>
#include <png.h>
#include <zlib.h>
@@ -170,7 +172,7 @@ void initversionstring(char **versions)
"Compiled with Graphite2 version %d.%d.%d; using %d.%d.%d\n"
"Compiled with HarfBuzz version %s; using %s\n"
"Compiled with libpng version %s; using %s\n"
- "Compiled with poppler version %s\n"
+ "Compiled with pplib version %s\n"
#ifdef XETEX_MAC
"Using Mac OS X Core Text and Cocoa frameworks\n"
#else
@@ -187,7 +189,7 @@ void initversionstring(char **versions)
+ strlen(hb_version_string())
+ strlen(PNG_LIBPNG_VER_STRING)
+ strlen(png_libpng_ver)
- + strlen(POPPLER_VERSION)
+ + strlen(pplib_version)
#ifndef XETEX_MAC
+ 6 * 3 /* for fontconfig version #s (won't really need 3 digits per field!) */
#endif
@@ -217,7 +219,7 @@ void initversionstring(char **versions)
GR2_VERSION_MAJOR, GR2_VERSION_MINOR, GR2_VERSION_BUGFIX,
grMajor, grMinor, grBugfix,
HB_VERSION_STRING, hb_version_string(),
- PNG_LIBPNG_VER_STRING, png_libpng_ver, POPPLER_VERSION
+ PNG_LIBPNG_VER_STRING, png_libpng_ver, pplib_version
#ifndef XETEX_MAC
,
FC_VERSION / 10000, (FC_VERSION % 10000) / 100, FC_VERSION % 100,
diff --git a/Build/source/texk/web2c/xetexdir/am/xetex.am b/Build/source/texk/web2c/xetexdir/am/xetex.am
index de3a61e4691..04e7f9ca906 100644
--- a/Build/source/texk/web2c/xetexdir/am/xetex.am
+++ b/Build/source/texk/web2c/xetexdir/am/xetex.am
@@ -1,7 +1,7 @@
## $Id$
## texk/web2c/xetexdir/am/xetex.am: Makefile fragment for XeTeX.
##
-## Copyright 2017 Karl Berry <tex-live@tug.org>
+## Copyright 2017-2020 Karl Berry <tex-live@tug.org>
## Copyright 2009-2015 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
@@ -28,19 +28,19 @@ xetex_cppflags += $(FREETYPE2_INCLUDES)
xetex_cppflags += $(TECKIT_INCLUDES)
xetex_cppflags += $(HARFBUZZ_INCLUDES)
xetex_cppflags += $(GRAPHITE2_INCLUDES)
-xetex_cppflags += $(POPPLER_INCLUDES)
xetex_cppflags += $(LIBPNG_INCLUDES)
xetex_cppflags += $(ZLIB_INCLUDES)
+xetex_cppflags += $(PPLIB_INCLUDES)
xetex_cppflags += -I$(srcdir)/libmd5
xetex_ldadd = $(libxetex)
xetex_ldadd += $(HARFBUZZ_LIBS)
xetex_ldadd += $(GRAPHITE2_LIBS)
xetex_ldadd += $(ICU_LIBS) $(ICU_LIBS_EXTRA)
xetex_ldadd += $(TECKIT_LIBS)
-xetex_ldadd += $(POPPLER_LIBS)
xetex_ldadd += $(LIBPNG_LIBS)
xetex_ldadd += $(FREETYPE2_LIBS)
xetex_ldadd += $(ZLIB_LIBS)
+xetex_ldadd += $(PPLIB_LIBS)
xetex_ldadd += libmd5.a
xetex_dependencies = $(proglib)
xetex_dependencies += $(KPATHSEA_DEPEND)
@@ -48,26 +48,23 @@ xetex_dependencies += $(ICU_DEPEND)
xetex_dependencies += $(TECKIT_DEPEND)
xetex_dependencies += $(HARFBUZZ_DEPEND)
xetex_dependencies += $(GRAPHITE2_DEPEND)
-xetex_dependencies += $(POPPLER_DEPEND)
xetex_dependencies += $(LIBPNG_DEPEND)
xetex_dependencies += $(FREETYPE2_DEPEND)
xetex_dependencies += $(ZLIB_DEPEND)
+xetex_dependencies += $(PPLIB_DEPEND)
xetex_dependencies += libmd5.a
if XETEX_MACOSX
-
xetex_cppflags += -DXETEX_MAC
xetex_LDFLAGS = -framework ApplicationServices -framework Cocoa
OBJCXXFLAGS += -std=c++11
else !XETEX_MACOSX
-
xetex_cppflags += $(FONTCONFIG_INCLUDES)
xetex_ldadd += $(FONTCONFIG_LIBS)
endif !XETEX_MACOSX
-
xetex_CPPFLAGS = $(xetex_cppflags)
xetex_CFLAGS = $(WARNING_CFLAGS)
xetex_CXXFLAGS = # $(WARNING_CXXFLAGS)
@@ -75,7 +72,7 @@ xetex_CXXFLAGS = # $(WARNING_CXXFLAGS)
## With --enable-ipc, XeTeX may need to link with -lsocket.
xetex_LDADD = $(xetex_ldadd) $(LDADD) $(ipc_socketlibs)
-# We must create libxetex.a etc before building the xetex_OBJECTS
+## We must create libxetex.a etc before building the xetex_OBJECTS
xetex_prereq = $(libxetex) xetexdir/etex_version.h xetexdir/xetex_version.h
$(xetex_OBJECTS): $(xetex_prereq)
diff --git a/Build/source/texk/web2c/xetexdir/pdfimage.cpp b/Build/source/texk/web2c/xetexdir/pdfimage.cpp
index 99d916430f3..38d51d1ce61 100644
--- a/Build/source/texk/web2c/xetexdir/pdfimage.cpp
+++ b/Build/source/texk/web2c/xetexdir/pdfimage.cpp
@@ -36,9 +36,13 @@ authorization from the copyright holders.
#include "pdfimage.h"
-#include "PDFDoc.h"
-#include "Catalog.h"
-#include "Page.h"
+/*
+ * From TeX Live 2021, we use pplib by Pawe\l Jackowski instead of
+ * libpoppler
+ */
+extern "C" {
+#include "ppapi.h"
+}
#include "XeTeX_ext.h"
@@ -53,22 +57,14 @@ int
pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box)
/* return the box converted to TeX points */
{
- GooString* name = new GooString(filename);
- PDFDoc* doc = new PDFDoc(name);
+ ppdoc* doc = ppdoc_load(filename);
if (!doc) {
- delete name;
return -1;
}
- /* if the doc got created, it now owns name, so we mustn't delete it! */
-
- if (!doc->isOk()) {
- delete doc;
- return -1;
- }
+ int pages = ppdoc_page_count(doc);
- int pages = doc->getNumPages();
if (page_num > pages)
page_num = pages;
if (page_num < 0)
@@ -76,43 +72,74 @@ pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box)
if (page_num < 1)
page_num = 1;
- Page* page = doc->getCatalog()->getPage(page_num);
+ ppref* page = ppdoc_page(doc, page_num);
+ ppdict* pdict = page->object.dict;
+
+ pprect Rect;
+ pprect* r;
- const PDFRectangle* r;
switch (pdf_box) {
default:
case pdfbox_crop:
- r = page->getCropBox();
+ r = ppdict_get_box(pdict, "CropBox", &Rect);
break;
case pdfbox_media:
- r = page->getMediaBox();
+ r = ppdict_get_box(pdict, "MediaBox", &Rect);
break;
case pdfbox_bleed:
- r = page->getBleedBox();
+ r = ppdict_get_box(pdict, "BleedBox", &Rect);
break;
case pdfbox_trim:
- r = page->getTrimBox();
+ r = ppdict_get_box(pdict, "TrimBox", &Rect);
break;
case pdfbox_art:
- r = page->getArtBox();
+ r = ppdict_get_box(pdict, "ArtBox", &Rect);
break;
}
- int RotAngle = 0;
- RotAngle = (int)page->getRotate() % 360;
+/*
+ * In pplib, r can be NULL. If r == NULL, we try "CropBox",
+ * "MediaBox", "BleedBox", "TrimBox", "ArtBox" in this order.
+ */
+ if (!r) {
+ r = ppdict_get_box(pdict, "CropBox", &Rect);
+ }
+ if (!r) {
+ r = ppdict_get_box(pdict, "MediaBox", &Rect);
+ }
+ if (!r) {
+ r = ppdict_get_box(pdict, "BleedBox", &Rect);
+ }
+ if (!r) {
+ r = ppdict_get_box(pdict, "TrimBox", &Rect);
+ }
+ if (!r) {
+ r = ppdict_get_box(pdict, "ArtBox", &Rect);
+ }
+
+/*
+ * If r == NULL, return error.
+ */
+ if (!r) {
+ return -1;
+ }
+
+ ppint RotAngle = 0;
+ (void)ppdict_get_int(pdict, "Rotate", &RotAngle);
+ RotAngle = RotAngle % 360;
if (RotAngle < 0)
RotAngle += 360;
if (RotAngle == 90 || RotAngle == 270) {
- box->wd = 72.27 / 72 * fabs(r->y2 - r->y1);
- box->ht = 72.27 / 72 * fabs(r->x2 - r->x1);
+ box->wd = 72.27 / 72 * fabs(r->ry - r->ly);
+ box->ht = 72.27 / 72 * fabs(r->rx - r->lx);
} else {
- box->wd = 72.27 / 72 * fabs(r->x2 - r->x1);
- box->ht = 72.27 / 72 * fabs(r->y2 - r->y1);
+ box->wd = 72.27 / 72 * fabs(r->rx - r->lx);
+ box->ht = 72.27 / 72 * fabs(r->ry - r->ly);
}
- box->x = 72.27 / 72 * my_fmin(r->x1, r->x2);
- box->y = 72.27 / 72 * my_fmin(r->y1, r->y2);
+ box->x = 72.27 / 72 * my_fmin(r->lx, r->rx);
+ box->y = 72.27 / 72 * my_fmin(r->ly, r->ry);
- delete doc;
+ ppdoc_free(doc);
return 0;
}
@@ -120,21 +147,15 @@ pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box)
int
pdf_count_pages(char* filename)
{
- int pages = 0;
- GooString* name = new GooString(filename);
- PDFDoc* doc = new PDFDoc(name);
+ int pages = 0;
+ ppdoc* doc = ppdoc_load(filename);
if (!doc) {
- delete name;
return 0;
}
- /* if the doc got created, it now owns name, so we mustn't delete it! */
-
- if (doc->isOk())
- pages = doc->getNumPages();
-
- delete doc;
+ pages = ppdoc_page_count(doc);
+ if (doc) ppdoc_free(doc);
return pages;
}