[poppler] 2 commits - poppler/PSOutputDev.cc poppler/PSOutputDev.h qt5/tests
Albert Astals Cid
aacid at kemper.freedesktop.org
Wed Sep 20 17:37:57 UTC 2017
poppler/PSOutputDev.cc | 16 ++++++++++------
poppler/PSOutputDev.h | 1 +
qt5/tests/check_actualtext.cpp | 2 +-
qt5/tests/check_attachments.cpp | 2 +-
qt5/tests/check_dateConversion.cpp | 2 +-
qt5/tests/check_fonts.cpp | 2 +-
qt5/tests/check_goostring.cpp | 2 +-
qt5/tests/check_lexer.cpp | 2 +-
qt5/tests/check_links.cpp | 2 +-
qt5/tests/check_metadata.cpp | 2 +-
qt5/tests/check_optcontent.cpp | 2 +-
qt5/tests/check_pagelabelinfo.cpp | 2 +-
qt5/tests/check_pagelayout.cpp | 2 +-
qt5/tests/check_pagemode.cpp | 2 +-
qt5/tests/check_password.cpp | 2 +-
qt5/tests/check_permissions.cpp | 2 +-
qt5/tests/check_search.cpp | 2 +-
qt5/tests/check_strings.cpp | 2 +-
18 files changed, 27 insertions(+), 22 deletions(-)
New commits:
commit e51db61a33cdbe6307f048b65912a85f6cd1ec5b
Author: William Bader <william at newspapersystems.com>
Date: Wed Sep 20 19:36:46 2017 +0200
PSOutputDev: Fix wrong text generation
This patch moves the code to update the max valid glyph hash into its
own function and updates the max valid glyph only if the new value is
higher than the previous value.
This fixes a problem with pages that have multiple copies of the same
font with different glyph counts. If poppler processed the font with the
smaller count last, and then the PDF wrote text in the font with the
larger count, pdftops would not show the glyphs above the maximum of the
smaller font.
Bug #102760
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index b2d6d3a9..17f31b37 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -2544,6 +2544,14 @@ void PSOutputDev::setupExternalTrueTypeFont(GfxFont *font, GooString *fileName,
writePS("%%EndResource\n");
}
+void PSOutputDev::updateFontMaxValidGlyph(GfxFont *font, int maxValidGlyph) {
+ if (maxValidGlyph >= 0 && font->getName()) {
+ if (maxValidGlyph > fontMaxValidGlyph->lookupInt(font->getName())) {
+ fontMaxValidGlyph->replace(font->getName()->copy(), maxValidGlyph);
+ }
+ }
+}
+
void PSOutputDev::setupExternalCIDTrueTypeFont(GfxFont *font,
GooString *fileName,
GooString *psName,
@@ -2594,9 +2602,7 @@ void PSOutputDev::setupExternalCIDTrueTypeFont(GfxFont *font,
needVerticalMetrics,
&maxValidGlyph,
outputFunc, outputStream);
- if (maxValidGlyph >= 0 && font->getName()) {
- fontMaxValidGlyph->replace(font->getName()->copy(), maxValidGlyph);
- }
+ updateFontMaxValidGlyph(font, maxValidGlyph);
}
gfree(codeToGID);
} else {
@@ -2696,9 +2702,7 @@ void PSOutputDev::setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id,
needVerticalMetrics,
&maxValidGlyph,
outputFunc, outputStream);
- if (maxValidGlyph > 0 && font->getName()) {
- fontMaxValidGlyph->replace(font->getName()->copy(), maxValidGlyph);
- }
+ updateFontMaxValidGlyph(font, maxValidGlyph);
}
delete ffTT;
}
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 833f686e..2d92b81b 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -355,6 +355,7 @@ private:
void setupFonts(Dict *resDict);
void setupFont(GfxFont *font, Dict *parentResDict);
void setupEmbeddedType1Font(Ref *id, GooString *psName);
+ void updateFontMaxValidGlyph(GfxFont *font, int maxValidGlyph);
void setupExternalType1Font(GooString *fileName, GooString *psName);
void setupEmbeddedType1CFont(GfxFont *font, Ref *id, GooString *psName);
void setupEmbeddedOpenTypeT1CFont(GfxFont *font, Ref *id, GooString *psName);
commit 6665839b5ce2e4f6fb2acc682ce2f91ed2404ce8
Author: Albert Astals Cid <aacid at kde.org>
Date: Wed Sep 20 19:36:29 2017 +0200
qt5: The tests don't need GUI
diff --git a/qt5/tests/check_actualtext.cpp b/qt5/tests/check_actualtext.cpp
index a7bbcce6..eec0e092 100644
--- a/qt5/tests/check_actualtext.cpp
+++ b/qt5/tests/check_actualtext.cpp
@@ -27,7 +27,7 @@ void TestActualText::checkActualText1()
delete doc;
}
-QTEST_MAIN(TestActualText)
+QTEST_GUILESS_MAIN(TestActualText)
#include "check_actualtext.moc"
diff --git a/qt5/tests/check_attachments.cpp b/qt5/tests/check_attachments.cpp
index d780919a..c1c9036c 100644
--- a/qt5/tests/check_attachments.cpp
+++ b/qt5/tests/check_attachments.cpp
@@ -152,6 +152,6 @@ void TestAttachments::checkAttach4()
}
-QTEST_MAIN(TestAttachments)
+QTEST_GUILESS_MAIN(TestAttachments)
#include "check_attachments.moc"
diff --git a/qt5/tests/check_dateConversion.cpp b/qt5/tests/check_dateConversion.cpp
index b1cb8e01..e336f394 100644
--- a/qt5/tests/check_dateConversion.cpp
+++ b/qt5/tests/check_dateConversion.cpp
@@ -137,6 +137,6 @@ void TestDateConv::checkInvalidDates()
QCOMPARE(Poppler::convertDate(input.data()), QDateTime());
}
-QTEST_MAIN(TestDateConv)
+QTEST_GUILESS_MAIN(TestDateConv)
#include "check_dateConversion.moc"
diff --git a/qt5/tests/check_fonts.cpp b/qt5/tests/check_fonts.cpp
index ad4b0b88..38fbfe9d 100644
--- a/qt5/tests/check_fonts.cpp
+++ b/qt5/tests/check_fonts.cpp
@@ -232,6 +232,6 @@ void TestFontsData::checkIteratorFonts()
delete doc;
}
-QTEST_MAIN(TestFontsData)
+QTEST_GUILESS_MAIN(TestFontsData)
#include "check_fonts.moc"
diff --git a/qt5/tests/check_goostring.cpp b/qt5/tests/check_goostring.cpp
index 69f7cdc5..ac75e289 100644
--- a/qt5/tests/check_goostring.cpp
+++ b/qt5/tests/check_goostring.cpp
@@ -122,6 +122,6 @@ void TestGooString::testFormat()
}
}
-QTEST_MAIN(TestGooString)
+QTEST_GUILESS_MAIN(TestGooString)
#include "check_goostring.moc"
diff --git a/qt5/tests/check_lexer.cpp b/qt5/tests/check_lexer.cpp
index 4453e90f..6964d411 100644
--- a/qt5/tests/check_lexer.cpp
+++ b/qt5/tests/check_lexer.cpp
@@ -102,6 +102,6 @@ void TestLexer::testNumbers()
delete lexer;
}
-QTEST_MAIN(TestLexer)
+QTEST_GUILESS_MAIN(TestLexer)
#include "check_lexer.moc"
diff --git a/qt5/tests/check_links.cpp b/qt5/tests/check_links.cpp
index 79c38579..6073027d 100644
--- a/qt5/tests/check_links.cpp
+++ b/qt5/tests/check_links.cpp
@@ -93,6 +93,6 @@ void TestLinks::checkDests_xr02()
delete doc;
}
-QTEST_MAIN(TestLinks)
+QTEST_GUILESS_MAIN(TestLinks)
#include "check_links.moc"
diff --git a/qt5/tests/check_metadata.cpp b/qt5/tests/check_metadata.cpp
index 05abbaf4..40481c96 100644
--- a/qt5/tests/check_metadata.cpp
+++ b/qt5/tests/check_metadata.cpp
@@ -269,6 +269,6 @@ void TestMetaData::checkNoPdfId()
delete doc;
}
-QTEST_MAIN(TestMetaData)
+QTEST_GUILESS_MAIN(TestMetaData)
#include "check_metadata.moc"
diff --git a/qt5/tests/check_optcontent.cpp b/qt5/tests/check_optcontent.cpp
index 32af227e..5588503a 100644
--- a/qt5/tests/check_optcontent.cpp
+++ b/qt5/tests/check_optcontent.cpp
@@ -440,7 +440,7 @@ void TestOptionalContent::checkRadioButtons()
delete doc;
}
-QTEST_MAIN(TestOptionalContent)
+QTEST_GUILESS_MAIN(TestOptionalContent)
#include "check_optcontent.moc"
diff --git a/qt5/tests/check_pagelabelinfo.cpp b/qt5/tests/check_pagelabelinfo.cpp
index 4eb1ec36..a428e059 100644
--- a/qt5/tests/check_pagelabelinfo.cpp
+++ b/qt5/tests/check_pagelabelinfo.cpp
@@ -38,6 +38,6 @@ void TestPageLabelInfo::testFromLatin()
QCOMPARE(fromLatin(latin.getCString()), 56);
}
-QTEST_MAIN(TestPageLabelInfo)
+QTEST_GUILESS_MAIN(TestPageLabelInfo)
#include "check_pagelabelinfo.moc"
diff --git a/qt5/tests/check_pagelayout.cpp b/qt5/tests/check_pagelayout.cpp
index 5f918395..f9d58fa6 100644
--- a/qt5/tests/check_pagelayout.cpp
+++ b/qt5/tests/check_pagelayout.cpp
@@ -44,6 +44,6 @@ void TestPageLayout::checkFacing()
delete doc;
}
-QTEST_MAIN(TestPageLayout)
+QTEST_GUILESS_MAIN(TestPageLayout)
#include "check_pagelayout.moc"
diff --git a/qt5/tests/check_pagemode.cpp b/qt5/tests/check_pagemode.cpp
index 66f8ea47..9aa17a00 100644
--- a/qt5/tests/check_pagemode.cpp
+++ b/qt5/tests/check_pagemode.cpp
@@ -68,6 +68,6 @@ void TestPageMode::checkOC()
delete doc;
}
-QTEST_MAIN(TestPageMode)
+QTEST_GUILESS_MAIN(TestPageMode)
#include "check_pagemode.moc"
diff --git a/qt5/tests/check_password.cpp b/qt5/tests/check_password.cpp
index 7f071a13..262003fa 100644
--- a/qt5/tests/check_password.cpp
+++ b/qt5/tests/check_password.cpp
@@ -83,6 +83,6 @@ void TestPassword::password3()
delete doc;
}
-QTEST_MAIN(TestPassword)
+QTEST_GUILESS_MAIN(TestPassword)
#include "check_password.moc"
diff --git a/qt5/tests/check_permissions.cpp b/qt5/tests/check_permissions.cpp
index f90e2bc8..e63d844e 100644
--- a/qt5/tests/check_permissions.cpp
+++ b/qt5/tests/check_permissions.cpp
@@ -39,6 +39,6 @@ void TestPermissions::permissions1()
delete doc;
}
-QTEST_MAIN(TestPermissions)
+QTEST_GUILESS_MAIN(TestPermissions)
#include "check_permissions.moc"
diff --git a/qt5/tests/check_search.cpp b/qt5/tests/check_search.cpp
index a24cc72b..cb503e98 100644
--- a/qt5/tests/check_search.cpp
+++ b/qt5/tests/check_search.cpp
@@ -169,6 +169,6 @@ void TestSearch::testWholeWordsOnly()
QCOMPARE( page->search(QLatin1String("Own"), left, top, right, bottom, direction, mode3), false );
}
-QTEST_MAIN(TestSearch)
+QTEST_GUILESS_MAIN(TestSearch)
#include "check_search.moc"
diff --git a/qt5/tests/check_strings.cpp b/qt5/tests/check_strings.cpp
index 46556699..fc68146a 100644
--- a/qt5/tests/check_strings.cpp
+++ b/qt5/tests/check_strings.cpp
@@ -245,6 +245,6 @@ GooString* TestStrings::newGooString(const char *s, int l)
return goo;
}
-QTEST_MAIN(TestStrings)
+QTEST_GUILESS_MAIN(TestStrings)
#include "check_strings.moc"
More information about the poppler
mailing list