You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2020/12/23 10:45:51 UTC
svn commit: r1884743 [1/2] - in /pdfbox/trunk:
debugger/src/main/java/org/apache/pdfbox/debugger/
debugger/src/main/java/org/apache/pdfbox/debugger/treestatus/
debugger/src/main/java/org/apache/pdfbox/debugger/ui/
debugger/src/main/java/org/apache/pdfb...
Author: tilman
Date: Wed Dec 23 10:45:50 2020
New Revision: 1884743
URL: http://svn.apache.org/viewvc?rev=1884743&view=rev
Log:
PDFBOX-5055: make fields final where possible, as suggested by Arturo Bernal
Modified:
pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/treestatus/TreeStatusPane.java
pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java
pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/textsearcher/SearchPanel.java
pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/CMSProcessableInputStream.java
pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java
pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/cert/CertificateVerificationResult.java
pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java
pdfbox/trunk/examples/src/test/java/org/apache/wink/client/MockHttpServer.java
pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFOperator.java
pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java
pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/DataOutput.java
pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type1CharString.java
pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java
pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/encoding/Encoding.java
pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphRenderer.java
pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TrueTypeFont.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessReadBufferedFile.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PageExtractor.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabelRange.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRange.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDParentTreeValue.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/StandardStructureTypes.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFCatalog.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDictionary.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFIconFit.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/AbstractFixup.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AbstractProcessor.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/CMapManager.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDPattern.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Patch.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/PDAction.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/PDWindowsLaunchParams.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDAbstractAppearanceHandler.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/layout/PlainTextFormatter.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/PDPropBuild.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/destination/PDPageDestination.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PlainTextFormatter.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/measurement/PDNumberFormatDictionary.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/pagenavigation/PDThread.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripper.java
pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/cos/PDFDocEncodingTest.java
pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSFloat.java
pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfwriter/COSDocumentCompressionTest.java
pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/rendering/TestPDFToImage.java
pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/PreflightDocument.java
pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/annotation/AnnotationValidatorFactory.java
pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/FontValidator.java
pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/SimpleFontValidator.java
pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type0FontValidator.java
pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/Type3FontValidator.java
pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/font/container/FontContainer.java
pdfbox/trunk/preflight/src/test/java/org/apache/pdfbox/preflight/integration/TestInvalidFiles.java
pdfbox/trunk/preflight/src/test/java/org/apache/pdfbox/preflight/integration/TestIsartorValidation.java
pdfbox/trunk/preflight/src/test/java/org/apache/pdfbox/preflight/integration/TestValidFiles.java
pdfbox/trunk/preflight/src/test/java/org/apache/pdfbox/preflight/parser/TestXmlResultParser.java
pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/XMPMetadata.java
pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/XmpParsingException.java
pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/xml/XmpSerializer.java
pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFErrorsTest.java
pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/SchemaTester.java
pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestAbstractStructuredType.java
Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java (original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java Wed Dec 23 10:45:50 2020
@@ -176,7 +176,7 @@ public class PDFDebugger extends JFrame
private JMenuItem findPreviousMenuItem;
// configuration
- public static Properties configuration = new Properties();
+ public static final Properties configuration = new Properties();
/**
* Constructor.
Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/treestatus/TreeStatusPane.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/treestatus/TreeStatusPane.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/treestatus/TreeStatusPane.java (original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/treestatus/TreeStatusPane.java Wed Dec 23 10:45:50 2020
@@ -37,7 +37,7 @@ import javax.swing.tree.TreePath;
public class TreeStatusPane implements TreeSelectionListener
{
private TreeStatus statusObj;
- private JTree tree;
+ private final JTree tree;
private JTextField statusField;
private JPanel panel;
Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java (original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java Wed Dec 23 10:45:50 2020
@@ -69,8 +69,8 @@ public class ErrorDialog extends JDialog
private boolean showingDetails;
private boolean isFiltering = true;
- private JComponent message;
- private JComponent main;
+ private final JComponent message;
+ private final JComponent main;
private JScrollPane details;
private JTextPane stacktrace;
private final Throwable error;
Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/textsearcher/SearchPanel.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/textsearcher/SearchPanel.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/textsearcher/SearchPanel.java (original)
+++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/ui/textsearcher/SearchPanel.java Wed Dec 23 10:45:50 2020
@@ -52,7 +52,7 @@ class SearchPanel
private JLabel counterLabel;
private JPanel panel;
- private Action closeAction = new AbstractAction()
+ private final Action closeAction = new AbstractAction()
{
@Override
public void actionPerformed(ActionEvent actionEvent)
Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/CMSProcessableInputStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/CMSProcessableInputStream.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/CMSProcessableInputStream.java (original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/CMSProcessableInputStream.java Wed Dec 23 10:45:50 2020
@@ -1,71 +1,71 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pdfbox.examples.signature;
-
-import org.bouncycastle.asn1.ASN1ObjectIdentifier;
-import org.bouncycastle.asn1.cms.CMSObjectIdentifiers;
-import org.bouncycastle.cms.CMSException;
-import org.bouncycastle.cms.CMSTypedData;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import org.apache.pdfbox.io.IOUtils;
-
-/**
- * Wraps a InputStream into a CMSProcessable object for bouncy castle. It's a memory saving
- * alternative to the {@link org.bouncycastle.cms.CMSProcessableByteArray CMSProcessableByteArray}
- * class.
- *
- * @author Thomas Chojecki
- */
-class CMSProcessableInputStream implements CMSTypedData
-{
- private InputStream in;
- private final ASN1ObjectIdentifier contentType;
-
- CMSProcessableInputStream(InputStream is)
- {
- this(new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()), is);
- }
-
- CMSProcessableInputStream(ASN1ObjectIdentifier type, InputStream is)
- {
- contentType = type;
- in = is;
- }
-
- @Override
- public Object getContent()
- {
- return in;
- }
-
- @Override
- public void write(OutputStream out) throws IOException, CMSException
- {
- // read the content only one time
- IOUtils.copy(in, out);
- in.close();
- }
-
- @Override
- public ASN1ObjectIdentifier getContentType()
- {
- return contentType;
- }
-}
\ No newline at end of file
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.examples.signature;
+
+import org.bouncycastle.asn1.ASN1ObjectIdentifier;
+import org.bouncycastle.asn1.cms.CMSObjectIdentifiers;
+import org.bouncycastle.cms.CMSException;
+import org.bouncycastle.cms.CMSTypedData;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import org.apache.pdfbox.io.IOUtils;
+
+/**
+ * Wraps a InputStream into a CMSProcessable object for bouncy castle. It's a memory saving
+ * alternative to the {@link org.bouncycastle.cms.CMSProcessableByteArray CMSProcessableByteArray}
+ * class.
+ *
+ * @author Thomas Chojecki
+ */
+class CMSProcessableInputStream implements CMSTypedData
+{
+ private final InputStream in;
+ private final ASN1ObjectIdentifier contentType;
+
+ CMSProcessableInputStream(InputStream is)
+ {
+ this(new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()), is);
+ }
+
+ CMSProcessableInputStream(ASN1ObjectIdentifier type, InputStream is)
+ {
+ contentType = type;
+ in = is;
+ }
+
+ @Override
+ public Object getContent()
+ {
+ return in;
+ }
+
+ @Override
+ public void write(OutputStream out) throws IOException, CMSException
+ {
+ // read the content only one time
+ IOUtils.copy(in, out);
+ in.close();
+ }
+
+ @Override
+ public ASN1ObjectIdentifier getContentType()
+ {
+ return contentType;
+ }
+}
Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java (original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java Wed Dec 23 10:45:50 2020
@@ -357,9 +357,9 @@ public final class ShowSignature
}
/**
- * Verify ETSI.RFC3161 TImeStampToken
+ * Verify ETSI.RFC3161 TimeStampToken
*
- * @param byteArray the byte sequence that has been signed
+ * @param buf the byte sequence that has been signed
* @param contents the /Contents field as a COSString
* @throws CMSException
* @throws NoSuchAlgorithmException
Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/cert/CertificateVerificationResult.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/cert/CertificateVerificationResult.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/cert/CertificateVerificationResult.java (original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/cert/CertificateVerificationResult.java Wed Dec 23 10:45:50 2020
@@ -28,7 +28,7 @@ import java.security.cert.PKIXCertPathBu
*/
public class CertificateVerificationResult
{
- private boolean valid;
+ private final boolean valid;
private PKIXCertPathBuilderResult result;
private Throwable exception;
Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java (original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java Wed Dec 23 10:45:50 2020
@@ -129,7 +129,6 @@ public class AddValidationInformation
* Fetches certificate information from the last signature of the document and appends a DSS
* with the validation information to the document.
*
- * @param document containing the Signature
* @param filename in file to extract signature
* @param output where to write the changed document
* @throws IOException
Modified: pdfbox/trunk/examples/src/test/java/org/apache/wink/client/MockHttpServer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/test/java/org/apache/wink/client/MockHttpServer.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/test/java/org/apache/wink/client/MockHttpServer.java (original)
+++ pdfbox/trunk/examples/src/test/java/org/apache/wink/client/MockHttpServer.java Wed Dec 23 10:45:50 2020
@@ -117,13 +117,13 @@ public class MockHttpServer extends Thre
private int readTimeOut = 5000; // 5
// seconds
private int delayResponseTime = 0;
- private static byte[] NEW_LINE = "\r\n".getBytes();
+ private static final byte[] NEW_LINE = "\r\n".getBytes();
// request data
private String requestMethod = null;
private String requestUrl = null;
- private Map<String, List<String>> requestHeaders = new HashMap<>();
- private ByteArrayOutputStream requestContent = new ByteArrayOutputStream();
- private List<MockHttpServerResponse> mockHttpServerResponses = new ArrayList<>();
+ private final Map<String, List<String>> requestHeaders = new HashMap<>();
+ private final ByteArrayOutputStream requestContent = new ByteArrayOutputStream();
+ private final List<MockHttpServerResponse> mockHttpServerResponses = new ArrayList<>();
private int responseCounter = 0;
public MockHttpServer(int serverPort) {
Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFOperator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFOperator.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFOperator.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFOperator.java Wed Dec 23 10:45:50 2020
@@ -1,266 +1,266 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.fontbox.cff;
-
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * This class represents a CFF operator.
- * @author Villu Ruusmann
- */
-public final class CFFOperator
-{
-
- private Key operatorKey = null;
- private String operatorName = null;
-
- private CFFOperator(Key key, String name)
- {
- setKey(key);
- setName(name);
- }
-
- /**
- * The key of the operator.
- * @return the key
- */
- public Key getKey()
- {
- return operatorKey;
- }
-
- private void setKey(Key key)
- {
- operatorKey = key;
- }
-
- /**
- * The name of the operator.
- * @return the name
- */
- public String getName()
- {
- return operatorName;
- }
-
- private void setName(String name)
- {
- operatorName = name;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString()
- {
- return getName();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode()
- {
- return getKey().hashCode();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object object)
- {
- if (object instanceof CFFOperator)
- {
- CFFOperator that = (CFFOperator) object;
- return getKey().equals(that.getKey());
- }
- return false;
- }
-
- private static void register(Key key, String name)
- {
- CFFOperator operator = new CFFOperator(key, name);
- keyMap.put(key, operator);
- nameMap.put(name, operator);
- }
-
- /**
- * Returns the operator corresponding to the given key.
- * @param key the given key
- * @return the corresponding operator
- */
- public static CFFOperator getOperator(Key key)
- {
- return keyMap.get(key);
- }
-
- /**
- * Returns the operator corresponding to the given name.
- * @param name the given name
- * @return the corresponding operator
- */
- public static CFFOperator getOperator(String name)
- {
- return nameMap.get(name);
- }
-
- /**
- * This class is a holder for a key value. It consists of one or two bytes.
- * @author Villu Ruusmann
- */
- public static class Key
- {
- private int[] value = null;
-
- /**
- * Constructor.
- * @param b0 the one byte value
- */
- public Key(int b0)
- {
- this(new int[] { b0 });
- }
-
- /**
- * Constructor.
- * @param b0 the first byte of a two byte value
- * @param b1 the second byte of a two byte value
- */
- public Key(int b0, int b1)
- {
- this(new int[] { b0, b1 });
- }
-
- private Key(int[] value)
- {
- setValue(value);
- }
-
- /**
- * Returns the value of the key.
- * @return the value
- */
- public int[] getValue()
- {
- return value;
- }
-
- private void setValue(int[] value)
- {
- this.value = value;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString()
- {
- return Arrays.toString(getValue());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode()
- {
- return Arrays.hashCode(getValue());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object object)
- {
- if (object instanceof Key)
- {
- Key that = (Key) object;
- return Arrays.equals(getValue(), that.getValue());
- }
- return false;
- }
- }
-
- private static Map<CFFOperator.Key, CFFOperator> keyMap = new LinkedHashMap<>(52);
- private static Map<String, CFFOperator> nameMap = new LinkedHashMap<>(52);
-
- static
- {
- // Top DICT
- register(new Key(0), "version");
- register(new Key(1), "Notice");
- register(new Key(12, 0), "Copyright");
- register(new Key(2), "FullName");
- register(new Key(3), "FamilyName");
- register(new Key(4), "Weight");
- register(new Key(12, 1), "isFixedPitch");
- register(new Key(12, 2), "ItalicAngle");
- register(new Key(12, 3), "UnderlinePosition");
- register(new Key(12, 4), "UnderlineThickness");
- register(new Key(12, 5), "PaintType");
- register(new Key(12, 6), "CharstringType");
- register(new Key(12, 7), "FontMatrix");
- register(new Key(13), "UniqueID");
- register(new Key(5), "FontBBox");
- register(new Key(12, 8), "StrokeWidth");
- register(new Key(14), "XUID");
- register(new Key(15), "charset");
- register(new Key(16), "Encoding");
- register(new Key(17), "CharStrings");
- register(new Key(18), "Private");
- register(new Key(12, 20), "SyntheticBase");
- register(new Key(12, 21), "PostScript");
- register(new Key(12, 22), "BaseFontName");
- register(new Key(12, 23), "BaseFontBlend");
- register(new Key(12, 30), "ROS");
- register(new Key(12, 31), "CIDFontVersion");
- register(new Key(12, 32), "CIDFontRevision");
- register(new Key(12, 33), "CIDFontType");
- register(new Key(12, 34), "CIDCount");
- register(new Key(12, 35), "UIDBase");
- register(new Key(12, 36), "FDArray");
- register(new Key(12, 37), "FDSelect");
- register(new Key(12, 38), "FontName");
-
- // Private DICT
- register(new Key(6), "BlueValues");
- register(new Key(7), "OtherBlues");
- register(new Key(8), "FamilyBlues");
- register(new Key(9), "FamilyOtherBlues");
- register(new Key(12, 9), "BlueScale");
- register(new Key(12, 10), "BlueShift");
- register(new Key(12, 11), "BlueFuzz");
- register(new Key(10), "StdHW");
- register(new Key(11), "StdVW");
- register(new Key(12, 12), "StemSnapH");
- register(new Key(12, 13), "StemSnapV");
- register(new Key(12, 14), "ForceBold");
- register(new Key(12, 15), "LanguageGroup");
- register(new Key(12, 16), "ExpansionFactor");
- register(new Key(12, 17), "initialRandomSeed");
- register(new Key(19), "Subrs");
- register(new Key(20), "defaultWidthX");
- register(new Key(21), "nominalWidthX");
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.fontbox.cff;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * This class represents a CFF operator.
+ * @author Villu Ruusmann
+ */
+public final class CFFOperator
+{
+
+ private Key operatorKey = null;
+ private String operatorName = null;
+
+ private CFFOperator(Key key, String name)
+ {
+ setKey(key);
+ setName(name);
+ }
+
+ /**
+ * The key of the operator.
+ * @return the key
+ */
+ public Key getKey()
+ {
+ return operatorKey;
+ }
+
+ private void setKey(Key key)
+ {
+ operatorKey = key;
+ }
+
+ /**
+ * The name of the operator.
+ * @return the name
+ */
+ public String getName()
+ {
+ return operatorName;
+ }
+
+ private void setName(String name)
+ {
+ operatorName = name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString()
+ {
+ return getName();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode()
+ {
+ return getKey().hashCode();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object object)
+ {
+ if (object instanceof CFFOperator)
+ {
+ CFFOperator that = (CFFOperator) object;
+ return getKey().equals(that.getKey());
+ }
+ return false;
+ }
+
+ private static void register(Key key, String name)
+ {
+ CFFOperator operator = new CFFOperator(key, name);
+ keyMap.put(key, operator);
+ nameMap.put(name, operator);
+ }
+
+ /**
+ * Returns the operator corresponding to the given key.
+ * @param key the given key
+ * @return the corresponding operator
+ */
+ public static CFFOperator getOperator(Key key)
+ {
+ return keyMap.get(key);
+ }
+
+ /**
+ * Returns the operator corresponding to the given name.
+ * @param name the given name
+ * @return the corresponding operator
+ */
+ public static CFFOperator getOperator(String name)
+ {
+ return nameMap.get(name);
+ }
+
+ /**
+ * This class is a holder for a key value. It consists of one or two bytes.
+ * @author Villu Ruusmann
+ */
+ public static class Key
+ {
+ private int[] value = null;
+
+ /**
+ * Constructor.
+ * @param b0 the one byte value
+ */
+ public Key(int b0)
+ {
+ this(new int[] { b0 });
+ }
+
+ /**
+ * Constructor.
+ * @param b0 the first byte of a two byte value
+ * @param b1 the second byte of a two byte value
+ */
+ public Key(int b0, int b1)
+ {
+ this(new int[] { b0, b1 });
+ }
+
+ private Key(int[] value)
+ {
+ setValue(value);
+ }
+
+ /**
+ * Returns the value of the key.
+ * @return the value
+ */
+ public int[] getValue()
+ {
+ return value;
+ }
+
+ private void setValue(int[] value)
+ {
+ this.value = value;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString()
+ {
+ return Arrays.toString(getValue());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode()
+ {
+ return Arrays.hashCode(getValue());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object object)
+ {
+ if (object instanceof Key)
+ {
+ Key that = (Key) object;
+ return Arrays.equals(getValue(), that.getValue());
+ }
+ return false;
+ }
+ }
+
+ private static final Map<CFFOperator.Key, CFFOperator> keyMap = new LinkedHashMap<>(52);
+ private static final Map<String, CFFOperator> nameMap = new LinkedHashMap<>(52);
+
+ static
+ {
+ // Top DICT
+ register(new Key(0), "version");
+ register(new Key(1), "Notice");
+ register(new Key(12, 0), "Copyright");
+ register(new Key(2), "FullName");
+ register(new Key(3), "FamilyName");
+ register(new Key(4), "Weight");
+ register(new Key(12, 1), "isFixedPitch");
+ register(new Key(12, 2), "ItalicAngle");
+ register(new Key(12, 3), "UnderlinePosition");
+ register(new Key(12, 4), "UnderlineThickness");
+ register(new Key(12, 5), "PaintType");
+ register(new Key(12, 6), "CharstringType");
+ register(new Key(12, 7), "FontMatrix");
+ register(new Key(13), "UniqueID");
+ register(new Key(5), "FontBBox");
+ register(new Key(12, 8), "StrokeWidth");
+ register(new Key(14), "XUID");
+ register(new Key(15), "charset");
+ register(new Key(16), "Encoding");
+ register(new Key(17), "CharStrings");
+ register(new Key(18), "Private");
+ register(new Key(12, 20), "SyntheticBase");
+ register(new Key(12, 21), "PostScript");
+ register(new Key(12, 22), "BaseFontName");
+ register(new Key(12, 23), "BaseFontBlend");
+ register(new Key(12, 30), "ROS");
+ register(new Key(12, 31), "CIDFontVersion");
+ register(new Key(12, 32), "CIDFontRevision");
+ register(new Key(12, 33), "CIDFontType");
+ register(new Key(12, 34), "CIDCount");
+ register(new Key(12, 35), "UIDBase");
+ register(new Key(12, 36), "FDArray");
+ register(new Key(12, 37), "FDSelect");
+ register(new Key(12, 38), "FontName");
+
+ // Private DICT
+ register(new Key(6), "BlueValues");
+ register(new Key(7), "OtherBlues");
+ register(new Key(8), "FamilyBlues");
+ register(new Key(9), "FamilyOtherBlues");
+ register(new Key(12, 9), "BlueScale");
+ register(new Key(12, 10), "BlueShift");
+ register(new Key(12, 11), "BlueFuzz");
+ register(new Key(10), "StdHW");
+ register(new Key(11), "StdVW");
+ register(new Key(12, 12), "StemSnapH");
+ register(new Key(12, 13), "StemSnapV");
+ register(new Key(12, 14), "ForceBold");
+ register(new Key(12, 15), "LanguageGroup");
+ register(new Key(12, 16), "ExpansionFactor");
+ register(new Key(12, 17), "initialRandomSeed");
+ register(new Key(19), "Subrs");
+ register(new Key(20), "defaultWidthX");
+ register(new Key(21), "nominalWidthX");
+ }
+}
Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java Wed Dec 23 10:45:50 2020
@@ -1240,7 +1240,7 @@ public class CFFParser
*/
private static class Entry
{
- private List<Number> operands = new ArrayList<>();
+ private final List<Number> operands = new ArrayList<>();
private CFFOperator operator = null;
public Number getNumber(int index)
Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/DataOutput.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/DataOutput.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/DataOutput.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/DataOutput.java Wed Dec 23 10:45:50 2020
@@ -1,116 +1,116 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.fontbox.cff;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-/**
- * @author Villu Ruusmann
- */
-public class DataOutput
-{
-
- private ByteArrayOutputStream outputBuffer = new ByteArrayOutputStream();
-
- private String outputEncoding = null;
-
- /**
- * Constructor.
- */
- public DataOutput()
- {
- this("ISO-8859-1");
- }
-
- /**
- * Constructor with a given encoding.
- * @param encoding the encoding to be used for writing
- */
- public DataOutput(String encoding)
- {
- this.outputEncoding = encoding;
- }
-
- /**
- * Returns the written data buffer as byte array.
- * @return the data buffer as byte array
- */
- public byte[] getBytes()
- {
- return outputBuffer.toByteArray();
- }
-
- /**
- * Write an int value to the buffer.
- * @param value the given value
- */
- public void write(int value)
- {
- outputBuffer.write(value);
- }
-
- /**
- * Write a byte array to the buffer.
- * @param buffer the given byte array
- */
- public void write(byte[] buffer)
- {
- outputBuffer.write(buffer, 0, buffer.length);
- }
-
- /**
- * Write a part of a byte array to the buffer.
- * @param buffer the given byte buffer
- * @param offset the offset where to start
- * @param length the amount of bytes to be written from the array
- */
- public void write(byte[] buffer, int offset, int length)
- {
- outputBuffer.write(buffer, offset, length);
- }
-
- /**
- * Write the given string to the buffer using the given encoding.
- * @param string the given string
- * @throws IOException If an error occurs during writing the data to the buffer
- */
- public void print(String string) throws IOException
- {
- write(string.getBytes(outputEncoding));
- }
-
- /**
- * Write the given string to the buffer using the given encoding.
- * A newline is added after the given string
- * @param string the given string
- * @throws IOException If an error occurs during writing the data to the buffer
- */
- public void println(String string) throws IOException
- {
- write(string.getBytes(outputEncoding));
- write('\n');
- }
-
- /**
- * Add a newline to the given string.
- */
- public void println()
- {
- write('\n');
- }
-}
\ No newline at end of file
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.fontbox.cff;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+/**
+ * @author Villu Ruusmann
+ */
+public class DataOutput
+{
+
+ private final ByteArrayOutputStream outputBuffer = new ByteArrayOutputStream();
+
+ private String outputEncoding = null;
+
+ /**
+ * Constructor.
+ */
+ public DataOutput()
+ {
+ this("ISO-8859-1");
+ }
+
+ /**
+ * Constructor with a given encoding.
+ * @param encoding the encoding to be used for writing
+ */
+ public DataOutput(String encoding)
+ {
+ this.outputEncoding = encoding;
+ }
+
+ /**
+ * Returns the written data buffer as byte array.
+ * @return the data buffer as byte array
+ */
+ public byte[] getBytes()
+ {
+ return outputBuffer.toByteArray();
+ }
+
+ /**
+ * Write an int value to the buffer.
+ * @param value the given value
+ */
+ public void write(int value)
+ {
+ outputBuffer.write(value);
+ }
+
+ /**
+ * Write a byte array to the buffer.
+ * @param buffer the given byte array
+ */
+ public void write(byte[] buffer)
+ {
+ outputBuffer.write(buffer, 0, buffer.length);
+ }
+
+ /**
+ * Write a part of a byte array to the buffer.
+ * @param buffer the given byte buffer
+ * @param offset the offset where to start
+ * @param length the amount of bytes to be written from the array
+ */
+ public void write(byte[] buffer, int offset, int length)
+ {
+ outputBuffer.write(buffer, offset, length);
+ }
+
+ /**
+ * Write the given string to the buffer using the given encoding.
+ * @param string the given string
+ * @throws IOException If an error occurs during writing the data to the buffer
+ */
+ public void print(String string) throws IOException
+ {
+ write(string.getBytes(outputEncoding));
+ }
+
+ /**
+ * Write the given string to the buffer using the given encoding.
+ * A newline is added after the given string
+ * @param string the given string
+ * @throws IOException If an error occurs during writing the data to the buffer
+ */
+ public void println(String string) throws IOException
+ {
+ write(string.getBytes(outputEncoding));
+ write('\n');
+ }
+
+ /**
+ * Add a newline to the given string.
+ */
+ public void println()
+ {
+ write('\n');
+ }
+}
Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type1CharString.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type1CharString.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type1CharString.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type1CharString.java Wed Dec 23 10:45:50 2020
@@ -41,7 +41,7 @@ public class Type1CharString
{
private static final Log LOG = LogFactory.getLog(Type1CharString.class);
- private Type1CharStringReader font;
+ private final Type1CharStringReader font;
private final String fontName;
private final String glyphName;
private GeneralPath path = null;
Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java Wed Dec 23 10:45:50 2020
@@ -733,7 +733,7 @@ public class CMapParser
*/
private static final class LiteralName
{
- private String name;
+ private final String name;
private LiteralName(String theName)
{
@@ -746,7 +746,7 @@ public class CMapParser
*/
private static final class Operator
{
- private String op;
+ private final String op;
private Operator(String theOp)
{
Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/encoding/Encoding.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/encoding/Encoding.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/encoding/Encoding.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/encoding/Encoding.java Wed Dec 23 10:45:50 2020
@@ -30,12 +30,12 @@ public abstract class Encoding
/**
* This is a mapping from a character code to a character name.
*/
- protected Map<Integer,String> codeToName = new HashMap<>(250);
+ protected final Map<Integer,String> codeToName = new HashMap<>(250);
/**
* This is a mapping from a character name to a character code.
*/
- protected Map<String,Integer> nameToCode = new HashMap<>(250);
+ protected final Map<String,Integer> nameToCode = new HashMap<>(250);
/**
* This will add a character encoding.
Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphRenderer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphRenderer.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphRenderer.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphRenderer.java Wed Dec 23 10:45:50 2020
@@ -1,222 +1,222 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.fontbox.ttf;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.awt.geom.GeneralPath;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * This class provides a glyph to GeneralPath conversion for true type fonts.
- * Based on code from Apache Batik, a subproject of Apache XMLGraphics.
- *
- * @see
- * <a href="http://xmlgraphics.apache.org/batik">http://xmlgraphics.apache.org/batik</a>
- *
- * Contour rendering ported from PDF.js, viewed on 14.2.2015, rev 2e97c0d
- *
- * @see
- * <a href="https://github.com/mozilla/pdf.js/blob/c0d17013a28ee7aa048831560b6494a26c52360c/src/core/font_renderer.js">pdf.js/src/core/font_renderer.js</a>
- *
- */
-class GlyphRenderer
-{
- private static final Log LOG = LogFactory.getLog(GlyphRenderer.class);
-
- private GlyphDescription glyphDescription;
-
- GlyphRenderer(GlyphDescription glyphDescription)
- {
- this.glyphDescription = glyphDescription;
- }
-
- /**
- * Returns the path of the glyph.
- * @return the path
- */
- public GeneralPath getPath()
- {
- Point[] points = describe(glyphDescription);
- return calculatePath(points);
- }
-
- /**
- * Set the points of a glyph from the GlyphDescription.
- */
- private Point[] describe(GlyphDescription gd)
- {
- int endPtIndex = 0;
- int endPtOfContourIndex = -1;
- Point[] points = new Point[gd.getPointCount()];
- for (int i = 0; i < gd.getPointCount(); i++)
- {
- if (endPtOfContourIndex == -1)
- {
- endPtOfContourIndex = gd.getEndPtOfContours(endPtIndex);
- }
- boolean endPt = endPtOfContourIndex == i;
- if (endPt)
- {
- endPtIndex++;
- endPtOfContourIndex = -1;
- }
- points[i] = new Point(gd.getXCoordinate(i), gd.getYCoordinate(i),
- (gd.getFlags(i) & GlyfDescript.ON_CURVE) != 0, endPt);
- }
- return points;
- }
-
- /**
- * Use the given points to calculate a GeneralPath.
- *
- * @param points the points to be used to generate the GeneralPath
- *
- * @return the calculated GeneralPath
- */
- private GeneralPath calculatePath(Point[] points)
- {
- GeneralPath path = new GeneralPath();
- int start = 0;
- for (int p = 0, len = points.length; p < len; ++p)
- {
- if (points[p].endOfContour)
- {
- Point firstPoint = points[start];
- Point lastPoint = points[p];
- List<Point> contour = new ArrayList<>();
- for (int q = start; q <= p; ++q)
- {
- contour.add(points[q]);
- }
- if (points[start].onCurve)
- {
- // using start point at the contour end
- contour.add(firstPoint);
- }
- else if (points[p].onCurve)
- {
- // first is off-curve point, trying to use one from the end
- contour.add(0, lastPoint);
- }
- else
- {
- // start and end are off-curve points, creating implicit one
- Point pmid = midValue(firstPoint, lastPoint);
- contour.add(0, pmid);
- contour.add(pmid);
- }
- moveTo(path, contour.get(0));
- for (int j = 1, clen = contour.size(); j < clen; j++)
- {
- Point pnow = contour.get(j);
- if (pnow.onCurve)
- {
- lineTo(path, pnow);
- }
- else if (contour.get(j + 1).onCurve)
- {
- quadTo(path, pnow, contour.get(j + 1));
- ++j;
- }
- else
- {
- quadTo(path, pnow, midValue(pnow, contour.get(j + 1)));
- }
- }
- path.closePath();
- start = p + 1;
- }
- }
- return path;
- }
-
- private void moveTo(GeneralPath path, Point point)
- {
- path.moveTo(point.x, point.y);
- if (LOG.isDebugEnabled())
- {
- LOG.trace("moveTo: " + String.format(Locale.US, "%d,%d", point.x, point.y));
- }
- }
-
- private void lineTo(GeneralPath path, Point point)
- {
- path.lineTo(point.x, point.y);
- if (LOG.isDebugEnabled())
- {
- LOG.trace("lineTo: " + String.format(Locale.US, "%d,%d", point.x, point.y));
- }
- }
-
- private void quadTo(GeneralPath path, Point ctrlPoint, Point point)
- {
- path.quadTo(ctrlPoint.x, ctrlPoint.y, point.x, point.y);
- if (LOG.isDebugEnabled())
- {
- LOG.trace("quadTo: " + String.format(Locale.US, "%d,%d %d,%d", ctrlPoint.x, ctrlPoint.y,
- point.x, point.y));
- }
- }
-
- private int midValue(int a, int b)
- {
- return a + (b - a) / 2;
- }
-
- // this creates an onCurve point that is between point1 and point2
- private Point midValue(Point point1, Point point2)
- {
- return new Point(midValue(point1.x, point2.x), midValue(point1.y, point2.y));
- }
-
- /**
- * This class represents one point of a glyph.
- */
- private static class Point
- {
- private int x = 0;
- private int y = 0;
- private boolean onCurve = true;
- private boolean endOfContour = false;
-
- Point(int xValue, int yValue, boolean onCurveValue, boolean endOfContourValue)
- {
- x = xValue;
- y = yValue;
- onCurve = onCurveValue;
- endOfContour = endOfContourValue;
- }
-
- // this constructs an on-curve, non-endofcountour point
- Point(int xValue, int yValue)
- {
- this(xValue, yValue, true, false);
- }
-
- @Override
- public String toString()
- {
- return String.format(Locale.US, "Point(%d,%d,%s,%s)", x, y, onCurve ? "onCurve" : "",
- endOfContour ? "endOfContour" : "");
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.fontbox.ttf;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.awt.geom.GeneralPath;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * This class provides a glyph to GeneralPath conversion for true type fonts.
+ * Based on code from Apache Batik, a subproject of Apache XMLGraphics.
+ *
+ * @see
+ * <a href="http://xmlgraphics.apache.org/batik">http://xmlgraphics.apache.org/batik</a>
+ *
+ * Contour rendering ported from PDF.js, viewed on 14.2.2015, rev 2e97c0d
+ *
+ * @see
+ * <a href="https://github.com/mozilla/pdf.js/blob/c0d17013a28ee7aa048831560b6494a26c52360c/src/core/font_renderer.js">pdf.js/src/core/font_renderer.js</a>
+ *
+ */
+class GlyphRenderer
+{
+ private static final Log LOG = LogFactory.getLog(GlyphRenderer.class);
+
+ private final GlyphDescription glyphDescription;
+
+ GlyphRenderer(GlyphDescription glyphDescription)
+ {
+ this.glyphDescription = glyphDescription;
+ }
+
+ /**
+ * Returns the path of the glyph.
+ * @return the path
+ */
+ public GeneralPath getPath()
+ {
+ Point[] points = describe(glyphDescription);
+ return calculatePath(points);
+ }
+
+ /**
+ * Set the points of a glyph from the GlyphDescription.
+ */
+ private Point[] describe(GlyphDescription gd)
+ {
+ int endPtIndex = 0;
+ int endPtOfContourIndex = -1;
+ Point[] points = new Point[gd.getPointCount()];
+ for (int i = 0; i < gd.getPointCount(); i++)
+ {
+ if (endPtOfContourIndex == -1)
+ {
+ endPtOfContourIndex = gd.getEndPtOfContours(endPtIndex);
+ }
+ boolean endPt = endPtOfContourIndex == i;
+ if (endPt)
+ {
+ endPtIndex++;
+ endPtOfContourIndex = -1;
+ }
+ points[i] = new Point(gd.getXCoordinate(i), gd.getYCoordinate(i),
+ (gd.getFlags(i) & GlyfDescript.ON_CURVE) != 0, endPt);
+ }
+ return points;
+ }
+
+ /**
+ * Use the given points to calculate a GeneralPath.
+ *
+ * @param points the points to be used to generate the GeneralPath
+ *
+ * @return the calculated GeneralPath
+ */
+ private GeneralPath calculatePath(Point[] points)
+ {
+ GeneralPath path = new GeneralPath();
+ int start = 0;
+ for (int p = 0, len = points.length; p < len; ++p)
+ {
+ if (points[p].endOfContour)
+ {
+ Point firstPoint = points[start];
+ Point lastPoint = points[p];
+ List<Point> contour = new ArrayList<>();
+ for (int q = start; q <= p; ++q)
+ {
+ contour.add(points[q]);
+ }
+ if (points[start].onCurve)
+ {
+ // using start point at the contour end
+ contour.add(firstPoint);
+ }
+ else if (points[p].onCurve)
+ {
+ // first is off-curve point, trying to use one from the end
+ contour.add(0, lastPoint);
+ }
+ else
+ {
+ // start and end are off-curve points, creating implicit one
+ Point pmid = midValue(firstPoint, lastPoint);
+ contour.add(0, pmid);
+ contour.add(pmid);
+ }
+ moveTo(path, contour.get(0));
+ for (int j = 1, clen = contour.size(); j < clen; j++)
+ {
+ Point pnow = contour.get(j);
+ if (pnow.onCurve)
+ {
+ lineTo(path, pnow);
+ }
+ else if (contour.get(j + 1).onCurve)
+ {
+ quadTo(path, pnow, contour.get(j + 1));
+ ++j;
+ }
+ else
+ {
+ quadTo(path, pnow, midValue(pnow, contour.get(j + 1)));
+ }
+ }
+ path.closePath();
+ start = p + 1;
+ }
+ }
+ return path;
+ }
+
+ private void moveTo(GeneralPath path, Point point)
+ {
+ path.moveTo(point.x, point.y);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.trace("moveTo: " + String.format(Locale.US, "%d,%d", point.x, point.y));
+ }
+ }
+
+ private void lineTo(GeneralPath path, Point point)
+ {
+ path.lineTo(point.x, point.y);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.trace("lineTo: " + String.format(Locale.US, "%d,%d", point.x, point.y));
+ }
+ }
+
+ private void quadTo(GeneralPath path, Point ctrlPoint, Point point)
+ {
+ path.quadTo(ctrlPoint.x, ctrlPoint.y, point.x, point.y);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.trace("quadTo: " + String.format(Locale.US, "%d,%d %d,%d", ctrlPoint.x, ctrlPoint.y,
+ point.x, point.y));
+ }
+ }
+
+ private int midValue(int a, int b)
+ {
+ return a + (b - a) / 2;
+ }
+
+ // this creates an onCurve point that is between point1 and point2
+ private Point midValue(Point point1, Point point2)
+ {
+ return new Point(midValue(point1.x, point2.x), midValue(point1.y, point2.y));
+ }
+
+ /**
+ * This class represents one point of a glyph.
+ */
+ private static class Point
+ {
+ private int x = 0;
+ private int y = 0;
+ private boolean onCurve = true;
+ private boolean endOfContour = false;
+
+ Point(int xValue, int yValue, boolean onCurveValue, boolean endOfContourValue)
+ {
+ x = xValue;
+ y = yValue;
+ onCurve = onCurveValue;
+ endOfContour = endOfContourValue;
+ }
+
+ // this constructs an on-curve, non-endofcountour point
+ Point(int xValue, int yValue)
+ {
+ this(xValue, yValue, true, false);
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.format(Locale.US, "Point(%d,%d,%s,%s)", x, y, onCurve ? "onCurve" : "",
+ endOfContour ? "endOfContour" : "");
+ }
+ }
+
+}
Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TrueTypeFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TrueTypeFont.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TrueTypeFont.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TrueTypeFont.java Wed Dec 23 10:45:50 2020
@@ -47,7 +47,7 @@ public class TrueTypeFont implements Fon
private float version;
private int numberOfGlyphs = -1;
private int unitsPerEm = -1;
- protected Map<String,TTFTable> tables = new HashMap<>();
+ protected final Map<String,TTFTable> tables = new HashMap<>();
private final TTFDataStream data;
private volatile Map<String, Integer> postScriptNames;
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java Wed Dec 23 10:45:50 2020
@@ -92,7 +92,7 @@ public class COSDocument extends COSBase
*/
private long highestXRefObjectNumber;
- private ICOSParser parser;
+ private final ICOSParser parser;
/**
* Constructor. Uses main memory to buffer PDF streams.
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessReadBufferedFile.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessReadBufferedFile.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessReadBufferedFile.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessReadBufferedFile.java Wed Dec 23 10:45:50 2020
@@ -34,10 +34,10 @@ import java.util.Map;
*/
public class RandomAccessReadBufferedFile implements RandomAccessRead
{
- private int pageSizeShift = 12;
- private int pageSize = 1 << pageSizeShift;
- private long pageOffsetMask = -1L << pageSizeShift;
- private int maxCachedPages = 1000;
+ private final int pageSizeShift = 12;
+ private final int pageSize = 1 << pageSizeShift;
+ private final long pageOffsetMask = -1L << pageSizeShift;
+ private final int maxCachedPages = 1000;
private ByteBuffer lastRemovedCachePage = null;
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PageExtractor.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PageExtractor.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PageExtractor.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PageExtractor.java Wed Dec 23 10:45:50 2020
@@ -27,7 +27,7 @@ import org.apache.pdfbox.pdmodel.PDPage;
*/
public class PageExtractor
{
- private PDDocument sourceDocument;
+ private final PDDocument sourceDocument;
// first page to extract is page 1 (by default)
private int startPage = 1;
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabelRange.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabelRange.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabelRange.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabelRange.java Wed Dec 23 10:45:50 2020
@@ -30,7 +30,7 @@ import org.apache.pdfbox.cos.COSName;
public class PDPageLabelRange implements COSObjectable
{
- private COSDictionary root;
+ private final COSDictionary root;
// Page label dictionary (PDF32000-1:2008 Section 12.4.2, Table 159)
private static final COSName KEY_START = COSName.ST;
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java Wed Dec 23 10:45:50 2020
@@ -42,9 +42,9 @@ import org.apache.pdfbox.pdmodel.PDDocum
public class PDPageLabels implements COSObjectable
{
- private Map<Integer, PDPageLabelRange> labels;
+ private final Map<Integer, PDPageLabelRange> labels;
- private PDDocument doc;
+ private final PDDocument doc;
/**
* Creates an empty page label dictionary for the given document.
@@ -413,4 +413,4 @@ public class PDPageLabels implements COS
throw new UnsupportedOperationException();
}
}
-}
\ No newline at end of file
+}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRange.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRange.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRange.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRange.java Wed Dec 23 10:45:50 2020
@@ -28,7 +28,7 @@ import org.apache.pdfbox.cos.COSNumber;
*/
public class PDRange implements COSObjectable
{
- private COSArray rangeArray;
+ private final COSArray rangeArray;
private int startingIndex;
/**
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDParentTreeValue.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDParentTreeValue.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDParentTreeValue.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDParentTreeValue.java Wed Dec 23 10:45:50 2020
@@ -29,7 +29,7 @@ import org.apache.pdfbox.pdmodel.common.
*/
public class PDParentTreeValue implements COSObjectable
{
- COSObjectable obj;
+ final COSObjectable obj;
public PDParentTreeValue(COSArray obj)
{
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/StandardStructureTypes.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/StandardStructureTypes.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/StandardStructureTypes.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/StandardStructureTypes.java Wed Dec 23 10:45:50 2020
@@ -292,7 +292,7 @@ public class StandardStructureTypes
/**
* All standard structure types.
*/
- public static List<String> types = new ArrayList<>();
+ public static final List<String> types = new ArrayList<>();
static
{
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java Wed Dec 23 10:45:50 2020
@@ -99,7 +99,7 @@ public abstract class FDFAnnotation impl
/**
* Annotation dictionary.
*/
- protected COSDictionary annot;
+ protected final COSDictionary annot;
/**
* Default constructor.
@@ -1021,4 +1021,4 @@ public abstract class FDFAnnotation impl
return String.format("<%s%s>%s</%s>", node.getNodeName(), builder.toString(),
subString, node.getNodeName());
}
-}
\ No newline at end of file
+}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFCatalog.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFCatalog.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFCatalog.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFCatalog.java Wed Dec 23 10:45:50 2020
@@ -32,7 +32,7 @@ import org.w3c.dom.Element;
*/
public class FDFCatalog implements COSObjectable
{
- private COSDictionary catalog;
+ private final COSDictionary catalog;
/**
* Default constructor.
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDictionary.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDictionary.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDictionary.java Wed Dec 23 10:45:50 2020
@@ -46,7 +46,7 @@ public class FDFDictionary implements CO
private static final Log LOG = LogFactory.getLog(FDFDictionary.class);
- private COSDictionary fdf;
+ private final COSDictionary fdf;
/**
* Default constructor.
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java Wed Dec 23 10:45:50 2020
@@ -41,7 +41,7 @@ import org.w3c.dom.Element;
*/
public class FDFDocument implements Closeable
{
- private COSDocument document;
+ private final COSDocument document;
/**
* Constructor, creates a new FDF document.
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFField.java Wed Dec 23 10:45:50 2020
@@ -46,7 +46,7 @@ import org.w3c.dom.NodeList;
*/
public class FDFField implements COSObjectable
{
- private COSDictionary field;
+ private final COSDictionary field;
/**
* Default constructor.
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFIconFit.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFIconFit.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFIconFit.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFIconFit.java Wed Dec 23 10:45:50 2020
@@ -29,7 +29,7 @@ import org.apache.pdfbox.pdmodel.common.
*/
public class FDFIconFit implements COSObjectable
{
- private COSDictionary fit;
+ private final COSDictionary fit;
/**
* A scale option.
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/AbstractFixup.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/AbstractFixup.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/AbstractFixup.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/AbstractFixup.java Wed Dec 23 10:45:50 2020
@@ -1,29 +1,29 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pdfbox.pdmodel.fixup;
-
-import org.apache.pdfbox.pdmodel.PDDocument;
-
-public abstract class AbstractFixup implements PDDocumentFixup
-{
- protected PDDocument document;
-
- protected AbstractFixup(PDDocument document)
- {
- this.document = document;
- }
-}
\ No newline at end of file
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.pdmodel.fixup;
+
+import org.apache.pdfbox.pdmodel.PDDocument;
+
+public abstract class AbstractFixup implements PDDocumentFixup
+{
+ protected final PDDocument document;
+
+ protected AbstractFixup(PDDocument document)
+ {
+ this.document = document;
+ }
+}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AbstractProcessor.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AbstractProcessor.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AbstractProcessor.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AbstractProcessor.java Wed Dec 23 10:45:50 2020
@@ -1,29 +1,29 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pdfbox.pdmodel.fixup.processor;
-
-import org.apache.pdfbox.pdmodel.PDDocument;
-
-public abstract class AbstractProcessor implements PDDocumentProcessor
-{
- protected PDDocument document;
-
- protected AbstractProcessor(PDDocument document)
- {
- this.document = document;
- }
-}
\ No newline at end of file
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.pdmodel.fixup.processor;
+
+import org.apache.pdfbox.pdmodel.PDDocument;
+
+public abstract class AbstractProcessor implements PDDocumentProcessor
+{
+ protected final PDDocument document;
+
+ protected AbstractProcessor(PDDocument document)
+ {
+ this.document = document;
+ }
+}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/CMapManager.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/CMapManager.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/CMapManager.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/CMapManager.java Wed Dec 23 10:45:50 2020
@@ -1,79 +1,79 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pdfbox.pdmodel.font;
-
-import org.apache.fontbox.cmap.CMap;
-import org.apache.fontbox.cmap.CMapParser;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * CMap resource loader and cache.
- */
-final class CMapManager
-{
- static Map<String, CMap> cMapCache =
- Collections.synchronizedMap(new HashMap<String, CMap>());
-
- private CMapManager()
- {
- }
-
- /**
- * Fetches the predefined CMap from disk (or cache).
- *
- * @param cMapName CMap name
- * @return The predefined CMap, never null.
- * @throws IOException
- */
- public static CMap getPredefinedCMap(String cMapName) throws IOException
- {
- CMap cmap = cMapCache.get(cMapName);
- if (cmap != null)
- {
- return cmap;
- }
-
- CMapParser parser = new CMapParser();
- CMap targetCmap = parser.parsePredefined(cMapName);
-
- // limit the cache to predefined CMaps
- cMapCache.put(targetCmap.getName(), targetCmap);
- return targetCmap;
- }
-
- /**
- * Parse the given CMap.
- *
- * @param cMapStream the CMap to be read
- * @return the parsed CMap
- */
- public static CMap parseCMap(InputStream cMapStream) throws IOException
- {
- CMap targetCmap = null;
- if (cMapStream != null)
- {
- CMapParser parser = new CMapParser();
- targetCmap = parser.parse(cMapStream);
- }
- return targetCmap;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.pdmodel.font;
+
+import org.apache.fontbox.cmap.CMap;
+import org.apache.fontbox.cmap.CMapParser;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * CMap resource loader and cache.
+ */
+final class CMapManager
+{
+ static final Map<String, CMap> cMapCache =
+ Collections.synchronizedMap(new HashMap<String, CMap>());
+
+ private CMapManager()
+ {
+ }
+
+ /**
+ * Fetches the predefined CMap from disk (or cache).
+ *
+ * @param cMapName CMap name
+ * @return The predefined CMap, never null.
+ * @throws IOException
+ */
+ public static CMap getPredefinedCMap(String cMapName) throws IOException
+ {
+ CMap cmap = cMapCache.get(cMapName);
+ if (cmap != null)
+ {
+ return cmap;
+ }
+
+ CMapParser parser = new CMapParser();
+ CMap targetCmap = parser.parsePredefined(cMapName);
+
+ // limit the cache to predefined CMaps
+ cMapCache.put(targetCmap.getName(), targetCmap);
+ return targetCmap;
+ }
+
+ /**
+ * Parse the given CMap.
+ *
+ * @param cMapStream the CMap to be read
+ * @return the parsed CMap
+ */
+ public static CMap parseCMap(InputStream cMapStream) throws IOException
+ {
+ CMap targetCmap = null;
+ if (cMapStream != null)
+ {
+ CMapParser parser = new CMapParser();
+ targetCmap = parser.parse(cMapStream);
+ }
+ return targetCmap;
+ }
+}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java Wed Dec 23 10:45:50 2020
@@ -53,7 +53,7 @@ public abstract class PDCIDFont implemen
private final Map<Integer, Float> verticalDisplacementY = new HashMap<>(); // w1y
private final Map<Integer, Vector> positionVectors = new HashMap<>(); // v
- private float[] dw2 = new float[] { 880, -1000 };
+ private final float[] dw2 = new float[] { 880, -1000 };
protected final COSDictionary dict;
private PDFontDescriptor fontDescriptor;
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java?rev=1884743&r1=1884742&r2=1884743&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCIEDictionaryBasedColorSpace.java Wed Dec 23 10:45:50 2020
@@ -30,7 +30,7 @@ import org.apache.pdfbox.cos.COSName;
*/
public abstract class PDCIEDictionaryBasedColorSpace extends PDCIEBasedColorSpace
{
- protected COSDictionary dictionary;
+ protected final COSDictionary dictionary;
private static final ColorSpace CIEXYZ = ColorSpace.getInstance(ColorSpace.CS_CIEXYZ);