/** * Transforms the segment by the specified matrix * @param m the matrix for the transformation * @return the transformed segment */ public LineSegment transformBy(Matrix m){ Vector newStart = startPoint.cross(m); Vector newEnd = endPoint.cross(m); return new LineSegment(newStart, newEnd); }
/** * @param as the location to compare to * @return true is this location is on the the same line as the other */ public boolean sameLine(ITextChunkLocation as) { if (orientationMagnitude() != as.orientationMagnitude()) { return false; } float distPerpendicularDiff = distPerpendicular() - as.distPerpendicular(); if (distPerpendicularDiff == 0) { return true; } LineSegment mySegment = new LineSegment(startLocation, endLocation); LineSegment otherSegment = new LineSegment(as.getStartLocation(), as.getEndLocation()); return Math.abs(distPerpendicularDiff) <= DIACRITICAL_MARKS_ALLOWED_VERTICAL_DEVIATION && (mySegment.getLength() == 0 || otherSegment.getLength() == 0); }
private LineSegment getUnscaledBaselineWithOffset(float yOffset) { checkGraphicsState(); // we need to correct the width so we don't have an extra character and word spaces at the end. The extra character and word spaces // are important for tracking relative text coordinate systems, but should not be part of the baseline String unicodeStr = string.toUnicodeString(); float correctedUnscaledWidth = getUnscaledWidth() - (gs.getCharSpacing() + (unicodeStr.length() > 0 && unicodeStr.charAt(unicodeStr.length() - 1) == ' ' ? gs.getWordSpacing() : 0)) * (gs.getHorizontalScaling() / 100f); return new LineSegment(new Vector(0, yOffset, 1), new Vector(correctedUnscaledWidth, yOffset, 1)); }
/** * @param height the height, in text space * @return the height in user space */ private float convertHeightFromTextSpaceToUserSpace(float height) { LineSegment textSpace = new LineSegment(new Vector(0, 0, 1), new Vector(0, height, 1)); LineSegment userSpace = textSpace.transformBy(textToUserSpaceTransformMatrix); return userSpace.getLength(); }
/** * @param width the width, in text space * @return the width in user space */ private float convertWidthFromTextSpaceToUserSpace(float width) { LineSegment textSpace = new LineSegment(new Vector(0, 0, 1), new Vector(width, 0, 1)); LineSegment userSpace = textSpace.transformBy(textToUserSpaceTransformMatrix); return userSpace.getLength(); }
Math.max(lastTextChunk.getLocation().getEndLocation().get(2), segment.getEndPoint().get(2))); TextChunk merged = new TextChunk(lastTextChunk.getText(), tclStrat.createLocation(renderInfo, new LineSegment(mergedStart, mergedEnd))); locationalResult.set(locationalResult.size() - 1, merged); } else {