From 1d58578ebc794f339a0a1a5e7fbc0fcbb704762c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 15 May 2012 16:55:21 +0200 Subject: Graph/Glyph: Clarify public Font.Glyph and private FontInt.GlyphInt --- src/jogl/classes/com/jogamp/graph/font/Font.java | 6 ++++++ src/jogl/classes/jogamp/graph/font/FontInt.java | 8 +------- src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java | 2 +- src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java | 8 +++++--- 4 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java index 6503f2779..c60d0cc2a 100644 --- a/src/jogl/classes/com/jogamp/graph/font/Font.java +++ b/src/jogl/classes/com/jogamp/graph/font/Font.java @@ -74,6 +74,12 @@ public interface Font { * Glyph for font */ public interface Glyph { + // reserved special glyph IDs + // http://scripts.sil.org/cms/scripts/page.php?item_id=IWS-Chapter08#ba57949e + public static final int ID_UNKNOWN = 0; + public static final int ID_CR = 2; + public static final int ID_SPACE = 3; + public Font getFont(); public char getSymbol(); public AABBox getBBox(float pixelSize); diff --git a/src/jogl/classes/jogamp/graph/font/FontInt.java b/src/jogl/classes/jogamp/graph/font/FontInt.java index 37660bb2c..20e1ec028 100644 --- a/src/jogl/classes/jogamp/graph/font/FontInt.java +++ b/src/jogl/classes/jogamp/graph/font/FontInt.java @@ -38,13 +38,7 @@ import com.jogamp.graph.geom.Vertex.Factory; public interface FontInt extends Font { - public interface Glyph extends Font.Glyph { - // reserved special glyph IDs - // http://scripts.sil.org/cms/scripts/page.php?item_id=IWS-Chapter08#ba57949e - public static final int ID_UNKNOWN = 0; - public static final int ID_CR = 2; - public static final int ID_SPACE = 3; - + public interface GlyphInt extends Font.Glyph { public Path2D getPath(); // unscaled path public Path2D getPath(float pixelSize); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java index f20b7d1e7..a1f1a3292 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java @@ -36,7 +36,7 @@ import jogamp.graph.geom.plane.Path2D; import com.jogamp.graph.font.Font; import com.jogamp.graph.geom.AABBox; -public class TypecastGlyph implements FontInt.Glyph { +public class TypecastGlyph implements FontInt.GlyphInt { public class Advance { final Font font; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java index b3ee9c95b..6baaf5afb 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java @@ -29,6 +29,7 @@ package jogamp.graph.font.typecast; import java.util.ArrayList; +import jogamp.graph.font.FontInt.GlyphInt; import jogamp.graph.font.typecast.ot.OTGlyph; import jogamp.graph.font.typecast.ot.Point; import jogamp.graph.geom.plane.AffineTransform; @@ -37,6 +38,7 @@ import jogamp.graph.geom.plane.PathIterator; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.font.Font; +import com.jogamp.graph.font.Font.Glyph; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; @@ -75,11 +77,11 @@ public class TypecastRenderer { advanceTotal = 0; continue; } else if (character == ' ') { - advanceTotal += font.font.getHmtxTable().getAdvanceWidth(TypecastGlyph.ID_SPACE) * metrics.getScale(pixelSize); + advanceTotal += font.font.getHmtxTable().getAdvanceWidth(Glyph.ID_SPACE) * metrics.getScale(pixelSize); continue; } - TypecastGlyph glyph = (TypecastGlyph) font.getGlyph(character); - Path2D gp = glyph.getPath(); + Glyph glyph = font.getGlyph(character); + Path2D gp = ((GlyphInt)glyph).getPath(); float scale = metrics.getScale(pixelSize); t.translate(advanceTotal, y); t.scale(scale, scale); -- cgit v1.2.3