OSDN Git Service

[fixed] Hiero not getting bounds right for native rendering.
authornathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sun, 7 Nov 2010 21:46:36 +0000 (21:46 +0000)
committernathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sun, 7 Nov 2010 21:46:36 +0000 (21:46 +0000)
extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/GlyphPage.java
extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/UnicodeFont.java
gdx/src/com/badlogic/gdx/Graphics.java

index 13bc77e..c12703f 100644 (file)
@@ -137,7 +137,6 @@ 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 82b17cf..05435b9 100644 (file)
@@ -461,13 +461,13 @@ public class UnicodeFont {
 \r
        private Rectangle getGlyphBounds (GlyphVector vector, int index, int codePoint) {\r
                Rectangle bounds;\r
+               bounds = vector.getGlyphPixelBounds(index, GlyphPage.renderContext, 0, 0);\r
                if (nativeRendering) {\r
-                       if (codePoint == '\n')\r
+                       if (bounds.width == 0 || bounds.height == 0)\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
+               }\r
                if (codePoint == ' ') bounds.width = spaceWidth;\r
                return bounds;\r
        }\r
index 525f70b..a56a3d7 100644 (file)
@@ -14,6 +14,7 @@
 package com.badlogic.gdx;\r
 \r
 import java.io.InputStream;\r
+import java.nio.ByteBuffer;\r
 \r
 import com.badlogic.gdx.files.FileHandle;\r
 import com.badlogic.gdx.graphics.BitmapFont;\r
@@ -31,6 +32,8 @@ import com.badlogic.gdx.graphics.glutils.IndexBufferObject;
 import com.badlogic.gdx.graphics.glutils.ShaderProgram;\r
 import com.badlogic.gdx.graphics.glutils.VertexArray;\r
 import com.badlogic.gdx.graphics.glutils.VertexBufferObject;\r
+import com.badlogic.gdx.graphics.Texture.TextureFilter;\r
+import com.badlogic.gdx.graphics.Texture.TextureWrap;\r
 import com.badlogic.gdx.utils.GdxRuntimeException;\r
 \r
 /**\r
@@ -286,6 +289,9 @@ public interface Graphics {
                        Texture.TextureFilter magFilter, Texture.TextureWrap uWrap,\r
                        Texture.TextureWrap vWrap);\r
 \r
+       public Texture newTexture (ByteBuffer buffer, Format format, int width, int height, TextureFilter minFilter,\r
+               TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap);\r
+\r
        /**\r
         * @return the {@link GraphicsType} of this Graphics instance\r
         */\r