From: Marko Luukkainen Date: Mon, 24 Feb 2020 12:58:14 +0000 (+0200) Subject: Add line bounds to highlight bounds to get actual bounds. X-Git-Tag: v1.43.0~82^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F13%2F3913%2F1;p=simantics%2Fplatform.git Add line bounds to highlight bounds to get actual bounds. This fixes text clipping with italic font gitlab #475 Change-Id: I7223d6b7e960f28c61644ba7bc608b46530a58a1 (cherry picked from commit 5d435de8ba4147560a795f8873d234a0489050b2) --- 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; }