From dd1a057e6df7f35904d6d36b5e5734e180b412eb Mon Sep 17 00:00:00 2001 From: "nathan.sweet" Date: Sun, 7 Nov 2010 21:32:08 +0000 Subject: [PATCH] [fixed] LwjglCanvas being resized too small. [fixed] Hiero native glyph cache having many blanks. --- .../src/com/badlogic/gdx/hiero/unicodefont/GlyphPage.java | 1 + .../src/com/badlogic/gdx/hiero/unicodefont/UnicodeFont.java | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/GlyphPage.java b/extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/GlyphPage.java index c12703fab..13bc77e3c 100644 --- a/extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/GlyphPage.java +++ b/extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/GlyphPage.java @@ -137,6 +137,7 @@ public class GlyphPage { * Loads a single glyph to the backing texture, if it fits. */ private void renderGlyph (Glyph glyph, int width, int height) { + System.out.println(glyph.getCodePoint()); // Draw the glyph to the scratch image using Java2D. scratchGraphics.setComposite(AlphaComposite.Clear); scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE); diff --git a/extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/UnicodeFont.java b/extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/UnicodeFont.java index 67b156756..82b17cf85 100644 --- a/extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/UnicodeFont.java +++ b/extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/UnicodeFont.java @@ -402,8 +402,7 @@ public class UnicodeFont { extraY += getLineHeight(); lines++; totalHeight = 0; - } else if (nativeRendering) - offsetX += bounds.width; + } else if (nativeRendering) offsetX += bounds.width; } if (lastBind != null) GL11.glEnd(); @@ -462,9 +461,12 @@ public class UnicodeFont { private Rectangle getGlyphBounds (GlyphVector vector, int index, int codePoint) { Rectangle bounds; - if (nativeRendering) - bounds = metrics.getStringBounds("" + (char)codePoint, GlyphPage.scratchGraphics).getBounds(); - else + if (nativeRendering) { + if (codePoint == '\n') + bounds = new Rectangle(); + else + bounds = metrics.getStringBounds("" + (char)codePoint, GlyphPage.scratchGraphics).getBounds(); + } else bounds = vector.getGlyphPixelBounds(index, GlyphPage.renderContext, 0, 0); if (codePoint == ' ') bounds.width = spaceWidth; return bounds; -- 2.11.0