Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSNumber;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.graphics.state.PDTextState;

/**
* Tf: Set text font and size.
Expand Down Expand Up @@ -68,13 +69,14 @@ public void process(Operator operator, List<COSBase> arguments) throws IOExcepti
COSName fontName = (COSName) base0;
float fontSize = ((COSNumber) base1).floatValue();
PDFStreamEngine context = getContext();
context.getGraphicsState().getTextState().setFontSize(fontSize);
PDTextState textState = context.getGraphicsState().getTextState();
textState.setFontSize(fontSize);
PDFont font = context.getResources().getFont(fontName);
if (font == null)
{
LOG.warn("font '{}' not found in resources", fontName.getName());
}
context.getGraphicsState().getTextState().setFont(font);
textState.setFont(font);
}

@Override
Expand Down