diff options
Diffstat (limited to 'src/jogl')
3 files changed, 7 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java index c60d0cc2a..e2b3fe5d7 100644 --- a/src/jogl/classes/com/jogamp/graph/font/Font.java +++ b/src/jogl/classes/com/jogamp/graph/font/Font.java @@ -97,6 +97,7 @@ public interface Font { public StringBuilder getAllNames(StringBuilder string, String separator); + public float getAdvanceWidth(int i, float pixelSize); public Metrics getMetrics(); public Glyph getGlyph(char symbol); public int getNumGlyphs(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index 8806f537d..8e465de99 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -44,6 +44,7 @@ import com.jogamp.common.util.IntObjectHashMap; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; +import com.jogamp.graph.font.Font.Glyph; import com.jogamp.graph.geom.AABBox; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; @@ -162,6 +163,10 @@ class TypecastFont implements FontInt { return sb; } + public float getAdvanceWidth(int i, float pixelSize) { + return font.getHmtxTable().getAdvanceWidth(i) * metrics.getScale(pixelSize); + } + public Metrics getMetrics() { if (metrics == null) { metrics = new TypecastHMetrics(this); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java index 6baaf5afb..916c7b4d8 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java @@ -77,7 +77,7 @@ public class TypecastRenderer { advanceTotal = 0;
continue;
} else if (character == ' ') {
- advanceTotal += font.font.getHmtxTable().getAdvanceWidth(Glyph.ID_SPACE) * metrics.getScale(pixelSize);
+ advanceTotal += font.getAdvanceWidth(Glyph.ID_SPACE, pixelSize);
continue;
}
Glyph glyph = font.getGlyph(character);
|