aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-09-17 01:39:33 +0200
committerSven Gothel <[email protected]>2023-09-17 01:39:33 +0200
commit3309ea8e83241f34cb1e83b660c633b3778f34df (patch)
tree72f5e60523278356bc7413b325f81da9d05e0307
parent06b9e84c635cffc4a51beb6a38b5f5c111edcb7f (diff)
GraphUI Label: Add convenient methods getUnscaledGlyphBounds(..)
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java
index a01b892ad..54105e85a 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/Label.java
@@ -191,6 +191,18 @@ public class Label extends GraphShape {
}
}
+ /** Convenient shortcut to {@link Font#getGlyphBounds(CharSequence, AffineTransform, AffineTransform)}. */
+ public static AABBox getUnscaledGlyphBounds(final Font font, final CharSequence text) {
+ final AffineTransform tempT1 = new AffineTransform();
+ final AffineTransform tempT2 = new AffineTransform();
+
+ return font.getGlyphBounds(text, tempT1, tempT2);
+ }
+ /** Convenient shortcut to {@link Font#getGlyphBounds(CharSequence, AffineTransform, AffineTransform)} using {@link #getFont()} and {@link #getText()}. */
+ public AABBox getUnscaledGlyphBounds() {
+ return getUnscaledGlyphBounds(font, text);
+ }
+
private final Font.GlyphVisitor glyphVisitor = new Font.GlyphVisitor() {
@Override
public void visit(final char symbol, final Glyph glyph, final AffineTransform t) {