Skip to content

Commit 810e2b8

Browse files
committed
PDFBOX-5949: consider the font matrix when scaling
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1923658 13f79535-47bb-0310-9956-ffa450edef68
1 parent d2c4ac1 commit 810e2b8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDTextAppearanceHandler.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ private void drawNewParagraph(PDAnnotationText annotation, final PDAppearanceCon
386386
private void drawCrossHairs(PDAnnotationText annotation, final PDAppearanceContentStream contentStream)
387387
throws IOException
388388
{
389+
List<Number> fontMatrix = new PDType1Font(FontName.SYMBOL).getFontBoxFont().getFontMatrix();
390+
float xScale = (float) fontMatrix.get(0);
391+
float yScale = (float) fontMatrix.get(3);
392+
389393
PDRectangle bbox = adjustRectAndBBox(annotation, 20, 20);
390394

391395
float min = Math.min(bbox.getWidth(), bbox.getHeight());
@@ -395,7 +399,7 @@ private void drawCrossHairs(PDAnnotationText annotation, final PDAppearanceConte
395399
contentStream.setLineCapStyle(0);
396400
contentStream.setLineWidth(0.61f); // value from Adobe
397401

398-
contentStream.transform(Matrix.getScaleInstance(0.001f * min / 1.5f, 0.001f * min / 1.5f));
402+
contentStream.transform(Matrix.getScaleInstance(xScale * min * 1.3333f, yScale * min * 1.3333f));
399403
contentStream.transform(Matrix.getTranslateInstance(0, 50));
400404

401405
// we get the shape of a Symbol crosshair (0x2295) and use that one.

0 commit comments

Comments
 (0)