Skip to content

Commit 63569c8

Browse files
committed
PDFBOX-6165: revert refactoring and set font size before getting the font
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1931701 13f79535-47bb-0310-9956-ffa450edef68
1 parent 3cf2410 commit 63569c8

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/text/SetFontAndSize.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ public void process(Operator operator, List<COSBase> arguments) throws IOExcepti
6969
COSName fontName = (COSName) base0;
7070
float fontSize = ((COSNumber) base1).floatValue();
7171
PDFStreamEngine context = getContext();
72+
PDTextState textState = context.getGraphicsState().getTextState();
73+
textState.setFontSize(fontSize);
74+
// Get the font after the size has been set in case there is an exception
75+
// so that PDFBox will use a default font
7276
PDFont font = context.getResources().getFont(fontName);
7377
if (font == null)
7478
{
7579
LOG.warn("font '{}' not found in resources", fontName.getName());
7680
}
77-
PDTextState textState = context.getGraphicsState().getTextState();
78-
textState.setFontSize(fontSize);
7981
textState.setFont(font);
8082
}
8183

0 commit comments

Comments
 (0)