/** * Updates current transformation matrix. * * @param newCtm new current transformation matrix. */ public void updateCtm(Matrix newCtm) { ctm = newCtm.multiply(ctm); }
/** * Used for creating sub-TextRenderInfos for each individual character * * @param parent the parent TextRenderInfo * @param str the content of a TextRenderInfo * @param horizontalOffset the unscaled horizontal offset of the character that this TextRenderInfo represents */ private TextRenderInfo(TextRenderInfo parent, PdfString str, float horizontalOffset) { super(parent.gs); this.string = str; Matrix offsetMatrix = new Matrix(horizontalOffset, 0); this.textToUserSpaceTransformMatrix = offsetMatrix.multiply(parent.textToUserSpaceTransformMatrix); this.textMatrix = offsetMatrix.multiply(parent.textMatrix); this.canvasTagHierarchy = parent.canvasTagHierarchy; this.fontMatrix = parent.gs.getFont().getFontMatrix(); }
/** * {@inheritDoc} */ public void invoke(PdfCanvasProcessor processor, PdfLiteral operator, List<PdfObject> operands) { float tx = ((PdfNumber) operands.get(0)).floatValue(); float ty = ((PdfNumber) operands.get(1)).floatValue(); Matrix translationMatrix = new Matrix(tx, ty); processor.textMatrix = translationMatrix.multiply(processor.textLineMatrix); processor.textLineMatrix = processor.textMatrix; } }
/** * Creates a new TextRenderInfo object * * @param str the PDF string that should be displayed * @param gs the graphics state (note: at this time, this is not immutable, so don't cache it) * @param textMatrix the text matrix at the time of the render operation * @param canvasTagHierarchy the marked content tags sequence, if available */ public TextRenderInfo(PdfString str, CanvasGraphicsState gs, Matrix textMatrix, Stack<CanvasTag> canvasTagHierarchy) { super(gs); this.string = str; this.textToUserSpaceTransformMatrix = textMatrix.multiply(gs.getCtm()); this.textMatrix = textMatrix; this.canvasTagHierarchy = Collections.<CanvasTag>unmodifiableList(new ArrayList<>(canvasTagHierarchy)); this.fontMatrix = gs.getFont().getFontMatrix(); }
/** * Adjusts the text matrix for the specified adjustment value (see TJ operator in the PDF spec for information) * * @param tj the text adjustment */ private void applyTextAdjust(float tj) { float adjustBy = -tj / 1000f * getGraphicsState().getFontSize() * (getGraphicsState().getHorizontalScaling() / 100f); textMatrix = new Matrix(adjustBy, 0).multiply(textMatrix); }
/** * Displays text. * * @param string the text to display */ private void displayPdfString(PdfString string) { TextRenderInfo renderInfo = new TextRenderInfo(string, getGraphicsState(), textMatrix, markedContentStack); textMatrix = new Matrix(renderInfo.getUnscaledWidth(), 0).multiply(textMatrix); eventOccurred(renderInfo, EventType.RENDER_TEXT); }
currentMatrix = currentMatrix.multiply(toConcatenate); matrix = new PdfArray(new float[]{currentMatrix.get(0), currentMatrix.get(1), currentMatrix.get(3), currentMatrix.get(4), currentMatrix.get(6), currentMatrix.get(7)});
currentMatrix = currentMatrix.multiply(toConcatenate); matrix = new PdfArray(new float[]{currentMatrix.get(0), currentMatrix.get(1), currentMatrix.get(3), currentMatrix.get(4), currentMatrix.get(6), currentMatrix.get(7)});