"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType3CharProc.java" between
pdfbox-2.0.23-src.zip and pdfbox-2.0.24-src.zip

About: Apache PDFBox is a Java PDF library tool that allows creation of new PDF documents, manipulation of existing documents and the ability to extract content from documents.

PDType3CharProc.java  (pdfbox-2.0.23-src):PDType3CharProc.java  (pdfbox-2.0.24-src)
skipping to change at line 28 skipping to change at line 28
package org.apache.pdfbox.pdmodel.font; package org.apache.pdfbox.pdmodel.font;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.pdfbox.contentstream.PDContentStream; import org.apache.pdfbox.contentstream.PDContentStream;
import org.apache.pdfbox.contentstream.operator.Operator; import org.apache.pdfbox.contentstream.operator.Operator;
import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSNumber; import org.apache.pdfbox.cos.COSNumber;
import org.apache.pdfbox.cos.COSObject;
import org.apache.pdfbox.cos.COSStream; import org.apache.pdfbox.cos.COSStream;
import org.apache.pdfbox.pdfparser.PDFStreamParser; import org.apache.pdfbox.pdfparser.PDFStreamParser;
import org.apache.pdfbox.pdmodel.PDResources; import org.apache.pdfbox.pdmodel.PDResources;
import org.apache.pdfbox.pdmodel.common.COSObjectable; import org.apache.pdfbox.pdmodel.common.COSObjectable;
import org.apache.pdfbox.pdmodel.common.PDRectangle; import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.common.PDStream; import org.apache.pdfbox.pdmodel.common.PDStream;
import org.apache.pdfbox.util.Matrix; import org.apache.pdfbox.util.Matrix;
/** /**
* A Type 3 character procedure. This is a standalone PDF content stream. * A Type 3 character procedure. This is a standalone PDF content stream.
skipping to change at line 101 skipping to change at line 100
* @return the bounding box of this glyph, or null if the first operator is not d1. * @return the bounding box of this glyph, or null if the first operator is not d1.
* @throws IOException If an io error occurs while parsing the stream. * @throws IOException If an io error occurs while parsing the stream.
*/ */
public PDRectangle getGlyphBBox() throws IOException public PDRectangle getGlyphBBox() throws IOException
{ {
List<COSBase> arguments = new ArrayList<COSBase>(); List<COSBase> arguments = new ArrayList<COSBase>();
PDFStreamParser parser = new PDFStreamParser(this); PDFStreamParser parser = new PDFStreamParser(this);
Object token = parser.parseNextToken(); Object token = parser.parseNextToken();
while (token != null) while (token != null)
{ {
if (token instanceof COSObject) if (token instanceof Operator)
{
arguments.add(((COSObject) token).getObject());
}
else if (token instanceof Operator)
{ {
if (((Operator) token).getName().equals("d1") && arguments.size( ) == 6) if (((Operator) token).getName().equals("d1") && arguments.size( ) == 6)
{ {
for (int i = 0; i < 6; ++i) for (int i = 0; i < 6; ++i)
{ {
if (!(arguments.get(i) instanceof COSNumber)) if (!(arguments.get(i) instanceof COSNumber))
{ {
return null; return null;
} }
} }
skipping to change at line 156 skipping to change at line 151
* @throws IOException if the stream could not be read, or did not have d0 o r d1 as first * @throws IOException if the stream could not be read, or did not have d0 o r d1 as first
* operator, or if their first argument was not a number. * operator, or if their first argument was not a number.
*/ */
public float getWidth() throws IOException public float getWidth() throws IOException
{ {
List<COSBase> arguments = new ArrayList<COSBase>(); List<COSBase> arguments = new ArrayList<COSBase>();
PDFStreamParser parser = new PDFStreamParser(this); PDFStreamParser parser = new PDFStreamParser(this);
Object token = parser.parseNextToken(); Object token = parser.parseNextToken();
while (token != null) while (token != null)
{ {
if (token instanceof COSObject) if (token instanceof Operator)
{
arguments.add(((COSObject) token).getObject());
}
else if (token instanceof Operator)
{ {
return parseWidth((Operator) token, arguments); return parseWidth((Operator) token, arguments);
} }
else else
{ {
arguments.add((COSBase) token); arguments.add((COSBase) token);
} }
token = parser.parseNextToken(); token = parser.parseNextToken();
} }
throw new IOException("Unexpected end of stream"); throw new IOException("Unexpected end of stream");
 End of changes. 3 change blocks. 
11 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)