Skip to content

Commit f5b3c77

Browse files
committed
[RELEASE] iText 7 Core - 7.1.13
https://github.com/itext/itext7/releases/tag/7.1.13 * release_branch: [RELEASE] 7.1.13 Verify TODO references, add TextWritingTest#leadingAndFloatInTextTest Add support of background-clip and background-origin OTF: Support GposLookupType7 format (subtable format 2) OTF: Support GposLookupType1 format Remove ToDo remark If one glyph is substituted to many glyphs, actual text should be distributed Add outlines with invalid parent links test Add missing copyright headers Add ClipperBridgeTest Improve float arithmetic isIdentityMatrix method Add missing copyright headers OpenType: Fix skipping glyphs for mark attachment type-specific lookup flags Add test on bug in wordWasSplitAndItWillFitOntoNextLine Implement supporting background-repeat CSS property Add background size support Add integration tests for missing form fields border styles Remove useless TODO If anchor delta is not zero, follow special xPlacement logic even if it's 0 Improve processing of marks in GposLookupType4 Add test to be sure that PdfXFormObject and PdfImageObject work correctly Add setter for background-image and List of background-images Create unit tests for annot.PdfTarget class Refactor kernel/colors/Color hashCode() method Improve coverage for kernel/colors/Color Add SVG symbol processing by adding SymbolSvgNodeRenderer Fix PdfSignatureBuildProperties and PdfSigner javadoc warnings Add missing copyright headers Improve coverage for kernel/font/PdfType0Font Add missing copyright headers Add PdfReaderCustomFilterTest#encryptedDocumentCustomFilterStandartTest Add missing copyright headers Add PdfSimpleFontTest Add missing copyright headers Implementation to support background-position Background blend mode implementation Support myanmar word wrapping. Minor refactoring Drop revapi plugin in favor of japicmp plugin Improve coverage for kernel/utils/PageRange Make actual text's size correspond to the number of glyphs Fix adding PdfFormXObject to canvas through PdfCanvas Add missing copyright headers Override PdfTrueTypeFont#isBuiltInont Fix reading /TrueType fonts with the underlying standard base font from PDFs Add tests for the incorrect placement within container Add test for converting page number to page indRef in /Dest of outlines Create unit-tests for several classes in signatures module Add description for params in javadoc Add tests of dSafer flag for ghostScript Add PointTest Improve coverage for some com/itextpdf/kernel/pdf/annot classes Fix some JavaDocs in com\itextpdf\signatures package Remove unused fields Add a test on wrapping a choice field option into several lines Improve coverage for some com/itextpdf/kernel/pdf/canvas/parser/clipper classes Support advanced OCG copying Support basic copying OCGs present in content streams of pages Extract SvgCssUtils#isStyleSheetLink into SXP and deprecate the old method Make test classes extend ExtendedITextTest Add missing copyright headers Added support of multiple backgrounds Fix javadoc warnings Add new tests for specific float and indent scenario Add missing copyright headers Add TextRendererIntegrationTest#trimFirstJapaneseCharactersTest Add missing copyright headers Improve CssPseudoElementUtil and CssPseudoElementNode coverage Add missing copyright headers Add Armenian-, Georgian- and RomanNumberingTest Removed duplicated test Fix average glyph bbox calculation for Type3 fonts Add tests for BarcodePDF417 Improve several kernel/crypto and kernel/events JavaDocs Cover BarcodeEAN with tests Add particular test cases for svg tag symbol Add tests for PdfAction Refactor duplicated code Improve com/itextpdf/kernel/geom/AffineTransform.java and LineSegement.java coverage Improve several JavaDocs in kernel module Add missing copyright headers Fixed bug when BMC operator was replaced with empty BDC. Add javadoc to describe the usage of MemoryLimitsAwareHandler Add test for absolute value for tabPosition Add unit tests for resource resolver PdfDictionaryTest updates Wrap words properly with preceding Image or inlineBlock XMP parsing XXE vulnerability fix Fix javadocs of io/image Fix LimitedInputStream reading methods and add new unit tests Improve memory limits aware handler Add missing copyright headers PdfA validation fixes Add missing copyright headers Added validator for default font css attributes Add missing copyright headers MSI barcode width formula was changed Fix javadocs BezierCurve test Add missing copyright headers Memory limits aware handlers refactoring Add new SimpleImageCacheTest#removingOrderFromCacheTest Add missing copyright headers Add test coverage for PdfWin and PdfActionOcgStateTest Add missing copyright headers Fixed bug when messages may be not equal if special characters present in the message Add missing copyright headers Add svg symbol tests Update ResourceResolverTest and add resource byte limit argument check Support for custom ResourceResolver Add javadocs Added try-catch block in parseAndProcess method to process possible exceptions in parsing InputStream Add missing copyright headers Support analogue of css object-fit property Change background image width and height calculation Fix javadoc Fix javadoc warnings Provide tests for get methods of RAFRandomAccessSource Use generalized Jenkinsfile in the pipeline-library Upgrade javadoc for collections package Fix javadoc warnings Fix several io module javadoc warnings Refactor createXfdfAnnotaion Add missing copyright headers Create filters for DCT and JPX decodes [RELEASE] Update dependency versions Update javadocs for TabStop class Inherit documentation with inheritDoc annotations rather than non-Javadoc comments Add test for smart mode copying of link annotations with goto actions Refactor PdfCanvasColorTest class according to code style Remove TODO from Color class and add makePatternColorTest Move pageCopyAsFormXObjectWithInheritedResourcesTest form samples internal Remove redundant comment Fix try-with-resources statement for autoporting Fix for loig cof counting of indirect objects Change logic of indirect objects counting Fixes per codereview. Add check for amount of indirect objects Update javadoc after forbidding @value tag Add missing copyright headers Add XfdfWriterUnitTest class, update ToDo remarks in XfdfWriterTest class Add ticket references to TODOs Remove a TODO comment from ActualTextIterator Add new TableTest#inheritHeaderPropsWhileMinMaxWidthCalculationsTest
2 parents bdddc61 + 6ec3dbc commit f5b3c77

File tree

631 files changed

+27328
-3225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

631 files changed

+27328
-3225
lines changed

Jenkinsfile

Lines changed: 3 additions & 203 deletions
Original file line numberDiff line numberDiff line change
@@ -1,207 +1,7 @@
11
#!/usr/bin/env groovy
22
@Library('pipeline-library')_
33

4-
def vars = setBranchDependentVars(env.BRANCH_NAME)
4+
def repoName = "itextcore"
5+
def dependencyRegex = ""
56

6-
pipeline {
7-
8-
agent any
9-
10-
environment {
11-
JDK_VERSION = 'jdk-8-oracle'
12-
}
13-
14-
options {
15-
ansiColor('xterm')
16-
buildDiscarder(
17-
logRotator(
18-
numToKeepStr: vars.buildNumToKeep,
19-
artifactNumToKeepStr: vars.buildArtifactNumToKeep,
20-
daysToKeepStr: vars.buildDaysToKeep,
21-
artifactDaysToKeepStr: vars.buildArtifactDaysToKeep
22-
)
23-
)
24-
parallelsAlwaysFailFast()
25-
skipStagesAfterUnstable()
26-
timeout(time: 2, unit: 'HOURS')
27-
timestamps()
28-
}
29-
30-
triggers {
31-
cron(vars.schedule)
32-
}
33-
34-
tools {
35-
maven 'M3'
36-
jdk "${JDK_VERSION}"
37-
}
38-
39-
stages {
40-
stage('Abort possible previous builds') {
41-
steps {
42-
script {
43-
abortPreviousBuilds()
44-
}
45-
}
46-
}
47-
stage('Build') {
48-
options {
49-
retry(2)
50-
}
51-
stages {
52-
stage('Clean workspace') {
53-
options {
54-
timeout(time: 5, unit: 'MINUTES')
55-
}
56-
steps {
57-
withMaven(jdk: "${JDK_VERSION}", maven: 'M3', mavenLocalRepo: '.repository') {
58-
sh 'mvn --threads 2C --no-transfer-progress clean dependency:purge-local-repository -Dinclude=com.itextpdf -DresolutionFuzziness=groupId -DreResolve=false'
59-
}
60-
}
61-
}
62-
stage('Compile') {
63-
options {
64-
timeout(time: 10, unit: 'MINUTES')
65-
}
66-
steps {
67-
withMaven(jdk: "${JDK_VERSION}", maven: 'M3', mavenLocalRepo: '.repository') {
68-
sh 'mvn --threads 2C --no-transfer-progress package -Dmaven.test.skip=true'
69-
}
70-
}
71-
}
72-
}
73-
post {
74-
failure {
75-
sleep time: 2, unit: 'MINUTES'
76-
}
77-
success {
78-
script { currentBuild.result = 'SUCCESS' }
79-
}
80-
}
81-
}
82-
stage('Static Code Analysis') {
83-
options {
84-
timeout(time: 1, unit: 'HOURS')
85-
}
86-
steps {
87-
withMaven(jdk: "${JDK_VERSION}", maven: 'M3', mavenLocalRepo: '.repository') {
88-
sh 'mvn --no-transfer-progress verify --activate-profiles qa -Dpmd.analysisCache=true'
89-
}
90-
dependencyCheckPublisher pattern: 'target/dependency-check-report.xml'
91-
}
92-
}
93-
stage('Run Tests') {
94-
options {
95-
timeout(time: 30, unit: 'MINUTES')
96-
}
97-
steps {
98-
withMaven(jdk: "${JDK_VERSION}", maven: 'M3', mavenLocalRepo: '.repository') {
99-
withSonarQubeEnv('Sonar') {
100-
sh "mvn --no-transfer-progress --activate-profiles test -DgsExec=\"$gsExec\" -DcompareExec=\"$compareExec\" -Dmaven.main.skip=true -Dmaven.test.failure.ignore=false org.jacoco:jacoco-maven-plugin:prepare-agent verify org.jacoco:jacoco-maven-plugin:report -Dsonar.java.spotbugs.reportPaths=\"target/spotbugs.xml\" sonar:sonar $vars.sonarBranchName $vars.sonarBranchTarget"
101-
}
102-
}
103-
}
104-
}
105-
stage("Quality Gate") {
106-
steps {
107-
timeout(time: 1, unit: 'HOURS') {
108-
waitForQualityGate abortPipeline: true
109-
}
110-
}
111-
}
112-
stage('Artifactory Deploy') {
113-
options {
114-
timeout(time: 5, unit: 'MINUTES')
115-
}
116-
when {
117-
anyOf {
118-
branch "master"
119-
branch "develop"
120-
}
121-
}
122-
steps {
123-
withMaven(jdk: "${JDK_VERSION}", maven: 'M3', mavenLocalRepo: '.repository') {
124-
script {
125-
def server = Artifactory.server('itext-artifactory')
126-
def rtMaven = Artifactory.newMavenBuild()
127-
rtMaven.deployer server: server, releaseRepo: 'releases', snapshotRepo: 'snapshot'
128-
rtMaven.tool = 'M3'
129-
def buildInfo = rtMaven.run pom: 'pom.xml', goals: '--threads 2C --no-transfer-progress install --activate-profiles artifactory'
130-
server.publishBuildInfo buildInfo
131-
}
132-
}
133-
}
134-
}
135-
stage('Branch Artifactory Deploy') {
136-
options {
137-
timeout(time: 5, unit: 'MINUTES')
138-
}
139-
when {
140-
not {
141-
anyOf {
142-
branch "master"
143-
branch "develop"
144-
}
145-
}
146-
}
147-
steps {
148-
script {
149-
getAndConfigureJFrogCLI()
150-
if (env.GIT_URL) {
151-
repoName = ("${env.GIT_URL}" =~ /(.*\/)(.*)(\.git)/)[ 0 ][ 2 ]
152-
findFiles(glob: '*/target/*.jar').each { item ->
153-
if (!(item ==~ /.*\/[fs]b-contrib-.*?.jar/) && !(item ==~ /.*\/findsecbugs-plugin-.*?.jar/) && !(item ==~ /.*-sources.jar/) && !(item ==~ /.*-javadoc.jar/)) {
154-
sh "./jfrog rt u \"${item.path}\" branch-artifacts/${env.BRANCH_NAME}/${repoName}/java/ --recursive=false --build-name ${env.BRANCH_NAME} --build-number ${env.BUILD_NUMBER} --props \"vcs.revision=${env.GIT_COMMIT};repo.name=${repoName}\""
155-
}
156-
}
157-
findFiles(glob: '**/pom.xml').each { item ->
158-
def pomPath = item.path.replace('\\','/')
159-
if (!(pomPath ==~ /.*target.*/)) {
160-
def resPomName = "main.pom"
161-
def subDirMatcher = (pomPath =~ /^.*(?<=\/|^)(.*)\/pom\.xml/)
162-
if (subDirMatcher.matches()) {
163-
resPomName = "${subDirMatcher[ 0 ][ 1 ]}.pom"
164-
}
165-
sh "./jfrog rt u \"${item.path}\" branch-artifacts/${env.BRANCH_NAME}/${repoName}/java/${resPomName} --recursive=false --build-name ${env.BRANCH_NAME} --build-number ${env.BUILD_NUMBER} --props \"vcs.revision=${env.GIT_COMMIT};repo.name=${repoName}\""
166-
}
167-
}
168-
}
169-
}
170-
}
171-
}
172-
}
173-
174-
post {
175-
always {
176-
echo 'One way or another, I have finished \uD83E\uDD16'
177-
}
178-
success {
179-
echo 'I succeeeded! \u263A'
180-
cleanWs deleteDirs: true
181-
}
182-
unstable {
183-
echo 'I am unstable \uD83D\uDE2E'
184-
}
185-
failure {
186-
echo 'I failed \uD83D\uDCA9'
187-
}
188-
changed {
189-
echo 'Things were different before... \uD83E\uDD14'
190-
}
191-
fixed {
192-
script {
193-
if (vars.notifySlack) {
194-
slackNotifier("#ci", currentBuild.currentResult, "${env.BRANCH_NAME} - Back to normal")
195-
}
196-
}
197-
}
198-
regression {
199-
script {
200-
if (vars.notifySlack) {
201-
slackNotifier("#ci", currentBuild.currentResult, "${env.BRANCH_NAME} - First failure")
202-
}
203-
}
204-
}
205-
}
206-
207-
}
7+
automaticJavaBuild(repoName, dependencyRegex)

barcodes/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.itextpdf</groupId>
66
<artifactId>root</artifactId>
7-
<version>7.1.12</version>
7+
<version>7.1.13</version>
88
</parent>
99
<artifactId>barcodes</artifactId>
1010
<name>iText 7 - barcodes</name>
@@ -43,4 +43,4 @@
4343
</plugin>
4444
</plugins>
4545
</build>
46-
</project>
46+
</project>

barcodes/src/main/java/com/itextpdf/barcodes/BarcodeMSI.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ public class BarcodeMSI extends Barcode1D {
112112
*/
113113
private static final int BARS_PER_CHARACTER = 12;
114114

115+
/**
116+
* The number of individual bars either drawn or not drawn for the start character in the BarcodeMSI.
117+
*/
118+
private static final int BARS_FOR_START = 3;
119+
120+
/**
121+
* The number of individual bars either drawn or not drawn for the stop character in the BarcodeMSI.
122+
*/
123+
private static final int BARS_FOR_STOP = 4;
124+
115125
/**
116126
* Creates a new BarcodeMSI.
117127
* To generate the font the {@link PdfDocument#getDefaultFont()} will be implicitly called.
@@ -162,12 +172,12 @@ public Rectangle getBarcodeSize() {
162172
fontX = this.font.getWidth(this.altText != null ? this.altText : fullCode, this.size);
163173
}
164174

165-
int len = fCode.length() + 2;
175+
int len = fCode.length();
166176
if (this.generateChecksum) {
167177
++len;
168178
}
169179

170-
float fullWidth = (float) len * (6.0f * this.x + 3.0f * this.x * this.n) + (float) (len - 1) * this.x;
180+
float fullWidth = (len * BARS_PER_CHARACTER + BARS_FOR_START + BARS_FOR_STOP) * x;
171181
fullWidth = Math.max(fullWidth, fontX);
172182
float fullHeight = this.barHeight + fontY;
173183
return new Rectangle(fullWidth, fullHeight);
@@ -232,7 +242,7 @@ public Rectangle placeBarcode(PdfCanvas canvas, Color barColor, Color textColor)
232242
}
233243
int idx;
234244
idx = bCode.length();
235-
float fullWidth = (float) ((idx + 2) * 11) * this.x + 2.0f * this.x;
245+
final float fullWidth = (idx * BARS_PER_CHARACTER + BARS_FOR_START + BARS_FOR_STOP) * this.x;
236246
float barStartX = 0.0f;
237247
float textStartX = 0.0f;
238248
switch (this.textAlignment) {

barcodes/src/test/java/com/itextpdf/barcodes/BarcodeEANTest.java

Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ This file is part of the iText (R) project.
5454
import com.itextpdf.test.annotations.type.IntegrationTest;
5555

5656
import java.io.IOException;
57-
5857
import org.junit.Assert;
5958
import org.junit.BeforeClass;
6059
import org.junit.Test;
@@ -88,7 +87,9 @@ public void barcode01Test() throws IOException, PdfException, InterruptedExcepti
8887

8988
document.close();
9089

91-
Assert.assertNull(new CompareTool().compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder, "diff_"));
90+
Assert.assertNull(new CompareTool()
91+
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
92+
"diff_"));
9293
}
9394

9495
@Test
@@ -109,7 +110,9 @@ public void barcode02Test() throws IOException, PdfException, InterruptedExcepti
109110

110111
document.close();
111112

112-
Assert.assertNull(new CompareTool().compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder, "diff_"));
113+
Assert.assertNull(new CompareTool()
114+
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
115+
"diff_"));
113116
}
114117

115118
@Test
@@ -133,6 +136,96 @@ public void barcode03Test() throws IOException, PdfException, InterruptedExcepti
133136

134137
document.close();
135138

136-
Assert.assertNull(new CompareTool().compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder, "diff_"));
139+
Assert.assertNull(new CompareTool()
140+
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
141+
"diff_"));
142+
}
143+
144+
@Test
145+
public void placeBarcodeUPCATest() throws IOException, PdfException, InterruptedException {
146+
String filename = "placeBarcodeUPCATest.pdf";
147+
PdfWriter writer = new PdfWriter(destinationFolder + filename);
148+
PdfDocument document = new PdfDocument(writer);
149+
150+
PdfPage page = document.addNewPage();
151+
PdfCanvas canvas = new PdfCanvas(page);
152+
153+
Barcode1D barcode = new BarcodeEAN(document);
154+
barcode.setCodeType(BarcodeEAN.UPCA);
155+
barcode.setCode("012340000006");
156+
157+
barcode.placeBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);
158+
159+
document.close();
160+
161+
Assert.assertNull(new CompareTool()
162+
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
163+
"diff_"));
164+
}
165+
166+
@Test
167+
public void placeBarcodeUPCETest() throws IOException, PdfException, InterruptedException {
168+
String filename = "placeBarcodeUPCETest.pdf";
169+
PdfWriter writer = new PdfWriter(destinationFolder + filename);
170+
PdfDocument document = new PdfDocument(writer);
171+
172+
PdfPage page = document.addNewPage();
173+
PdfCanvas canvas = new PdfCanvas(page);
174+
175+
Barcode1D barcode = new BarcodeEAN(document);
176+
barcode.setCodeType(BarcodeEAN.UPCE);
177+
barcode.setCode("03456781");
178+
179+
barcode.placeBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);
180+
181+
document.close();
182+
183+
Assert.assertNull(new CompareTool()
184+
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
185+
"diff_"));
186+
}
187+
188+
@Test
189+
public void placeBarcodeSUPP2Test() throws IOException, PdfException, InterruptedException {
190+
String filename = "placeBarcodeSUPP2Test.pdf";
191+
PdfWriter writer = new PdfWriter(destinationFolder + filename);
192+
PdfDocument document = new PdfDocument(writer);
193+
194+
PdfPage page = document.addNewPage();
195+
PdfCanvas canvas = new PdfCanvas(page);
196+
197+
Barcode1D barcode = new BarcodeEAN(document);
198+
barcode.setCodeType(BarcodeEAN.SUPP2);
199+
barcode.setCode("03456781");
200+
201+
barcode.placeBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);
202+
203+
document.close();
204+
205+
Assert.assertNull(new CompareTool()
206+
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
207+
"diff_"));
208+
}
209+
210+
@Test
211+
public void placeBarcodeSUPP5Test() throws IOException, PdfException, InterruptedException {
212+
String filename = "placeBarcodeSUPP5Test.pdf";
213+
PdfWriter writer = new PdfWriter(destinationFolder + filename);
214+
PdfDocument document = new PdfDocument(writer);
215+
216+
PdfPage page = document.addNewPage();
217+
PdfCanvas canvas = new PdfCanvas(page);
218+
219+
Barcode1D barcode = new BarcodeEAN(document);
220+
barcode.setCodeType(BarcodeEAN.SUPP5);
221+
barcode.setCode("55999");
222+
223+
barcode.placeBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);
224+
225+
document.close();
226+
227+
Assert.assertNull(new CompareTool()
228+
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
229+
"diff_"));
137230
}
138231
}

0 commit comments

Comments
 (0)