OSDN Git Service

[fixed] LwjglCanvas being resized too small.
authornathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sun, 7 Nov 2010 21:32:08 +0000 (21:32 +0000)
committernathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sun, 7 Nov 2010 21:32:08 +0000 (21:32 +0000)
[fixed] Hiero native glyph cache having many blanks.

extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/GlyphPage.java
extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/UnicodeFont.java

index c12703f..13bc77e 100644 (file)
@@ -137,6 +137,7 @@ public class GlyphPage {
         * Loads a single glyph to the backing texture, if it fits.\r
         */\r
        private void renderGlyph (Glyph glyph, int width, int height) {\r
+               System.out.println(glyph.getCodePoint());\r
                // Draw the glyph to the scratch image using Java2D.\r
                scratchGraphics.setComposite(AlphaComposite.Clear);\r
                scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);\r
index 67b1567..82b17cf 100644 (file)
@@ -402,8 +402,7 @@ public class UnicodeFont {
                                extraY += getLineHeight();\r
                                lines++;\r
                                totalHeight = 0;\r
-                       } else if (nativeRendering)\r
-                               offsetX += bounds.width;\r
+                       } else if (nativeRendering) offsetX += bounds.width;\r
                }\r
                if (lastBind != null) GL11.glEnd();\r
 \r
@@ -462,9 +461,12 @@ public class UnicodeFont {
 \r
        private Rectangle getGlyphBounds (GlyphVector vector, int index, int codePoint) {\r
                Rectangle bounds;\r
-               if (nativeRendering)\r
-                       bounds = metrics.getStringBounds("" + (char)codePoint, GlyphPage.scratchGraphics).getBounds();\r
-               else\r
+               if (nativeRendering) {\r
+                       if (codePoint == '\n')\r
+                               bounds = new Rectangle();\r
+                       else\r
+                               bounds = metrics.getStringBounds("" + (char)codePoint, GlyphPage.scratchGraphics).getBounds();\r
+               } else\r
                        bounds = vector.getGlyphPixelBounds(index, GlyphPage.renderContext, 0, 0);\r
                if (codePoint == ' ') bounds.width = spaceWidth;\r
                return bounds;\r