-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3,346 changed files
with
167,724 additions
and
74,622 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,28 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2023 iText Group NV | ||
Authors: Bruno Lowagie, Paulo Soares, et al. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License version 3 | ||
as published by the Free Software Foundation with the addition of the | ||
following permission added to Section 15 as permitted in Section 7(a): | ||
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY | ||
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT | ||
OF THIRD PARTY RIGHTS | ||
Copyright (c) 1998-2023 Apryse Group NV | ||
Authors: Apryse Software. | ||
This program is distributed in the hope that it will be useful, but | ||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
or FITNESS FOR A PARTICULAR PURPOSE. | ||
See the GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program; if not, see http://www.gnu.org/licenses or write to | ||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
Boston, MA, 02110-1301 USA, or download the license from the following URL: | ||
http://itextpdf.com/terms-of-use/ | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
The interactive user interfaces in modified source and object code versions | ||
of this program must display Appropriate Legal Notices, as required under | ||
Section 5 of the GNU Affero General Public License. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
In accordance with Section 7(b) of the GNU Affero General Public License, | ||
a covered work must retain the producer line in every PDF that is created | ||
or manipulated using iText. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You can be released from the requirements of the license by purchasing | ||
a commercial license. Buying such a license is mandatory as soon as you | ||
develop commercial activities involving the iText software without | ||
disclosing the source code of your own applications. | ||
These activities include: offering paid services to customers as an ASP, | ||
serving PDFs on the fly in a web application, shipping iText with a closed | ||
source product. | ||
For more information, please contact iText Software Corp. at this | ||
address: [email protected] | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.itextpdf.barcodes; | ||
|
||
import com.itextpdf.barcodes.exceptions.BarcodeExceptionMessageConstant; | ||
import com.itextpdf.barcodes.exceptions.BarcodesExceptionMessageConstant; | ||
import com.itextpdf.kernel.exceptions.PdfException; | ||
import com.itextpdf.kernel.colors.Color; | ||
import com.itextpdf.kernel.font.PdfFont; | ||
|
@@ -353,7 +332,7 @@ public static String getRawText(String text, boolean ucc, Barcode128CodeSet code | |
for (int k = 0; k < tLen; ++k) { | ||
c = text.charAt(k); | ||
if (c > 127 && c != FNC1) | ||
throw new PdfException(BarcodeExceptionMessageConstant.THERE_ARE_ILLEGAL_CHARACTERS_FOR_BARCODE_128); | ||
throw new PdfException(BarcodesExceptionMessageConstant.THERE_ARE_ILLEGAL_CHARACTERS_FOR_BARCODE_128); | ||
} | ||
c = text.charAt(0); | ||
char currentCode = getStartSymbol(codeSet); | ||
|
@@ -384,7 +363,7 @@ public static String getRawText(String text, boolean ucc, Barcode128CodeSet code | |
++index; | ||
} | ||
if (codeSet != Barcode128CodeSet.AUTO && currentCode != getStartSymbol(codeSet)) | ||
throw new PdfException(BarcodeExceptionMessageConstant.THERE_ARE_ILLEGAL_CHARACTERS_FOR_BARCODE_128); | ||
throw new PdfException(BarcodesExceptionMessageConstant.THERE_ARE_ILLEGAL_CHARACTERS_FOR_BARCODE_128); | ||
while (index < tLen) { | ||
switch (currentCode) { | ||
case START_A: { | ||
|
@@ -453,7 +432,7 @@ else if (c < ' ') { | |
break; | ||
} | ||
if (codeSet != Barcode128CodeSet.AUTO && currentCode != getStartSymbol(codeSet)) | ||
throw new PdfException(BarcodeExceptionMessageConstant.THERE_ARE_ILLEGAL_CHARACTERS_FOR_BARCODE_128); | ||
throw new PdfException(BarcodesExceptionMessageConstant.THERE_ARE_ILLEGAL_CHARACTERS_FOR_BARCODE_128); | ||
} | ||
return out; | ||
} | ||
|
@@ -718,6 +697,7 @@ public void setCode(String code) { | |
} | ||
} | ||
|
||
// Android-Conversion-Skip-Block-Start (java.awt library isn't available on Android) | ||
/** | ||
* Creates a <CODE>java.awt.Image</CODE>. This image only | ||
* contains the bars without any text. | ||
|
@@ -766,6 +746,7 @@ public java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color b | |
} | ||
return canvas.createImage(new java.awt.image.MemoryImageSource(fullWidth, height, pix, 0, fullWidth)); | ||
} | ||
// Android-Conversion-Skip-Block-End | ||
|
||
private static char getStartSymbol(Barcode128CodeSet codeSet) { | ||
switch (codeSet) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,24 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2023 iText Group NV | ||
Authors: Bruno Lowagie, Paulo Soares, et al. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License version 3 | ||
as published by the Free Software Foundation with the addition of the | ||
following permission added to Section 15 as permitted in Section 7(a): | ||
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY | ||
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT | ||
OF THIRD PARTY RIGHTS | ||
This program is distributed in the hope that it will be useful, but | ||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
or FITNESS FOR A PARTICULAR PURPOSE. | ||
See the GNU Affero General Public License for more details. | ||
Copyright (c) 1998-2023 Apryse Group NV | ||
Authors: Apryse Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program; if not, see http://www.gnu.org/licenses or write to | ||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
Boston, MA, 02110-1301 USA, or download the license from the following URL: | ||
http://itextpdf.com/terms-of-use/ | ||
The interactive user interfaces in modified source and object code versions | ||
of this program must display Appropriate Legal Notices, as required under | ||
Section 5 of the GNU Affero General Public License. | ||
In accordance with Section 7(b) of the GNU Affero General Public License, | ||
a covered work must retain the producer line in every PDF that is created | ||
or manipulated using iText. | ||
You can be released from the requirements of the license by purchasing | ||
a commercial license. Buying such a license is mandatory as soon as you | ||
develop commercial activities involving the iText software without | ||
disclosing the source code of your own applications. | ||
These activities include: offering paid services to customers as an ASP, | ||
serving PDFs on the fly in a web application, shipping iText with a closed | ||
source product. | ||
For more information, please contact iText Software Corp. at this | ||
address: [email protected] | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.itextpdf.barcodes; | ||
|
||
|
@@ -58,6 +37,7 @@ public abstract class Barcode1D { | |
public static final int ALIGN_RIGHT = 2; | ||
public static final int ALIGN_CENTER = 3; | ||
|
||
// Android-Conversion-Skip-Block-Start (java.awt library isn't available on Android) | ||
/** | ||
* The default color to draw if a bar is present. | ||
*/ | ||
|
@@ -66,7 +46,8 @@ public abstract class Barcode1D { | |
* The default color to draw if a bar is not present. | ||
*/ | ||
protected final java.awt.Color DEFAULT_BAR_BACKGROUND_COLOR = java.awt.Color.WHITE; | ||
|
||
// Android-Conversion-Skip-Block-End | ||
|
||
protected PdfDocument document; | ||
|
||
/** | ||
|
@@ -498,6 +479,7 @@ public void setAltText(String altText) { | |
this.altText = altText; | ||
} | ||
|
||
// Android-Conversion-Skip-Block-Start (java.awt library isn't available on Android) | ||
/** | ||
* Creates a <CODE>java.awt.Image</CODE>. This image only | ||
* contains the bars without any text. | ||
|
@@ -507,6 +489,7 @@ public void setAltText(String altText) { | |
* @return the image | ||
*/ | ||
public abstract java.awt.Image createAwtImage(java.awt.Color foreground, java.awt.Color background); | ||
// Android-Conversion-Skip-Block-End | ||
|
||
/** | ||
* Creates a PdfFormXObject with the barcode. Default bar color and text color will be used. | ||
|
@@ -545,7 +528,7 @@ public void fitWidth(float width) { | |
} | ||
|
||
protected float getDescender() { | ||
float sizeCoef = size / FontProgram.UNITS_NORMALIZATION; | ||
return font.getFontProgram().getFontMetrics().getTypoDescender() * sizeCoef; | ||
final float sizeCoefficient = FontProgram.convertTextSpaceToGlyphSpace(size); | ||
return font.getFontProgram().getFontMetrics().getTypoDescender() * sizeCoefficient; | ||
} | ||
} |
Oops, something went wrong.