summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph/font
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-02-15 04:17:41 +0100
committerSven Gothel <[email protected]>2023-02-15 04:17:41 +0100
commit91f5d1019c59f56654f40ce18d70d15117b7f302 (patch)
treeffb2716314cd24e546912a79e1ebd3dde8a77a1e /src/jogl/classes/com/jogamp/graph/font
parent250832f581d8acccf0b62259e2ec08adb259be0e (diff)
Graph TextRegionUtil: Move ShapeVisitor to OutlineShape.Visitor and processString(..) to Font, cleaning up ..
Further having Font.processString() return the AABBox of the whole string's 'laidout' OutlineShapes, which is used for (debug) Font.getPointsBounds2(..) just to validate the coordinated with the Glyph based AABBox of Font.getPointsBounds(..). Static TextRegionUtil.drawString(..) no more require to pass the temp AffineTransform instances (ugly).
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/font')
-rw-r--r--src/jogl/classes/com/jogamp/graph/font/Font.java53
-rw-r--r--src/jogl/classes/com/jogamp/graph/font/FontFactory.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/font/FontSet.java2
3 files changed, 49 insertions, 8 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java
index 1b852436f..36f00f628 100644
--- a/src/jogl/classes/com/jogamp/graph/font/Font.java
+++ b/src/jogl/classes/com/jogamp/graph/font/Font.java
@@ -1,5 +1,5 @@
/**
-// * Copyright 2010 JogAmp Community. All rights reserved.
+ * Copyright 2010-2023 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -294,7 +294,15 @@ public interface Font {
AABBox getMetricBounds(final CharSequence string);
/**
- * Return the bounding box by taking each glyph's font-unit sized bounding box into account.
+ * Return the bounding box by taking each glyph's font em-sized bounding box into account.
+ * @param transform optional given transform
+ * @param string string text
+ * @return the bounding box of the given string in font em-size [0..1]
+ */
+ AABBox getPointsBounds(final AffineTransform transform, final CharSequence string);
+
+ /**
+ * Return the bounding box by taking each glyph's font-units sized bounding box into account.
* @param transform optional given transform
* @param string string text
* @return the bounding box of the given string in font-units [0..1]
@@ -302,16 +310,49 @@ public interface Font {
AABBox getPointsBoundsFU(final AffineTransform transform, final CharSequence string);
/**
- * Return the bounding box by taking each glyph's font em-sized bounding box into account.
+ * Return the bounding box of the given string by taking each glyph's font em-sized OutlineShape into account.
* @param transform optional given transform
* @param string string text
- * @return the bounding box of the given string in font em-size [0..1]
+ * @return the bounding box of the given string in font-units [0..1]
*/
- AABBox getPointsBounds(final AffineTransform transform, final CharSequence string);
+ AABBox getPointsBounds2(final AffineTransform transform, final CharSequence string);
boolean isPrintableChar(final char c);
- /** Shall return {@link #getFullFamilyName()} */
+ /**
+ * Visit each {@link Glyph}'s {@link OutlineShape} of the string with the {@link OutlineShape.Visitor}
+ * while passing the progressed {@link AffineTransform}.
+ * <p>
+ * The produced shapes are in font em-size [0..1], but can be adjusted with the given transform, progressed and passed to the visitor.
+ * </p>
+ * @param visitor handling each glyph's outline shape in font em-size [0..1] and the given {@link AffineTransform}
+ * @param transform optional given transform
+ * @param font the target {@link Font}
+ * @param string string text
+ * @return the bounding box of the given string by taking each glyph's font em-sized [0..1] OutlineShape into account.
+ */
+ AABBox processString(final OutlineShape.Visitor visitor, final AffineTransform transform,
+ final CharSequence string);
+
+ /**
+ * Visit each {@link Glyph}'s {@link OutlineShape} of the string with the {@link OutlineShape.Visitor}
+ * while passing the progressed {@link AffineTransform}.
+ * <p>
+ * The produced shapes are in font em-size [0..1], but can be adjusted with the given transform, progressed and passed to the visitor.
+ * </p>
+ * @param visitor handling each glyph's outline shape in font em-size [0..1] and the given {@link AffineTransform}
+ * @param transform optional given transform
+ * @param font the target {@link Font}
+ * @param string string text
+ * @param temp1 temporary AffineTransform storage, mandatory
+ * @param temp2 temporary AffineTransform storage, mandatory
+ * @return the bounding box of the given string by taking each glyph's font em-sized [0..1] OutlineShape into account.
+ */
+ AABBox processString(final OutlineShape.Visitor visitor, final AffineTransform transform,
+ final CharSequence string,
+ final AffineTransform temp1, final AffineTransform temp2);
+
+ /** Returns {@link #getFullFamilyName()} */
@Override
public String toString();
diff --git a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
index 5c317bd2b..ac42274f6 100644
--- a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
+++ b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2011 JogAmp Community. All rights reserved.
+ * Copyright 2010-2023 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
diff --git a/src/jogl/classes/com/jogamp/graph/font/FontSet.java b/src/jogl/classes/com/jogamp/graph/font/FontSet.java
index 60a16b241..607aab433 100644
--- a/src/jogl/classes/com/jogamp/graph/font/FontSet.java
+++ b/src/jogl/classes/com/jogamp/graph/font/FontSet.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2011 JogAmp Community. All rights reserved.
+ * Copyright 2010-2023 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: