From f51933f0ebe9ae030c26c066e59a728ce08b8559 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 23 Feb 2014 06:11:11 +0100 Subject: 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 instead of array allowing more flexible memory managment. - GLRegion -> Region promotion: - Region create(List outlineShapes, int renderModes) - Region create(OutlineShape outlineShape, int renderModes) - Region additions - void addOutlineShape(OutlineShape shape) - void addOutlineShapes(List 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 --- src/jogl/classes/com/jogamp/graph/font/Font.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/jogl/classes/com/jogamp/graph/font') 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 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 getOutlineShapes(List shapes, CharSequence string, float pixelSize, Factory vertexFactory); /** Shall return {@link #getFullFamilyName()} */ public String toString(); -- cgit v1.2.3