Skip to content

Commit

Permalink
[RELEASE] iText 7 Core - 7.1.13
Browse files Browse the repository at this point in the history
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
  • Loading branch information
iText-CI committed Oct 8, 2020
2 parents bdddc61 + 6ec3dbc commit f5b3c77
Show file tree
Hide file tree
Showing 631 changed files with 27,328 additions and 3,225 deletions.
206 changes: 3 additions & 203 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,207 +1,7 @@
#!/usr/bin/env groovy
@Library('pipeline-library')_

def vars = setBranchDependentVars(env.BRANCH_NAME)
def repoName = "itextcore"
def dependencyRegex = ""

pipeline {

agent any

environment {
JDK_VERSION = 'jdk-8-oracle'
}

options {
ansiColor('xterm')
buildDiscarder(
logRotator(
numToKeepStr: vars.buildNumToKeep,
artifactNumToKeepStr: vars.buildArtifactNumToKeep,
daysToKeepStr: vars.buildDaysToKeep,
artifactDaysToKeepStr: vars.buildArtifactDaysToKeep
)
)
parallelsAlwaysFailFast()
skipStagesAfterUnstable()
timeout(time: 2, unit: 'HOURS')
timestamps()
}

triggers {
cron(vars.schedule)
}

tools {
maven 'M3'
jdk "${JDK_VERSION}"
}

stages {
stage('Abort possible previous builds') {
steps {
script {
abortPreviousBuilds()
}
}
}
stage('Build') {
options {
retry(2)
}
stages {
stage('Clean workspace') {
options {
timeout(time: 5, unit: 'MINUTES')
}
steps {
withMaven(jdk: "${JDK_VERSION}", maven: 'M3', mavenLocalRepo: '.repository') {
sh 'mvn --threads 2C --no-transfer-progress clean dependency:purge-local-repository -Dinclude=com.itextpdf -DresolutionFuzziness=groupId -DreResolve=false'
}
}
}
stage('Compile') {
options {
timeout(time: 10, unit: 'MINUTES')
}
steps {
withMaven(jdk: "${JDK_VERSION}", maven: 'M3', mavenLocalRepo: '.repository') {
sh 'mvn --threads 2C --no-transfer-progress package -Dmaven.test.skip=true'
}
}
}
}
post {
failure {
sleep time: 2, unit: 'MINUTES'
}
success {
script { currentBuild.result = 'SUCCESS' }
}
}
}
stage('Static Code Analysis') {
options {
timeout(time: 1, unit: 'HOURS')
}
steps {
withMaven(jdk: "${JDK_VERSION}", maven: 'M3', mavenLocalRepo: '.repository') {
sh 'mvn --no-transfer-progress verify --activate-profiles qa -Dpmd.analysisCache=true'
}
dependencyCheckPublisher pattern: 'target/dependency-check-report.xml'
}
}
stage('Run Tests') {
options {
timeout(time: 30, unit: 'MINUTES')
}
steps {
withMaven(jdk: "${JDK_VERSION}", maven: 'M3', mavenLocalRepo: '.repository') {
withSonarQubeEnv('Sonar') {
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"
}
}
}
}
stage("Quality Gate") {
steps {
timeout(time: 1, unit: 'HOURS') {
waitForQualityGate abortPipeline: true
}
}
}
stage('Artifactory Deploy') {
options {
timeout(time: 5, unit: 'MINUTES')
}
when {
anyOf {
branch "master"
branch "develop"
}
}
steps {
withMaven(jdk: "${JDK_VERSION}", maven: 'M3', mavenLocalRepo: '.repository') {
script {
def server = Artifactory.server('itext-artifactory')
def rtMaven = Artifactory.newMavenBuild()
rtMaven.deployer server: server, releaseRepo: 'releases', snapshotRepo: 'snapshot'
rtMaven.tool = 'M3'
def buildInfo = rtMaven.run pom: 'pom.xml', goals: '--threads 2C --no-transfer-progress install --activate-profiles artifactory'
server.publishBuildInfo buildInfo
}
}
}
}
stage('Branch Artifactory Deploy') {
options {
timeout(time: 5, unit: 'MINUTES')
}
when {
not {
anyOf {
branch "master"
branch "develop"
}
}
}
steps {
script {
getAndConfigureJFrogCLI()
if (env.GIT_URL) {
repoName = ("${env.GIT_URL}" =~ /(.*\/)(.*)(\.git)/)[ 0 ][ 2 ]
findFiles(glob: '*/target/*.jar').each { item ->
if (!(item ==~ /.*\/[fs]b-contrib-.*?.jar/) && !(item ==~ /.*\/findsecbugs-plugin-.*?.jar/) && !(item ==~ /.*-sources.jar/) && !(item ==~ /.*-javadoc.jar/)) {
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}\""
}
}
findFiles(glob: '**/pom.xml').each { item ->
def pomPath = item.path.replace('\\','/')
if (!(pomPath ==~ /.*target.*/)) {
def resPomName = "main.pom"
def subDirMatcher = (pomPath =~ /^.*(?<=\/|^)(.*)\/pom\.xml/)
if (subDirMatcher.matches()) {
resPomName = "${subDirMatcher[ 0 ][ 1 ]}.pom"
}
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}\""
}
}
}
}
}
}
}

post {
always {
echo 'One way or another, I have finished \uD83E\uDD16'
}
success {
echo 'I succeeeded! \u263A'
cleanWs deleteDirs: true
}
unstable {
echo 'I am unstable \uD83D\uDE2E'
}
failure {
echo 'I failed \uD83D\uDCA9'
}
changed {
echo 'Things were different before... \uD83E\uDD14'
}
fixed {
script {
if (vars.notifySlack) {
slackNotifier("#ci", currentBuild.currentResult, "${env.BRANCH_NAME} - Back to normal")
}
}
}
regression {
script {
if (vars.notifySlack) {
slackNotifier("#ci", currentBuild.currentResult, "${env.BRANCH_NAME} - First failure")
}
}
}
}

}
automaticJavaBuild(repoName, dependencyRegex)
4 changes: 2 additions & 2 deletions barcodes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.itextpdf</groupId>
<artifactId>root</artifactId>
<version>7.1.12</version>
<version>7.1.13</version>
</parent>
<artifactId>barcodes</artifactId>
<name>iText 7 - barcodes</name>
Expand Down Expand Up @@ -43,4 +43,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
16 changes: 13 additions & 3 deletions barcodes/src/main/java/com/itextpdf/barcodes/BarcodeMSI.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ public class BarcodeMSI extends Barcode1D {
*/
private static final int BARS_PER_CHARACTER = 12;

/**
* The number of individual bars either drawn or not drawn for the start character in the BarcodeMSI.
*/
private static final int BARS_FOR_START = 3;

/**
* The number of individual bars either drawn or not drawn for the stop character in the BarcodeMSI.
*/
private static final int BARS_FOR_STOP = 4;

/**
* Creates a new BarcodeMSI.
* To generate the font the {@link PdfDocument#getDefaultFont()} will be implicitly called.
Expand Down Expand Up @@ -162,12 +172,12 @@ public Rectangle getBarcodeSize() {
fontX = this.font.getWidth(this.altText != null ? this.altText : fullCode, this.size);
}

int len = fCode.length() + 2;
int len = fCode.length();
if (this.generateChecksum) {
++len;
}

float fullWidth = (float) len * (6.0f * this.x + 3.0f * this.x * this.n) + (float) (len - 1) * this.x;
float fullWidth = (len * BARS_PER_CHARACTER + BARS_FOR_START + BARS_FOR_STOP) * x;
fullWidth = Math.max(fullWidth, fontX);
float fullHeight = this.barHeight + fontY;
return new Rectangle(fullWidth, fullHeight);
Expand Down Expand Up @@ -232,7 +242,7 @@ public Rectangle placeBarcode(PdfCanvas canvas, Color barColor, Color textColor)
}
int idx;
idx = bCode.length();
float fullWidth = (float) ((idx + 2) * 11) * this.x + 2.0f * this.x;
final float fullWidth = (idx * BARS_PER_CHARACTER + BARS_FOR_START + BARS_FOR_STOP) * this.x;
float barStartX = 0.0f;
float textStartX = 0.0f;
switch (this.textAlignment) {
Expand Down
101 changes: 97 additions & 4 deletions barcodes/src/test/java/com/itextpdf/barcodes/BarcodeEANTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ This file is part of the iText (R) project.
import com.itextpdf.test.annotations.type.IntegrationTest;

import java.io.IOException;

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
Expand Down Expand Up @@ -88,7 +87,9 @@ public void barcode01Test() throws IOException, PdfException, InterruptedExcepti

document.close();

Assert.assertNull(new CompareTool().compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder, "diff_"));
Assert.assertNull(new CompareTool()
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
"diff_"));
}

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

document.close();

Assert.assertNull(new CompareTool().compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder, "diff_"));
Assert.assertNull(new CompareTool()
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
"diff_"));
}

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

document.close();

Assert.assertNull(new CompareTool().compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder, "diff_"));
Assert.assertNull(new CompareTool()
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
"diff_"));
}

@Test
public void placeBarcodeUPCATest() throws IOException, PdfException, InterruptedException {
String filename = "placeBarcodeUPCATest.pdf";
PdfWriter writer = new PdfWriter(destinationFolder + filename);
PdfDocument document = new PdfDocument(writer);

PdfPage page = document.addNewPage();
PdfCanvas canvas = new PdfCanvas(page);

Barcode1D barcode = new BarcodeEAN(document);
barcode.setCodeType(BarcodeEAN.UPCA);
barcode.setCode("012340000006");

barcode.placeBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);

document.close();

Assert.assertNull(new CompareTool()
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
"diff_"));
}

@Test
public void placeBarcodeUPCETest() throws IOException, PdfException, InterruptedException {
String filename = "placeBarcodeUPCETest.pdf";
PdfWriter writer = new PdfWriter(destinationFolder + filename);
PdfDocument document = new PdfDocument(writer);

PdfPage page = document.addNewPage();
PdfCanvas canvas = new PdfCanvas(page);

Barcode1D barcode = new BarcodeEAN(document);
barcode.setCodeType(BarcodeEAN.UPCE);
barcode.setCode("03456781");

barcode.placeBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);

document.close();

Assert.assertNull(new CompareTool()
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
"diff_"));
}

@Test
public void placeBarcodeSUPP2Test() throws IOException, PdfException, InterruptedException {
String filename = "placeBarcodeSUPP2Test.pdf";
PdfWriter writer = new PdfWriter(destinationFolder + filename);
PdfDocument document = new PdfDocument(writer);

PdfPage page = document.addNewPage();
PdfCanvas canvas = new PdfCanvas(page);

Barcode1D barcode = new BarcodeEAN(document);
barcode.setCodeType(BarcodeEAN.SUPP2);
barcode.setCode("03456781");

barcode.placeBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);

document.close();

Assert.assertNull(new CompareTool()
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
"diff_"));
}

@Test
public void placeBarcodeSUPP5Test() throws IOException, PdfException, InterruptedException {
String filename = "placeBarcodeSUPP5Test.pdf";
PdfWriter writer = new PdfWriter(destinationFolder + filename);
PdfDocument document = new PdfDocument(writer);

PdfPage page = document.addNewPage();
PdfCanvas canvas = new PdfCanvas(page);

Barcode1D barcode = new BarcodeEAN(document);
barcode.setCodeType(BarcodeEAN.SUPP5);
barcode.setCode("55999");

barcode.placeBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);

document.close();

Assert.assertNull(new CompareTool()
.compareByContent(destinationFolder + filename, sourceFolder + "cmp_" + filename, destinationFolder,
"diff_"));
}
}
Loading

0 comments on commit f5b3c77

Please sign in to comment.