From 5d435de8ba4147560a795f8873d234a0489050b2 Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Mon, 24 Feb 2020 14:58:14 +0200 Subject: [PATCH] Add line bounds to highlight bounds to get actual bounds. This fixes text clipping with italic font gitlab #475 Change-Id: I7223d6b7e960f28c61644ba7bc608b46530a58a1 --- .../src/org/simantics/diagram/elements/TextNode.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java index 2991d234c..77eb78922 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java @@ -410,6 +410,7 @@ public class TextNode extends G2DNode implements IDynamicSelectionPainterNode, L this.scaleRecip = 1.0 / scale; this.caret = 0; this.selectionTail = 0; + resetCaches(); } @@ -1437,6 +1438,9 @@ public class TextNode extends G2DNode implements IDynamicSelectionPainterNode, L y += line.layout.getDescent() + line.layout.getLeading() + line.layout.getAscent(); Rectangle2D bbox = line.layout.getLogicalHighlightShape(0, lineText.length()).getBounds2D(); + // HighlightShape is not large enough, if font is italic. + Rectangle2D bbox2 = line.layout.getBounds(); + bbox.add(bbox2); bbox.setFrame(bbox.getX(), bbox.getY() + line.drawPosY, bbox.getWidth(), bbox.getHeight()); line.bbox = bbox; } -- 2.47.1