aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java4
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java9
-rw-r--r--src/jogl/classes/com/jogamp/graph/font/Font.java37
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java20
4 files changed, 62 insertions, 8 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
index c282a4b92..d25ab4311 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -188,7 +188,9 @@ public abstract class GLRegion extends Region {
final Font.GlyphVisitor2 visitor = new Font.GlyphVisitor2() {
@Override
public final void visit(final char symbol, final Font.Glyph glyph) {
- Region.countOutlineShape(glyph.getShape(), vertIndexCount);
+ if( !glyph.isNonContour() ) {
+ Region.countOutlineShape(glyph.getShape(), vertIndexCount);
+ }
} };
font.processString(visitor, str);
return GLRegion.create(glp, renderModes, colorTexSeq, vertIndexCount[0], vertIndexCount[1]);
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
index 62a1ecb95..0090480bb 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
@@ -145,10 +145,9 @@ public class TextRegionUtil {
final Font.GlyphVisitor visitor = new Font.GlyphVisitor() {
@Override
public void visit(final char symbol, final Glyph glyph, final AffineTransform t) {
- if( glyph.isWhiteSpace() ) {
- return;
+ if( !glyph.isNonContour() ) {
+ region.addOutlineShape(glyph.getShape(), t, rgbaColor);
}
- region.addOutlineShape(glyph.getShape(), t, rgbaColor);
}
};
if( preGrowRegion ) {
@@ -175,7 +174,9 @@ public class TextRegionUtil {
final Font.GlyphVisitor2 visitor = new Font.GlyphVisitor2() {
@Override
public final void visit(final char symbol, final Font.Glyph glyph) {
- Region.countOutlineShape(glyph.getShape(), vertIndexCount);
+ if( !glyph.isNonContour() ) {
+ Region.countOutlineShape(glyph.getShape(), vertIndexCount);
+ }
} };
font.processString(visitor, str);
return vertIndexCount;
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java
index 314040adf..ef1179153 100644
--- a/src/jogl/classes/com/jogamp/graph/font/Font.java
+++ b/src/jogl/classes/com/jogamp/graph/font/Font.java
@@ -175,13 +175,44 @@ public interface Font {
/** Return the glyph's name, source from `post` table */
String getName();
- /** Return true if the underlying {@link #getShape()} is a whitespace, otherwise false. */
- boolean isWhiteSpace();
+ /**
+ * Return true if the glyph is a whitespace, otherwise false.
+ * <p>
+ * A whitespace glyph has no {@link #getShape()}, but a valid {@link #getBounds()} and {@link #getAdvance()}.
+ * </p>
+ * Being a whitespace glyph excludes {@link #isUndefined()}.
+ * @see #isUndefined()
+ * @see #isNonContour()
+ */
+ boolean isWhitespace();
- /** Return true if the Glyph denotes an undefined {@link #getID()} symbol, i.e. {@link #getName()} == `.notdef`. */
+ /**
+ * Return true if the Glyph denotes an undefined {@link #getID()} symbol as follows
+ * <ul>
+ * <li>it's glyph index is {@link #ID_UNKNOWN}, i.e. {@code 0x00}</li>
+ * <li>has the {@link #getName() name} `.notdef`, `NULL`, `null` or `.null`</li>
+ * <li>has no original underlying shape</li>
+ * </ul>
+ * <p>
+ * An undefined glyph has no {@link #getShape()} if glyph index is not {@link #ID_UNKNOWN}.
+ * </p>
+ * <p>
+ * An undefined glyph has a default {@link #getBounds()} and {@link #getAdvance()}.
+ * </p>
+ * Being an undefined shape excludes {@link #isWhitespace()}.
+ * @see #isWhitespace()
+ * @see #isNonContour()
+ */
boolean isUndefined();
/**
+ * Returns true if {@link #isWhitespace()} or {@link #isUndefined()}.
+ * @see #isWhitespace()
+ * @see #isUndefined()
+ */
+ boolean isNonContour();
+
+ /**
* Return the AABBox in font-units, borrowing internal instance.
*/
AABBox getBoundsFU();
diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
index 4e7dc308a..1720caf0e 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
@@ -784,6 +784,26 @@ public class AABBox {
return high.z() - low.z();
}
+ /** Returns the volume, i.e. width * height * depth */
+ public final float getVolume() {
+ return getWidth() * getHeight() * getDepth();
+ }
+
+ /** Return true if {@link #getVolume()} is {@link FloatUtil#isZero(float)}, considering epsilon. */
+ public final boolean hasZeroVolume() {
+ return FloatUtil.isZero(getVolume());
+ }
+
+ /** Returns the assumed 2D area, i.e. width * height while assuming low and high lies on same plane. */
+ public final float get2DArea() {
+ return getWidth() * getHeight();
+ }
+
+ /** Return true if {@link #get2DArea()} is {@link FloatUtil#isZero(float)}, considering epsilon. */
+ public final boolean hasZero2DArea() {
+ return FloatUtil.isZero(get2DArea());
+ }
+
@Override
public final boolean equals(final Object obj) {
if( obj == this ) {