You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2020/03/29 12:31:55 UTC
svn commit: r1875850 - in /pdfbox/branches/2.0:
examples/src/main/java/org/apache/pdfbox/examples/rendering/
examples/src/main/java/org/apache/pdfbox/examples/util/
pdfbox/src/main/java/org/apache/pdfbox/contentstream/
pdfbox/src/main/java/org/apache/p...
Author: lehmi
Date: Sun Mar 29 12:31:54 2020
New Revision: 1875850
URL: http://svn.apache.org/viewvc?rev=1875850&view=rev
Log:
PDFBOX-4804: remove no longer needed parameter
Modified:
pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/rendering/CustomGraphicsStreamEngine.java
pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/rendering/CustomPageDrawer.java
pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/DrawPrintTextLocations.java
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java
pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java
Modified: pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/rendering/CustomGraphicsStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/rendering/CustomGraphicsStreamEngine.java?rev=1875850&r1=1875849&r2=1875850&view=diff
==============================================================================
--- pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/rendering/CustomGraphicsStreamEngine.java (original)
+++ pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/rendering/CustomGraphicsStreamEngine.java Sun Mar 29 12:31:54 2020
@@ -186,11 +186,11 @@ public class CustomGraphicsStreamEngine
* Overridden from PDFStreamEngine.
*/
@Override
- protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, String unicode,
- Vector displacement) throws IOException
+ protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, Vector displacement)
+ throws IOException
{
- System.out.print(unicode);
- super.showGlyph(textRenderingMatrix, font, code, unicode, displacement);
+ System.out.print("showGlyph " + code);
+ super.showGlyph(textRenderingMatrix, font, code, displacement);
}
// NOTE: there are may more methods in PDFStreamEngine which can be overridden here too.
Modified: pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/rendering/CustomPageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/rendering/CustomPageDrawer.java?rev=1875850&r1=1875849&r2=1875850&view=diff
==============================================================================
--- pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/rendering/CustomPageDrawer.java (original)
+++ pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/rendering/CustomPageDrawer.java Sun Mar 29 12:31:54 2020
@@ -110,11 +110,11 @@ public class CustomPageDrawer
* Glyph bounding boxes.
*/
@Override
- protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, String unicode,
- Vector displacement) throws IOException
+ protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code,
+ Vector displacement) throws IOException
{
// draw glyph
- super.showGlyph(textRenderingMatrix, font, code, unicode, displacement);
+ super.showGlyph(textRenderingMatrix, font, code, displacement);
// bbox in EM -> user units
Shape bbox = new Rectangle2D.Float(0, 0, font.getWidth(code) / 1000, 1);
Modified: pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/DrawPrintTextLocations.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/DrawPrintTextLocations.java?rev=1875850&r1=1875849&r2=1875850&view=diff
==============================================================================
--- pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/DrawPrintTextLocations.java (original)
+++ pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/DrawPrintTextLocations.java Sun Mar 29 12:31:54 2020
@@ -118,9 +118,10 @@ public class DrawPrintTextLocations exte
}
@Override
- protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, String unicode, Vector displacement) throws IOException
+ protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, Vector displacement)
+ throws IOException
{
- super.showGlyph(textRenderingMatrix, font, code, unicode, displacement);
+ super.showGlyph(textRenderingMatrix, font, code, displacement);
// in cyan:
// show actual glyph bounds. This must be done here and not in writeString(),
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java?rev=1875850&r1=1875849&r2=1875850&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java Sun Mar 29 12:31:54 2020
@@ -706,7 +706,6 @@ public abstract class PDFStreamEngine
int before = in.available();
int code = font.readCode(in);
int codeLength = before - in.available();
- String unicode = font.toUnicode(code);
// Word spacing shall be applied to every occurrence of the single-byte character code
// 32 in a string when using a simple font or a composite font that defines code 32 as
@@ -739,7 +738,7 @@ public abstract class PDFStreamEngine
saveGraphicsState();
Matrix textMatrixOld = textMatrix;
Matrix textLineMatrixOld = textLineMatrix;
- showGlyph(textRenderingMatrix, font, code, unicode, w);
+ showGlyph(textRenderingMatrix, font, code, w);
textMatrix = textMatrixOld;
textLineMatrix = textLineMatrixOld;
restoreGraphicsState();
@@ -764,8 +763,8 @@ public abstract class PDFStreamEngine
}
/**
- * Called when a glyph is to be processed. This method is intended for overriding in subclasses,
- * the default implementation does nothing.
+ * Called when a glyph is to be processed. This method is intended for overriding in subclasses, the default
+ * implementation does nothing.
*
* @param textRenderingMatrix the current text rendering matrix, T<sub>rm</sub>
* @param font the current font
@@ -773,23 +772,43 @@ public abstract class PDFStreamEngine
* @param unicode the Unicode text for this glyph, or null if the PDF does provide it
* @param displacement the displacement (i.e. advance) of the glyph in text space
* @throws IOException if the glyph cannot be processed
+ *
+ * @deprecated use {@link #showGlyph(Matrix, PDFont, int, Vector)} instead
*/
- protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, String unicode,
- Vector displacement) throws IOException
+ protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code,
+ String unicode,
+ Vector displacement) throws IOException
{
if (font instanceof PDType3Font)
{
- showType3Glyph(textRenderingMatrix, (PDType3Font)font, code, unicode, displacement);
+ showType3Glyph(textRenderingMatrix, (PDType3Font) font, code, displacement);
}
else
{
- showFontGlyph(textRenderingMatrix, font, code, unicode, displacement);
+ showFontGlyph(textRenderingMatrix, font, code, displacement);
}
}
/**
- * Called when a glyph is to be processed. This method is intended for overriding in subclasses,
- * the default implementation does nothing.
+ * Called when a glyph is to be processed. This method is intended for overriding in subclasses, the default
+ * implementation does nothing.
+ *
+ * @param textRenderingMatrix the current text rendering matrix, T<sub>rm</sub>
+ * @param font the current font
+ * @param code internal PDF character code for the glyph
+ * @param displacement the displacement (i.e. advance) of the glyph in text space
+ * @throws IOException if the glyph cannot be processed
+ */
+ protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, Vector displacement)
+ throws IOException
+ {
+ // call deprecated method to ensure binary compatibility
+ showGlyph(textRenderingMatrix, font, code, null, displacement);
+ }
+
+ /**
+ * Called when a glyph is to be processed. This method is intended for overriding in subclasses, the default
+ * implementation does nothing.
*
* @param textRenderingMatrix the current text rendering matrix, T<sub>rm</sub>
* @param font the current font
@@ -797,14 +816,34 @@ public abstract class PDFStreamEngine
* @param unicode the Unicode text for this glyph, or null if the PDF does provide it
* @param displacement the displacement (i.e. advance) of the glyph in text space
* @throws IOException if the glyph cannot be processed
+ *
+ * @deprecated use {@link #showFontGlyph(Matrix, PDFont, int, Vector)} instead
*/
protected void showFontGlyph(Matrix textRenderingMatrix, PDFont font, int code, String unicode,
- Vector displacement) throws IOException
+ Vector displacement) throws IOException
{
// overridden in subclasses
}
/**
+ * Called when a glyph is to be processed. This method is intended for overriding in subclasses, the default
+ * implementation does nothing.
+ *
+ * @param textRenderingMatrix the current text rendering matrix, T<sub>rm</sub>
+ * @param font the current font
+ * @param code internal PDF character code for the glyph
+ * @param displacement the displacement (i.e. advance) of the glyph in text space
+ * @throws IOException if the glyph cannot be processed
+ */
+ protected void showFontGlyph(Matrix textRenderingMatrix, PDFont font, int code,
+ Vector displacement) throws IOException
+ {
+ // overridden in subclasses
+ // call deprecated method to ensure binary compatibility if not overridden
+ showFontGlyph(textRenderingMatrix, font, code, null, displacement);
+ }
+
+ /**
* Called when a glyph is to be processed. This method is intended for overriding in subclasses,
* the default implementation does nothing.
*
@@ -816,7 +855,7 @@ public abstract class PDFStreamEngine
* @throws IOException if the glyph cannot be processed
*/
protected void showType3Glyph(Matrix textRenderingMatrix, PDType3Font font, int code,
- String unicode, Vector displacement) throws IOException
+ String unicode, Vector displacement) throws IOException
{
PDType3CharProc charProc = font.getCharProc(code);
if (charProc != null)
@@ -826,6 +865,23 @@ public abstract class PDFStreamEngine
}
/**
+ * Called when a glyph is to be processed. This method is intended for overriding in subclasses, the default
+ * implementation does nothing.
+ *
+ * @param textRenderingMatrix the current text rendering matrix, T<sub>rm</sub>
+ * @param font the current font
+ * @param code internal PDF character code for the glyph
+ * @param displacement the displacement (i.e. advance) of the glyph in text space
+ * @throws IOException if the glyph cannot be processed
+ */
+ protected void showType3Glyph(Matrix textRenderingMatrix, PDType3Font font, int code,
+ Vector displacement) throws IOException
+ {
+ // call deprecated method to ensure binary compatibility if not overridden
+ showType3Glyph(textRenderingMatrix, font, code, null, displacement);
+ }
+
+ /**
* Called when a marked content group begins
*
* @param tag indicates the role or significance of the sequence
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1875850&r1=1875849&r2=1875850&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Sun Mar 29 12:31:54 2020
@@ -439,8 +439,8 @@ public class PageDrawer extends PDFGraph
}
@Override
- protected void showFontGlyph(Matrix textRenderingMatrix, PDFont font, int code, String unicode,
- Vector displacement) throws IOException
+ protected void showFontGlyph(Matrix textRenderingMatrix, PDFont font, int code,
+ Vector displacement) throws IOException
{
AffineTransform at = textRenderingMatrix.createAffineTransform();
at.concatenate(font.getFontMatrix().createAffineTransform());
@@ -517,13 +517,13 @@ public class PageDrawer extends PDFGraph
@Override
protected void showType3Glyph(Matrix textRenderingMatrix, PDType3Font font, int code,
- String unicode, Vector displacement) throws IOException
+ Vector displacement) throws IOException
{
PDGraphicsState state = getGraphicsState();
RenderingMode renderingMode = state.getTextState().getRenderingMode();
if (!RenderingMode.NEITHER.equals(renderingMode))
{
- super.showType3Glyph(textRenderingMatrix, font, code, unicode, displacement);
+ super.showType3Glyph(textRenderingMatrix, font, code, displacement);
}
}
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java?rev=1875850&r1=1875849&r2=1875850&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java Sun Mar 29 12:31:54 2020
@@ -144,8 +144,8 @@ class LegacyPDFStreamEngine extends PDFS
* written by Ben Litchfield for PDFStreamEngine.
*/
@Override
- protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, String unicode,
- Vector displacement) throws IOException
+ protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, Vector displacement)
+ throws IOException
{
//
// legacy calculations which were previously in PDFStreamEngine
@@ -295,7 +295,7 @@ class LegacyPDFStreamEngine extends PDFS
float spaceWidthDisplay = spaceWidthText * textRenderingMatrix.getScalingFactorX();
// use our additional glyph list for Unicode mapping
- unicode = font.toUnicode(code, glyphList);
+ String unicode = font.toUnicode(code, glyphList);
// when there is no Unicode mapping available, Acrobat simply coerces the character code
// into Unicode, so we do the same. Subclasses of PDFStreamEngine don't necessarily want
@@ -345,4 +345,5 @@ class LegacyPDFStreamEngine extends PDFS
{
// subclasses can override to provide specific functionality
}
+
}
Modified: pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java?rev=1875850&r1=1875849&r2=1875850&view=diff
==============================================================================
--- pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java (original)
+++ pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java Sun Mar 29 12:31:54 2020
@@ -315,7 +315,6 @@ public final class ExtractImages
protected void showGlyph(Matrix textRenderingMatrix,
PDFont font,
int code,
- String unicode,
Vector displacement) throws IOException
{
RenderingMode renderingMode = getGraphicsState().getTextState().getRenderingMode();