aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-02-23 06:11:11 +0100
committerSven Gothel <[email protected]>2014-02-23 06:11:11 +0100
commitf51933f0ebe9ae030c26c066e59a728ce08b8559 (patch)
tree6723e2343b80a487dba73d51609e2d8fee120b1a /src/jogl/classes/com
parentb68794ae48cf2f133abd9d822f08207cf3404c17 (diff)
Bug 801: Graph TextRenderer Cleanup Part-1a (unclean)
Remark: This commit is unclean and requires 'Part-1b' due to merging this commit after more than 2 years! Graph: - Use List<OutlineShape> instead of array allowing more flexible memory managment. - GLRegion -> Region promotion: - Region create(List<OutlineShape> outlineShapes, int renderModes) - Region create(OutlineShape outlineShape, int renderModes) - Region additions - void addOutlineShape(OutlineShape shape) - void addOutlineShapes(List<OutlineShape> shapes) - RegionRenderer - draw(..) remove 'position', redundant - - Deprecate 'TextRenderer' and 'GlyphString' Use Region.create(Font.getOutlineShapes(...)) + RegionRenderer instead. - FontInt -> Font promotion (make public) - getOutlineShape and getOutlineShapes - Font.Glyph additions - 'getID(), hashCode()' - 'float getScale(float pixelSize)' - GlyphShape - Add reference to Glyph allowing GlyphString to access the font metrics for translation and scaling - Experimental pre-scale/translation in GlyphString using default font size and it's metrics
Diffstat (limited to 'src/jogl/classes/com')
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/curve/OutlineShape.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/Region.java200
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java42
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java7
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java72
-rw-r--r--src/jogl/classes/com/jogamp/graph/font/Font.java24
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/AABBox.java5
8 files changed, 197 insertions, 157 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
index 38b68702f..5b0d985ad 100755
--- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
@@ -114,7 +114,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
/** The list of {@link Outline}s that are part of this
* outline shape.
*/
- private ArrayList<Outline> outlines;
+ /* pp */ ArrayList<Outline> outlines;
private AABBox bbox;
/** dirty bits DIRTY_BOUNDS */
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java
index af15f9dc4..f7f51758b 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/Region.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java
@@ -28,159 +28,199 @@
package com.jogamp.graph.curve;
import java.util.ArrayList;
+import java.util.List;
+import jogamp.graph.curve.opengl.RegionFactory;
import jogamp.opengl.Debug;
+import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.geom.AABBox;
import com.jogamp.graph.geom.Triangle;
import com.jogamp.graph.geom.Vertex;
-/** Abstract Outline shape GL representation
- * define the method an OutlineShape(s) is
- * binded rendered.
- *
- * @see GLRegion
- */
+/** Abstract Outline shape GL representation define the method an OutlineShape(s)
+ * is bound and rendered.
+ *
+ * @see GLRegion */
public abstract class Region {
-
- /** Debug flag for region impl (graph.curve)
- */
+
+ /** Debug flag for region impl (graph.curve) */
public static final boolean DEBUG = Debug.debug("graph.curve");
-
+
public static final boolean DEBUG_INSTANCE = false;
- /** View based Anti-Aliasing, A Two pass region rendering, slower
- * and more resource hungry (FBO), but AA is perfect.
- * Otherwise the default fast one pass MSAA region rendering is being used.
- */
+ /** View based Anti-Aliasing, A Two pass region rendering, slower and more
+ * resource hungry (FBO), but AA is perfect. Otherwise the default fast one
+ * pass MSAA region rendering is being used. */
public static final int VBAA_RENDERING_BIT = 1 << 0;
/** Use non uniform weights [0.0 .. 1.9] for curve region rendering.
- * Otherwise the default weight 1.0 for uniform curve region rendering is being applied.
- */
+ * Otherwise the default weight 1.0 for uniform curve region rendering is
+ * being applied. */
public static final int VARIABLE_CURVE_WEIGHT_BIT = 1 << 1;
public static final int TWO_PASS_DEFAULT_TEXTURE_UNIT = 0;
private final int renderModes;
- private boolean dirty = true;
- protected int numVertices = 0;
+ private boolean dirty = true;
+ protected int numVertices = 0;
protected final AABBox box = new AABBox();
protected ArrayList<Triangle> triangles = new ArrayList<Triangle>();
protected ArrayList<Vertex> vertices = new ArrayList<Vertex>();
- public static boolean isVBAA(int renderModes) {
- return 0 != ( renderModes & Region.VBAA_RENDERING_BIT );
+ public static boolean isVBAA(int renderModes) {
+ return 0 != (renderModes & Region.VBAA_RENDERING_BIT);
}
/** Check if render mode capable of non uniform weights
- * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
- * {@link Region#VBAA_RENDERING_BIT}
- * @return true of capable of non uniform weights
+ *
+ * @param renderModes
+ * bit-field of modes, e.g.
+ * {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
+ * {@link Region#VBAA_RENDERING_BIT}
+ * @return true of capable of non uniform weights */
+ public static boolean isNonUniformWeight(int renderModes) {
+ return 0 != (renderModes & Region.VARIABLE_CURVE_WEIGHT_BIT);
+ }
+
+ /** Create a {@link Region} defining the list of {@link OutlineShape}.
+ * Combining the Shapes into single buffers.
+ * @return the resulting Region inclusive the generated region
*/
- public static boolean isNonUniformWeight(int renderModes) {
- return 0 != ( renderModes & Region.VARIABLE_CURVE_WEIGHT_BIT );
+ public static Region create(List<OutlineShape> outlineShapes, int renderModes) {
+ final Region region = RegionFactory.create(renderModes);
+ region.addOutlineShapes(outlineShapes);
+ return region;
}
+ /**
+ * Create a {@link Region} defining this {@link OutlineShape}
+ * @return the resulting Region.
+ */
+ public static Region create(OutlineShape outlineShape, int renderModes) {
+ final Region region = RegionFactory.create(renderModes);
+ region.addOutlineShape(outlineShape);
+ return region;
+ }
+
protected Region(int regionRenderModes) {
this.renderModes = regionRenderModes;
}
/** Get current Models
- * @return bit-field of render modes
- */
- public final int getRenderModes() {
- return renderModes;
+ *
+ * @return bit-field of render modes */
+ public final int getRenderModes() {
+ return renderModes;
}
/** Check if current Region is using VBAA
- * @return true if capable of two pass rendering - VBAA
- */
- public boolean isVBAA() {
- return Region.isVBAA(renderModes);
+ *
+ * @return true if capable of two pass rendering - VBAA */
+ public boolean isVBAA() {
+ return Region.isVBAA(renderModes);
}
- /** Check if current instance uses non uniform weights
- * @return true if capable of nonuniform weights
- */
- public boolean isNonUniformWeight() {
- return Region.isNonUniformWeight(renderModes);
+ /** Check if current instance uses non uniform weights
+ *
+ * @return true if capable of nonuniform weights */
+ public boolean isNonUniformWeight() {
+ return Region.isNonUniformWeight(renderModes);
}
- /** Get the current number of vertices associated
- * with this region. This number is not necessary equal to
- * the OGL bound number of vertices.
- * @return vertices count
- */
- public final int getNumVertices(){
+ /** Get the current number of vertices associated with this region. This
+ * number is not necessary equal to the OGL bound number of vertices.
+ *
+ * @return vertices count */
+ public final int getNumVertices() {
return numVertices;
}
- /** Adds a {@link Triangle} object to the Region
- * This triangle will be bound to OGL objects
- * on the next call to {@code update}
- * @param tri a triangle object
+ /** Adds a {@link Triangle} object to the Region This triangle will be bound
+ * to OGL objects on the next call to {@code update}
*
- * @see update(GL2ES2)
- */
+ * @param tri
+ * a triangle object
+ *
+ * @see update(GL2ES2) */
public void addTriangle(Triangle tri) {
triangles.add(tri);
setDirty(true);
}
- /** Adds a list of {@link Triangle} objects to the Region
- * These triangles are to be binded to OGL objects
- * on the next call to {@code update}
- * @param tris an arraylist of triangle objects
+ /** Adds a list of {@link Triangle} objects to the Region These triangles are
+ * to be binded to OGL objects on the next call to {@code update}
*
- * @see update(GL2ES2)
- */
- public void addTriangles(ArrayList<Triangle> tris) {
+ * @param tris
+ * a list of triangle objects
+ *
+ * @see update(GL2ES2) */
+ public void addTriangles(List<Triangle> tris) {
triangles.addAll(tris);
setDirty(true);
}
- /** Adds a {@link Vertex} object to the Region
- * This vertex will be bound to OGL objects
- * on the next call to {@code update}
- * @param vert a vertex objects
+ /** Adds a {@link Vertex} object to the Region This vertex will be bound to
+ * OGL objects on the next call to {@code update}
*
- * @see update(GL2ES2)
- */
+ * @param vert
+ * a vertex objects
+ *
+ * @see update(GL2ES2) */
public void addVertex(Vertex vert) {
vertices.add(vert);
numVertices++;
setDirty(true);
}
- /** Adds a list of {@link Vertex} objects to the Region
- * These vertices are to be binded to OGL objects
- * on the next call to {@code update}
- * @param verts an arraylist of vertex objects
+ /** Adds a list of {@link Vertex} objects to the Region These vertices are to
+ * be binded to OGL objects on the next call to {@code update}
*
- * @see update(GL2ES2)
- */
- public void addVertices(ArrayList<Vertex> verts) {
+ * @param verts
+ * a list of vertex objects
+ *
+ * @see update(GL2ES2) */
+ public void addVertices(List<Vertex> verts) {
vertices.addAll(verts);
numVertices = vertices.size();
setDirty(true);
}
- /**
- * @return the AxisAligned bounding box of
- * current region
- */
- public final AABBox getBounds(){
+ public void addOutlineShape(OutlineShape shape) {
+ shape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS);
+ List<Triangle> tris = shape.triangulate();
+ if(null != tris) {
+ triangles.addAll(tris);
+ for (int j = 0; j < shape.outlines.size(); j++) {
+ final ArrayList<Vertex> sovs = shape.outlines.get(j).getVertices();
+ for (int k = 0; k < sovs.size(); k++) {
+ final Vertex v = sovs.get(k);
+ v.setId(numVertices++);
+ vertices.add(v);
+ }
+ }
+ }
+ setDirty(true);
+ }
+
+ public void addOutlineShapes(List<OutlineShape> shapes) {
+ for (int i = 0; i < shapes.size(); i++) {
+ addOutlineShape(shapes.get(i));
+ }
+ setDirty(true);
+ }
+
+ /** @return the AxisAligned bounding box of current region */
+ public final AABBox getBounds() {
return box;
}
- /** Check if this region is dirty. A region is marked dirty
- * when new Vertices, Triangles, and or Lines are added after a
- * call to update()
+ /** Check if this region is dirty. A region is marked dirty when new
+ * Vertices, Triangles, and or Lines are added after a call to update()
+ *
* @return true if region is Dirty, false otherwise
*
- * @see update(GL2ES2)
- */
+ * @see update(GL2ES2) */
public final boolean isDirty() {
return dirty;
}
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 63713887b..e046c91cb 100755
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -27,17 +27,13 @@
*/
package com.jogamp.graph.curve.opengl;
-
-import java.util.ArrayList;
+import java.util.List;
import javax.media.opengl.GL2ES2;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.curve.Region;
-import com.jogamp.graph.geom.Triangle;
-import com.jogamp.graph.geom.Vertex;
-import jogamp.graph.curve.opengl.RegionFactory;
/** A GLRegion is the OGL binding of one or more OutlineShapes
* Defined by its vertices and generated triangles. The Region
@@ -55,44 +51,18 @@ public abstract class GLRegion extends Region {
* Combining the Shapes into single buffers.
* @return the resulting Region inclusive the generated region
*/
- public static GLRegion create(OutlineShape[] outlineShapes, int renderModes) {
- final GLRegion region = RegionFactory.create(renderModes);
-
- int numVertices = region.getNumVertices();
-
- for(int index=0; index<outlineShapes.length; index++) {
- OutlineShape outlineShape = outlineShapes[index];
- outlineShape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS);
-
- ArrayList<Triangle> triangles = outlineShape.triangulate();
- region.addTriangles(triangles);
-
- ArrayList<Vertex> vertices = outlineShape.getVertices();
- for(int pos=0; pos < vertices.size(); pos++){
- Vertex vert = vertices.get(pos);
- vert.setId(numVertices++);
- }
- region.addVertices(vertices);
- }
-
- return region;
+ public static GLRegion create(List<OutlineShape> outlineShapes, int renderModes) {
+ return (GLRegion) Region.create(outlineShapes, renderModes);
}
/**
- * Create an ogl {@link GLRegion} defining this {@link OutlineShape}
+ * Create an ogl {@link Region} defining this {@link OutlineShape}
* @return the resulting Region.
*/
public static GLRegion create(OutlineShape outlineShape, int renderModes) {
- final GLRegion region = RegionFactory.create(renderModes);
-
- outlineShape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS);
- ArrayList<Triangle> triangles = (ArrayList<Triangle>) outlineShape.triangulate();
- ArrayList<Vertex> vertices = (ArrayList<Vertex>) outlineShape.getVertices();
- region.addVertices(vertices);
- region.addTriangles(triangles);
- return region;
+ return (GLRegion) Region.create(outlineShape, renderModes);
}
-
+
protected GLRegion(int renderModes) {
super(renderModes);
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
index 2f078d7bb..4b7c12fea 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -53,12 +53,11 @@ public abstract class RegionRenderer extends Renderer {
/** Render an {@link OutlineShape} in 3D space at the position provided
* the triangles of the shapes will be generated, if not yet generated
* @param region the OutlineShape to Render.
- * @param position the initial translation of the outlineShape.
* @param texWidth desired texture width for multipass-rendering.
* The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
* @throws Exception if HwRegionRenderer not initialized
*/
- public final void draw(GL2ES2 gl, Region region, float[] position, int[/*1*/] texWidth) {
+ public final void draw(GL2ES2 gl, Region region, int[/*1*/] texWidth) {
if(!isInitialized()) {
throw new GLException("RegionRenderer: not initialized!");
}
@@ -66,14 +65,14 @@ public abstract class RegionRenderer extends Renderer {
throw new GLException("Incompatible render modes, : region modes "+region.getRenderModes()+
" doesn't contain renderer modes "+this.getRenderModes());
}
- drawImpl(gl, region, position, texWidth);
+ drawImpl(gl, region, texWidth);
}
/**
* Usually just dispatched the draw call to the Region's draw implementation,
* e.g. {@link com.jogamp.graph.curve.opengl.GLRegion#draw(GL2ES2, RenderState, int, int, int[]) GLRegion#draw(GL2ES2, RenderState, int, int, int[])}.
*/
- protected abstract void drawImpl(GL2ES2 gl, Region region, float[] position, int[] texWidth);
+ protected abstract void drawImpl(GL2ES2 gl, Region region, int[] texWidth);
@Override
protected void destroyImpl(GL2ES2 gl) {
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
index 3c23733a5..c9cb13ad4 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
@@ -101,7 +101,7 @@ public abstract class Renderer {
* Initialize shader and bindings for GPU based rendering bound to the given GL object's GLContext
* if not initialized yet.
* <p>Leaves the renderer enabled, ie ShaderState.</p>
- * <p>Shall be called by a {@code draw()} method, e.g. {@link RegionRenderer#draw(GL2ES2, Region, float[], int)}</p>
+ * <p>Shall be called by a {@code draw()} method, e.g. {@link RegionRenderer#draw(GL2ES2, Region, int)}</p>
*
* @param gl referencing the current GLContext to which the ShaderState is bound to
* @throws GLException if initialization failed
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
index 8dc41b0c0..44007ca79 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
@@ -35,36 +35,42 @@ import javax.media.opengl.GL2ES2;
import jogamp.graph.curve.text.GlyphString;
+import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.font.Font;
+import com.jogamp.graph.geom.Vertex.Factory;
+/**
+ * @deprecated use {@link com.jogamp.graph.font.Font#getOutlineShapes(java.util.List, CharSequence, float, Factory)},
+ * {@link com.jogamp.graph.curve.Region#create(OutlineShape, int)}
+ * and a {@link com.jogamp.graph.curve.opengl.RegionRenderer}.
+ */
public abstract class TextRenderer extends Renderer {
- /**
+ /**
* Create a Hardware accelerated Text Renderer.
- * @param rs the used {@link RenderState}
+ * @param rs the used {@link RenderState}
* @param renderModes either {@link com.jogamp.graph.curve.opengl.GLRegion#SINGLE_PASS} or {@link com.jogamp.graph.curve.Region#VBAA_RENDERING_BIT}
*/
public static TextRenderer create(RenderState rs, int renderModes) {
return new jogamp.graph.curve.opengl.TextRendererImpl01(rs, renderModes);
}
-
+
protected TextRenderer(RenderState rs, int type) {
super(rs, type);
}
-
+
/** Render the String in 3D space wrt to the font provided at the position provided
* the outlines will be generated, if not yet generated
* @param gl the current GL state
* @param font {@link Font} to be used
- * @param str text to be rendered
- * @param position the lower left corner of the string
+ * @param str text to be rendered
* @param fontSize font size
- * @param texWidth desired texture width for multipass-rendering.
+ * @param texWidth desired texture width for multipass-rendering.
* The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
* @throws Exception if TextRenderer not initialized
*/
public abstract void drawString3D(GL2ES2 gl, Font font,
- String str, float[] position, int fontSize, int[/*1*/] texSize);
+ String str, int fontSize, int[/*1*/] texSize);
/**Create the resulting {@link GlyphString} that represents
* the String wrt to the font.
@@ -77,11 +83,11 @@ public abstract class TextRenderer extends Renderer {
if(DEBUG_INSTANCE) {
System.err.println("createString: "+getCacheSize()+"/"+getCacheLimit()+" - "+Font.NAME_UNIQUNAME + " - " + str + " - " + size);
}
- final GlyphString glyphString = GlyphString.createString(null, rs.getVertexFactory(), font, size, str);
- glyphString.createRegion(gl, renderModes);
+ final GlyphString glyphString = GlyphString.createString(null, rs.getVertexFactory(), font, size, str);
+ glyphString.createRegion(gl, renderModes);
return glyphString;
}
-
+
/** FIXME
public void flushCache(GL2ES2 gl) {
Iterator<GlyphString> iterator = stringCacheMap.values().iterator();
@@ -89,10 +95,10 @@ public abstract class TextRenderer extends Renderer {
GlyphString glyphString = iterator.next();
glyphString.destroy(gl, rs);
}
- stringCacheMap.clear();
+ stringCacheMap.clear();
stringCacheArray.clear();
} */
-
+
@Override
protected void destroyImpl(GL2ES2 gl) {
// fluchCache(gl) already called
@@ -101,42 +107,42 @@ public abstract class TextRenderer extends Renderer {
GlyphString glyphString = iterator.next();
glyphString.destroy(gl, rs);
}
- stringCacheMap.clear();
+ stringCacheMap.clear();
stringCacheArray.clear();
}
-
+
/**
* <p>Sets the cache limit for reusing GlyphString's and their Region.
* Default is {@link #DEFAULT_CACHE_LIMIT}, -1 unlimited, 0 turns cache off, >0 limited </p>
- *
+ *
* <p>The cache will be validate when the next string rendering happens.</p>
- *
+ *
* @param newLimit new cache size
- *
+ *
* @see #DEFAULT_CACHE_LIMIT
*/
public final void setCacheLimit(int newLimit ) { stringCacheLimit = newLimit; }
-
+
/**
* Sets the cache limit, see {@link #setCacheLimit(int)} and validates the cache.
- *
+ *
* @see #setCacheLimit(int)
- *
+ *
* @param gl current GL used to remove cached objects if required
* @param newLimit new cache size
*/
public final void setCacheLimit(GL2ES2 gl, int newLimit ) { stringCacheLimit = newLimit; validateCache(gl, 0); }
-
+
/**
* @return the current cache limit
*/
public final int getCacheLimit() { return stringCacheLimit; }
-
- /**
+
+ /**
* @return the current utilized cache size, <= {@link #getCacheLimit()}
*/
public final int getCacheSize() { return stringCacheArray.size(); }
-
+
protected final void validateCache(GL2ES2 gl, int space) {
if ( getCacheLimit() > 0 ) {
while ( getCacheSize() + space > getCacheLimit() ) {
@@ -144,7 +150,7 @@ public abstract class TextRenderer extends Renderer {
}
}
}
-
+
protected final GlyphString getCachedGlyphString(Font font, String str, int fontSize) {
return stringCacheMap.get(getKey(font, str, fontSize));
}
@@ -160,13 +166,13 @@ public abstract class TextRenderer extends Renderer {
} /// else overwrite is nop ..
}
}
-
+
protected final void removeCachedGlyphString(GL2ES2 gl, Font font, String str, int fontSize) {
final String key = getKey(font, str, fontSize);
GlyphString glyphString = stringCacheMap.remove(key);
if(null != glyphString) {
glyphString.destroy(gl, rs);
- }
+ }
stringCacheArray.remove(key);
}
@@ -177,7 +183,7 @@ public abstract class TextRenderer extends Renderer {
glyphString.destroy(gl, rs);
}
}
-
+
protected final String getKey(Font font, String str, int fontSize) {
final StringBuilder sb = new StringBuilder();
return font.getName(sb, Font.NAME_UNIQUNAME)
@@ -186,8 +192,8 @@ public abstract class TextRenderer extends Renderer {
/** Default cache limit, see {@link #setCacheLimit(int)} */
public static final int DEFAULT_CACHE_LIMIT = 256;
-
- private HashMap<String, GlyphString> stringCacheMap = new HashMap<String, GlyphString>(DEFAULT_CACHE_LIMIT);
- private ArrayList<String> stringCacheArray = new ArrayList<String>(DEFAULT_CACHE_LIMIT);
- private int stringCacheLimit = DEFAULT_CACHE_LIMIT;
+
+ private final HashMap<String, GlyphString> stringCacheMap = new HashMap<String, GlyphString>(DEFAULT_CACHE_LIMIT);
+ private final ArrayList<String> stringCacheArray = new ArrayList<String>(DEFAULT_CACHE_LIMIT);
+ private int stringCacheLimit = DEFAULT_CACHE_LIMIT;
} \ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java
index e2b3fe5d7..97510bcd0 100644
--- a/src/jogl/classes/com/jogamp/graph/font/Font.java
+++ b/src/jogl/classes/com/jogamp/graph/font/Font.java
@@ -27,7 +27,12 @@
*/
package com.jogamp.graph.font;
+import java.util.List;
+
+import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.geom.AABBox;
+import com.jogamp.graph.geom.Vertex;
+import com.jogamp.graph.geom.Vertex.Factory;
/**
* Interface wrapper for font implementation.
@@ -82,8 +87,11 @@ public interface Font {
public Font getFont();
public char getSymbol();
+ public short getID();
+ public float getScale(float pixelSize);
public AABBox getBBox(float pixelSize);
public float getAdvance(float pixelSize, boolean useFrationalMetrics);
+ public int hashCode();
}
@@ -107,6 +115,22 @@ public interface Font {
public AABBox getStringBounds(CharSequence string, float pixelSize);
public boolean isPrintableChar( char c );
+
+ /**
+ * @param glyph source of the created OutlineShape
+ * @param vertexFactory factory for vertices
+ * @return OutlineShape of the glyph
+ */
+ public OutlineShape getOutlineShape(Glyph glyph, Factory<? extends Vertex> vertexFactory);
+
+ /**
+ * @param shapes optional storage of OutlineShapes passed by user, new shapes are appended
+ * @param string source of the created OutlineShapes
+ * @param pixelSize
+ * @param vertexFactory factory for vertices
+ * @return List of OutlineShapes, one OutlineShape per character
+ */
+ public List<OutlineShape> getOutlineShapes(List<OutlineShape> shapes, CharSequence string, float pixelSize, Factory<? extends Vertex> vertexFactory);
/** Shall return {@link #getFullFamilyName()} */
public String toString();
diff --git a/src/jogl/classes/com/jogamp/graph/geom/AABBox.java b/src/jogl/classes/com/jogamp/graph/geom/AABBox.java
index 87f084919..834b1a9e4 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/AABBox.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/AABBox.java
@@ -320,7 +320,8 @@ public class AABBox implements Cloneable {
}
public final String toString() {
- return "[ "+low[0]+"/"+low[1]+"/"+low[1]+" .. "+high[0]+"/"+high[0]+"/"+high[0]+", ctr "+
- center[0]+"/"+center[1]+"/"+center[1]+" ]";
+ return "[ dim "+getWidth()+" x "+getHeight()+" x "+getDepth()+
+ ", box "+low[0]+" / "+low[1]+" / "+low[2]+" .. "+high[0]+" / "+high[1]+" / "+high[2]+
+ ", ctr "+center[0]+" / "+center[1]+" / "+center[2]+" ]";
}
}