summaryrefslogtreecommitdiff
path: root/Build/source/libs/poppler/poppler-src/fofi
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-12-16 00:40:18 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-12-16 00:40:18 +0000
commit66588e866978865e82a41a9bd478c94b2c41e878 (patch)
tree9cc70886e2c3a0aeaaebc609fb07f3d1a0a3ab9f /Build/source/libs/poppler/poppler-src/fofi
parent31cffd17fa4aba6ac69c867431506fff900eaf10 (diff)
poppler 0.50.0
git-svn-id: svn://tug.org/texlive/trunk@42718 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/poppler/poppler-src/fofi')
-rw-r--r--Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.cc18
-rw-r--r--Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.h18
-rw-r--r--Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc13
-rw-r--r--Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.h2
4 files changed, 46 insertions, 5 deletions
diff --git a/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.cc b/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.cc
index 5cea6fab7f1..9fad1ebae83 100644
--- a/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.cc
+++ b/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.cc
@@ -6,6 +6,20 @@
//
//========================================================================
+//========================================================================
+//
+// Modified under the Poppler project - http://poppler.freedesktop.org
+//
+// All changes made under the Poppler project to this file are licensed
+// under GPL version 2 or later
+//
+// Copyright (C) 2016 Albert Astals Cid <aacid@kde.org>
+//
+// To see a description of the changes please see the Changelog file that
+// came with your tarball or type make ChangeLog if you are building from git
+//
+//========================================================================
+
#include <config.h>
#ifdef USE_GCC_PRAGMAS
@@ -19,7 +33,7 @@
// Type 1 and 1C font data
//------------------------------------------------------------------------
-const char *fofiType1StandardEncoding[256] = {
+const char * const fofiType1StandardEncoding[256] = {
NULL,
NULL,
NULL,
@@ -278,7 +292,7 @@ const char *fofiType1StandardEncoding[256] = {
NULL
};
-const char *fofiType1ExpertEncoding[256] = {
+const char * const fofiType1ExpertEncoding[256] = {
NULL,
NULL,
NULL,
diff --git a/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.h b/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.h
index ab80ad362a6..e7444906346 100644
--- a/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.h
+++ b/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.h
@@ -6,6 +6,20 @@
//
//========================================================================
+//========================================================================
+//
+// Modified under the Poppler project - http://poppler.freedesktop.org
+//
+// All changes made under the Poppler project to this file are licensed
+// under GPL version 2 or later
+//
+// Copyright (C) 2016 Albert Astals Cid <aacid@kde.org>
+//
+// To see a description of the changes please see the Changelog file that
+// came with your tarball or type make ChangeLog if you are building from git
+//
+//========================================================================
+
#ifndef FOFIENCODINGS_H
#define FOFIENCODINGS_H
@@ -19,8 +33,8 @@
// Type 1 and 1C font data
//------------------------------------------------------------------------
-extern const char *fofiType1StandardEncoding[256];
-extern const char *fofiType1ExpertEncoding[256];
+extern const char * const fofiType1StandardEncoding[256];
+extern const char * const fofiType1ExpertEncoding[256];
//------------------------------------------------------------------------
// Type 1C font data
diff --git a/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc b/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc
index 49058264bab..f1a15e004da 100644
--- a/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc
+++ b/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc
@@ -22,7 +22,7 @@
// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2014 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2015 Aleksei Volkov <Aleksei Volkov>
-// Copyright (C) 2015 William Bader <williambader@hotmail.com>
+// Copyright (C) 2015, 2016 William Bader <williambader@hotmail.com>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -727,12 +727,15 @@ void FoFiTrueType::convertToCIDType0(char *psName, int *cidMap, int nCIDs,
void FoFiTrueType::convertToType0(char *psName, int *cidMap, int nCIDs,
GBool needVerticalMetrics,
+ int *maxValidGlyph,
FoFiOutputFunc outputFunc,
void *outputStream) {
GooString *buf;
GooString *sfntsName;
int maxUsedGlyph, n, i, j;
+ *maxValidGlyph = -1;
+
if (openTypeCFF) {
return;
}
@@ -754,6 +757,13 @@ void FoFiTrueType::convertToType0(char *psName, int *cidMap, int nCIDs,
// that refers to one of the unused glyphs -- this results in PS
// errors if we simply use maxUsedGlyph+1 for the Type 0 font. So
// we compromise by always defining at least 256 glyphs.)
+ // Some fonts have a large nGlyphs but maxUsedGlyph of 0.
+ // These fonts might reference any glyph.
+ // Return the last written glyph number in maxValidGlyph.
+ // PSOutputDev::drawString() can use maxValidGlyph to avoid
+ // referencing zero-length glyphs that we trimmed.
+ // This allows pdftops to avoid writing huge files while still
+ // handling the rare PDF that uses a zero-length glyph.
if (cidMap) {
n = nCIDs;
} else if (nGlyphs > maxUsedGlyph + 256) {
@@ -765,6 +775,7 @@ void FoFiTrueType::convertToType0(char *psName, int *cidMap, int nCIDs,
} else {
n = nGlyphs;
}
+ *maxValidGlyph = n-1;
for (i = 0; i < n; i += 256) {
(*outputFunc)(outputStream, "10 dict begin\n", 14);
(*outputFunc)(outputStream, "/FontName /", 11);
diff --git a/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.h b/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.h
index b40a44a8d70..a4e28f27a4c 100644
--- a/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.h
+++ b/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.h
@@ -17,6 +17,7 @@
// Copyright (C) 2007 Koji Otani <sho@bbr.jp>
// Copyright (C) 2011, 2012 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2012 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
+// Copyright (C) 2016 William Bader <williambader@hotmail.com>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -144,6 +145,7 @@ public:
// <nCIDs> entries. (Not useful for OpenType CFF fonts.)
void convertToType0(char *psName, int *cidMap, int nCIDs,
GBool needVerticalMetrics,
+ int *maxValidGlyph,
FoFiOutputFunc outputFunc, void *outputStream);
// Convert to a Type 0 (but non-CID) composite font, suitable for