Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into master_github
Browse files Browse the repository at this point in the history
  • Loading branch information
tsdgeos committed Jan 8, 2025
2 parents 367d000 + e3773a7 commit d593f49
Show file tree
Hide file tree
Showing 47 changed files with 441 additions and 478 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ if (ECM_FOUND)
endif()
endif()

set(POPPLER_MAJOR_VERSION "24")
set(POPPLER_MINOR_VERSION_STRING "12")
set(POPPLER_MAJOR_VERSION "25")
set(POPPLER_MINOR_VERSION_STRING "01")
# We want the string version to have 08 but the integer version can't have a leading 0 since otherwise it's considered octal
# So strip a leading 0 if found in POPPLER_MINOR_VERSION_STRING and store the result in POPPLER_MINOR_VERSION
string(REGEX REPLACE "^0?(.+)$" "\\1" POPPLER_MINOR_VERSION "${POPPLER_MINOR_VERSION_STRING}")
Expand Down Expand Up @@ -608,7 +608,7 @@ ADD_GPERF_FILE(TimesItalicWidths)
ADD_GPERF_FILE(TimesRomanWidths)
ADD_GPERF_FILE(ZapfDingbatsWidths)

set(POPPLER_SOVERSION_NUMBER "144")
set(POPPLER_SOVERSION_NUMBER "145")

set(LINKER_SCRIPT "${CMAKE_BINARY_DIR}/libpoppler.map")
configure_file(
Expand Down
25 changes: 25 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
Release 25.01.0:
core:
* TextOutputDev: Better detect fakebold words
* TextOutputDev: Faster sorting algorithm
* Internal code improvements
* Fix crashes in malformed documents

cpp:
* Remove rect parameter from image::copy, it was never implemented

qt6:
* Fix crash in Submit Forms if document links to non existing field

qt5:
* Fix crash in Submit Forms if document links to non existing field

glib:
* mark transfer of poppler_page_get_selected_region

utils:
* pdfdetach: Make -savefile work with Unicode strings. Issue #1540

build system:
* Don't update pdfsig.pot when POT-Creation-date is the only change

Release 24.12.0:
core:
* cairo: Fix rendering of JPX images with transparency
Expand Down
2 changes: 1 addition & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set(poppler_cpp_SRCS

add_library(poppler-cpp ${poppler_cpp_SRCS})
generate_export_header(poppler-cpp BASE_NAME poppler-cpp EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/poppler_cpp_export.h")
set_target_properties(poppler-cpp PROPERTIES VERSION 1.0.0 SOVERSION 1)
set_target_properties(poppler-cpp PROPERTIES VERSION 2.0.0 SOVERSION 2)
if(MINGW AND BUILD_SHARED_LIBS)
get_target_property(POPPLER_CPP_SOVERSION poppler-cpp SOVERSION)
set_target_properties(poppler-cpp PROPERTIES SUFFIX "-${POPPLER_CPP_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
Expand Down
2 changes: 1 addition & 1 deletion cpp/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PROJECT_NAME = "Poppler CPP"
# This could be handy for archiving the generated documentation or
# if some version control system is used.

PROJECT_NUMBER = 24.12.0
PROJECT_NUMBER = 25.01.0

# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
Expand Down
48 changes: 23 additions & 25 deletions fofi/FoFiTrueType.cc
Original file line number Diff line number Diff line change
Expand Up @@ -659,21 +659,19 @@ bool FoFiTrueType::getCFFBlock(char **start, int *length) const
return true;
}

int *FoFiTrueType::getCIDToGIDMap(int *nCIDs) const
std::vector<int> FoFiTrueType::getCIDToGIDMap() const
{
char *start;
int length;
FoFiType1C *ff;
int *map;

*nCIDs = 0;
if (!getCFFBlock(&start, &length)) {
return nullptr;
return {};
}
if (!(ff = FoFiType1C::make((unsigned char *)start, length))) {
return nullptr;
return {};
}
map = ff->getCIDToGIDMap(nCIDs);
std::vector<int> map = ff->getCIDToGIDMap();
delete ff;
return map;
}
Expand Down Expand Up @@ -719,7 +717,7 @@ void FoFiTrueType::getFontMatrix(double *mat) const
delete ff;
}

void FoFiTrueType::convertToType42(const char *psName, char **encoding, int *codeToGID, FoFiOutputFunc outputFunc, void *outputStream) const
void FoFiTrueType::convertToType42(const char *psName, char **encoding, const std::vector<int> &codeToGID, FoFiOutputFunc outputFunc, void *outputStream) const
{
int maxUsedGlyph;
bool ok;
Expand Down Expand Up @@ -769,7 +767,7 @@ void FoFiTrueType::convertToType1(const char *psName, const char **newEncoding,
delete ff;
}

void FoFiTrueType::convertToCIDType2(const char *psName, const int *cidMap, int nCIDs, bool needVerticalMetrics, FoFiOutputFunc outputFunc, void *outputStream) const
void FoFiTrueType::convertToCIDType2(const char *psName, const std::vector<int> &cidMap, bool needVerticalMetrics, FoFiOutputFunc outputFunc, void *outputStream) const
{
int cid, maxUsedGlyph;
bool ok;
Expand Down Expand Up @@ -797,16 +795,16 @@ void FoFiTrueType::convertToCIDType2(const char *psName, const int *cidMap, int
(*outputFunc)(outputStream, " /Supplement 0 def\n", 20);
(*outputFunc)(outputStream, " end def\n", 10);
(*outputFunc)(outputStream, "/GDBytes 2 def\n", 15);
if (cidMap) {
buf = GooString::format("/CIDCount {0:d} def\n", nCIDs);
if (!cidMap.empty()) {
buf = GooString::format("/CIDCount {0:d} def\n", int(cidMap.size()));
(*outputFunc)(outputStream, buf.c_str(), buf.size());
if (nCIDs > 32767) {
if (cidMap.size() > 32767) {
(*outputFunc)(outputStream, "/CIDMap [", 9);
for (i = 0; i < nCIDs; i += 32768 - 16) {
for (i = 0; i < int(cidMap.size()); i += 32768 - 16) {
(*outputFunc)(outputStream, "<\n", 2);
for (j = 0; j < 32768 - 16 && i + j < nCIDs; j += 16) {
for (j = 0; j < 32768 - 16 && i + j < int(cidMap.size()); j += 16) {
(*outputFunc)(outputStream, " ", 2);
for (k = 0; k < 16 && i + j + k < nCIDs; ++k) {
for (k = 0; k < 16 && i + j + k < int(cidMap.size()); ++k) {
cid = cidMap[i + j + k];
buf = GooString::format("{0:02x}{1:02x}", (cid >> 8) & 0xff, cid & 0xff);
(*outputFunc)(outputStream, buf.c_str(), buf.size());
Expand All @@ -819,9 +817,9 @@ void FoFiTrueType::convertToCIDType2(const char *psName, const int *cidMap, int
(*outputFunc)(outputStream, "] def\n", 6);
} else {
(*outputFunc)(outputStream, "/CIDMap <\n", 10);
for (i = 0; i < nCIDs; i += 16) {
for (i = 0; i < int(cidMap.size()); i += 16) {
(*outputFunc)(outputStream, " ", 2);
for (j = 0; j < 16 && i + j < nCIDs; ++j) {
for (j = 0; j < 16 && i + j < int(cidMap.size()); ++j) {
cid = cidMap[i + j];
buf = GooString::format("{0:02x}{1:02x}", (cid >> 8) & 0xff, cid & 0xff);
(*outputFunc)(outputStream, buf.c_str(), buf.size());
Expand Down Expand Up @@ -876,7 +874,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName, const int *cidMap, int
(*outputFunc)(outputStream, "CIDFontName currentdict end /CIDFont defineresource pop\n", 56);
}

void FoFiTrueType::convertToCIDType0(const char *psName, int *cidMap, int nCIDs, FoFiOutputFunc outputFunc, void *outputStream) const
void FoFiTrueType::convertToCIDType0(const char *psName, const std::vector<int> &cidMap, FoFiOutputFunc outputFunc, void *outputStream) const
{
char *start;
int length;
Expand All @@ -888,11 +886,11 @@ void FoFiTrueType::convertToCIDType0(const char *psName, int *cidMap, int nCIDs,
if (!(ff = FoFiType1C::make((unsigned char *)start, length))) {
return;
}
ff->convertToCIDType0(psName, cidMap, nCIDs, outputFunc, outputStream);
ff->convertToCIDType0(psName, cidMap, outputFunc, outputStream);
delete ff;
}

void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, bool needVerticalMetrics, int *maxValidGlyph, FoFiOutputFunc outputFunc, void *outputStream) const
void FoFiTrueType::convertToType0(const char *psName, const std::vector<int> &cidMap, bool needVerticalMetrics, int *maxValidGlyph, FoFiOutputFunc outputFunc, void *outputStream) const
{
GooString *sfntsName;
int maxUsedGlyph, n, i, j;
Expand Down Expand Up @@ -926,8 +924,8 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, bo
// 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;
if (!cidMap.empty()) {
n = cidMap.size();
} else if (nGlyphs > maxUsedGlyph + 256) {
if (maxUsedGlyph <= 255) {
n = 256;
Expand Down Expand Up @@ -961,7 +959,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, bo
(*outputFunc)(outputStream, "/CharStrings 257 dict dup begin\n", 32);
(*outputFunc)(outputStream, "/.notdef 0 def\n", 15);
for (j = 0; j < 256 && i + j < n; ++j) {
buf = GooString::format("/c{0:02x} {1:d} def\n", j, cidMap ? cidMap[i + j] : i + j);
buf = GooString::format("/c{0:02x} {1:d} def\n", j, !cidMap.empty() ? cidMap[i + j] : i + j);
(*outputFunc)(outputStream, buf.c_str(), buf.size());
}
(*outputFunc)(outputStream, "end readonly def\n", 17);
Expand Down Expand Up @@ -993,7 +991,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, bo
(*outputFunc)(outputStream, "FontName currentdict end definefont pop\n", 40);
}

void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, FoFiOutputFunc outputFunc, void *outputStream) const
void FoFiTrueType::convertToType0(const char *psName, const std::vector<int> &cidMap, FoFiOutputFunc outputFunc, void *outputStream) const
{
char *start;
int length;
Expand All @@ -1005,7 +1003,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, Fo
if (!(ff = FoFiType1C::make((unsigned char *)start, length))) {
return;
}
ff->convertToType0(psName, cidMap, nCIDs, outputFunc, outputStream);
ff->convertToType0(psName, cidMap, outputFunc, outputStream);
delete ff;
}

Expand Down Expand Up @@ -1034,7 +1032,7 @@ void FoFiTrueType::cvtEncoding(char **encoding, FoFiOutputFunc outputFunc, void
(*outputFunc)(outputStream, "readonly def\n", 13);
}

void FoFiTrueType::cvtCharStrings(char **encoding, const int *codeToGID, FoFiOutputFunc outputFunc, void *outputStream) const
void FoFiTrueType::cvtCharStrings(char **encoding, const std::vector<int> &codeToGID, FoFiOutputFunc outputFunc, void *outputStream) const
{
const char *name;
char buf2[16];
Expand Down
18 changes: 9 additions & 9 deletions fofi/FoFiTrueType.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ class POPPLER_PRIVATE_EXPORT FoFiTrueType : public FoFiBase
// font does not have a post table.
int mapNameToGID(const char *name) const;

// Return the mapping from CIDs to GIDs, and return the number of
// CIDs in *<nCIDs>. This is only useful for CID fonts. (Only
// Return the mapping from CIDs to GIDs
// This is only useful for CID fonts. (Only
// useful for OpenType CFF fonts.)
int *getCIDToGIDMap(int *nCIDs) const;
std::vector<int> getCIDToGIDMap() const;

// Returns the least restrictive embedding licensing right (as
// defined by the TrueType spec):
Expand All @@ -112,7 +112,7 @@ class POPPLER_PRIVATE_EXPORT FoFiTrueType : public FoFiBase
// If <encoding> is NULL, the encoding is unknown or undefined. The
// <codeToGID> array specifies the mapping from char codes to GIDs.
// (Not useful for OpenType CFF fonts.)
void convertToType42(const char *psName, char **encoding, int *codeToGID, FoFiOutputFunc outputFunc, void *outputStream) const;
void convertToType42(const char *psName, char **encoding, const std::vector<int> &codeToGID, FoFiOutputFunc outputFunc, void *outputStream) const;

// Convert to a Type 1 font, suitable for embedding in a PostScript
// file. This is only useful with 8-bit fonts. If <newEncoding> is
Expand All @@ -128,24 +128,24 @@ class POPPLER_PRIVATE_EXPORT FoFiTrueType : public FoFiBase
// name (so we don't need to depend on the 'name' table in the
// font). The <cidMap> array maps CIDs to GIDs; it has <nCIDs>
// entries. (Not useful for OpenType CFF fonts.)
void convertToCIDType2(const char *psName, const int *cidMap, int nCIDs, bool needVerticalMetrics, FoFiOutputFunc outputFunc, void *outputStream) const;
void convertToCIDType2(const char *psName, const std::vector<int> &cidMap, bool needVerticalMetrics, FoFiOutputFunc outputFunc, void *outputStream) const;

// Convert to a Type 0 CIDFont, suitable for embedding in a
// PostScript file. <psName> will be used as the PostScript font
// name. (Only useful for OpenType CFF fonts.)
void convertToCIDType0(const char *psName, int *cidMap, int nCIDs, FoFiOutputFunc outputFunc, void *outputStream) const;
void convertToCIDType0(const char *psName, const std::vector<int> &cidMap, FoFiOutputFunc outputFunc, void *outputStream) const;

// Convert to a Type 0 (but non-CID) composite font, suitable for
// embedding in a PostScript file. <psName> will be used as the
// PostScript font name (so we don't need to depend on the 'name'
// table in the font). The <cidMap> array maps CIDs to GIDs; it has
// <nCIDs> entries. (Not useful for OpenType CFF fonts.)
void convertToType0(const char *psName, int *cidMap, int nCIDs, bool needVerticalMetrics, int *maxValidGlyph, FoFiOutputFunc outputFunc, void *outputStream) const;
void convertToType0(const char *psName, const std::vector<int> &cidMap, bool needVerticalMetrics, int *maxValidGlyph, FoFiOutputFunc outputFunc, void *outputStream) const;

// Convert to a Type 0 (but non-CID) composite font, suitable for
// embedding in a PostScript file. <psName> will be used as the
// PostScript font name. (Only useful for OpenType CFF fonts.)
void convertToType0(const char *psName, int *cidMap, int nCIDs, FoFiOutputFunc outputFunc, void *outputStream) const;
void convertToType0(const char *psName, const std::vector<int> &cidMap, FoFiOutputFunc outputFunc, void *outputStream) const;

// Returns a pointer to the CFF font embedded in this OpenType font.
// If successful, sets *<start> and *<length>, and returns true.
Expand All @@ -161,7 +161,7 @@ class POPPLER_PRIVATE_EXPORT FoFiTrueType : public FoFiBase
private:
FoFiTrueType(const unsigned char *fileA, int lenA, bool freeFileDataA, int faceIndexA);
void cvtEncoding(char **encoding, FoFiOutputFunc outputFunc, void *outputStream) const;
void cvtCharStrings(char **encoding, const int *codeToGID, FoFiOutputFunc outputFunc, void *outputStream) const;
void cvtCharStrings(char **encoding, const std::vector<int> &codeToGID, FoFiOutputFunc outputFunc, void *outputStream) const;
void cvtSfnts(FoFiOutputFunc outputFunc, void *outputStream, const GooString *name, bool needVerticalMetrics, int *maxUsedGlyph) const;
static void dumpString(std::span<const unsigned char> s, FoFiOutputFunc outputFunc, void *outputStream);
static unsigned int computeTableChecksum(std::span<const unsigned char> data);
Expand Down
Loading

0 comments on commit d593f49

Please sign in to comment.