Skip to content

Commit

Permalink
PDFBOX-5359: optimize
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1911458 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Aug 5, 2023
1 parent 4b30e16 commit d324b02
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,8 @@ protected void showText(byte[] string) throws IOException
fontSize * horizontalScaling, 0, // 0
0, fontSize, // 0
0, textState.getRise()); // 1

Matrix textMatrix = getGraphicsState().getTextMatrix();

// read the stream until it is empty
InputStream in = new ByteArrayInputStream(string);
Expand All @@ -743,7 +745,7 @@ protected void showText(byte[] string) throws IOException

// text rendering matrix (text space -> device space)
Matrix ctm = state.getCurrentTransformationMatrix();
Matrix textRenderingMatrix = parameters.multiply(getGraphicsState().getTextMatrix()).multiply(ctm);
Matrix textRenderingMatrix = parameters.multiply(textMatrix).multiply(ctm);

// get glyph's position vector if this is vertical text
// changes to vertical text should be tested with PDFBOX-2294 and PDFBOX-1422
Expand Down Expand Up @@ -777,7 +779,7 @@ protected void showText(byte[] string) throws IOException
}

// update the text matrix
getGraphicsState().getTextMatrix().translate(tx, ty);
textMatrix.translate(tx, ty);
}
}

Expand Down

0 comments on commit d324b02

Please sign in to comment.