diff options
author | Sven Gothel <[email protected]> | 2011-03-26 19:26:41 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-03-26 19:26:41 +0100 |
commit | 929fc058c56781763c79015f4dbbf9e14dc808a2 (patch) | |
tree | 231e58a5abcbd8186da79848c045b13e3b05f92f /src/com/jogamp/graph/font | |
parent | a7c95f26e87460b76763f26723bbd9379c9fc4cb (diff) |
Font: Make font instances size agnostic (remove all size states), size is only a render time parameter. Add missing bounds/width/height queries to TypecastFont
Diffstat (limited to 'src/com/jogamp/graph/font')
-rw-r--r-- | src/com/jogamp/graph/font/Font.java | 44 | ||||
-rw-r--r-- | src/com/jogamp/graph/font/FontFactory.java | 6 |
2 files changed, 23 insertions, 27 deletions
diff --git a/src/com/jogamp/graph/font/Font.java b/src/com/jogamp/graph/font/Font.java index 0abaad5b5..fbdf1f474 100644 --- a/src/com/jogamp/graph/font/Font.java +++ b/src/com/jogamp/graph/font/Font.java @@ -29,46 +29,44 @@ package com.jogamp.graph.font; import com.jogamp.graph.geom.AABBox; +/** + * Interface wrapper for font implementation. + * + * TrueType Font Specification: + * http://developer.apple.com/fonts/ttrefman/rm06/Chap6.html + */ + public interface Font { /** - * Metrics for font based on pixel size ! - * - * If no pixelSize is given, this font's static pixelSize is being used. - * - * value = Table.value * fontSize * 1.0f / HeadTable.UnitsPerEm + * Metrics for font */ public interface Metrics { - public float getAscent(); - public float getDescent(); - public float getLineGap(); - public float getScale(); - public float getScaleForPixelSize(float pixelSize); - public AABBox getBBox(); + float getAscent(float pixelSize); + float getDescent(float pixelSize); + float getLineGap(float pixelSize); + float getScale(float pixelSize); + AABBox getBBox(float pixelSize); } /** - * Glyph for font symbols based on pixel size ! - * - * If no pixelSize is given, this font's static pixelSize is being used. + * Glyph for font */ public interface Glyph { public Font getFont(); public char getSymbol(); - public AABBox getBBox(); - public float getAdvance(); - public float getAdvanceForPixelSize(float pixelSize, boolean useFrationalMetrics); + public AABBox getBBox(float pixelSize); + public float getAdvance(float pixelSize, boolean useFrationalMetrics); } public String getName(); - public float getSize(); + public Metrics getMetrics(); public Glyph getGlyph(char symbol); - - public float getStringWidth(String string); - public float getStringHeight(String string); - public AABBox getStringBounds(CharSequence string); - public int getNumGlyphs(); + + public float getStringWidth(String string, float pixelSize); + public float getStringHeight(String string, float pixelSize); + public AABBox getStringBounds(CharSequence string, float pixelSize); }
\ No newline at end of file diff --git a/src/com/jogamp/graph/font/FontFactory.java b/src/com/jogamp/graph/font/FontFactory.java index a96dac1b8..b595413ba 100644 --- a/src/com/jogamp/graph/font/FontFactory.java +++ b/src/com/jogamp/graph/font/FontFactory.java @@ -35,10 +35,8 @@ public interface FontFactory { String[] families, String style, String variant, - String weight, - String size); + String weight); Font createFont(Vertex.Factory<? extends Vertex> factory, - String name, - int size); + String name); }
\ No newline at end of file |