Commits

davedes  committed 263d5bb

small change to UnicodeFont to use codepoints 32-127 for addAsciiGlyphs; otherwise some Mac users report load times greater than 3 seconds

  • Participants
  • Parent commits 440e077
  • Branches development

Comments (0)

Files changed (2)

File trunk/Slick/src/org/newdawn/slick/UnicodeFont.java

 import org.newdawn.slick.font.Glyph;
 import org.newdawn.slick.font.GlyphPage;
 import org.newdawn.slick.font.HieroSettings;
+import org.newdawn.slick.font.effects.Effect;
 import org.newdawn.slick.opengl.Texture;
 import org.newdawn.slick.opengl.TextureImpl;
 import org.newdawn.slick.opengl.renderer.Renderer;
 import org.newdawn.slick.opengl.renderer.SGL;
-import org.newdawn.slick.util.Log;
 import org.newdawn.slick.util.ResourceLoader;
 
 /**
 	/** The glyphs that are available in this font */
 	private final Glyph[][] glyphs = new Glyph[PAGES][];
 	/** The pages that have been loaded for this font */
-	private final List glyphPages = new ArrayList();
+	private final List<GlyphPage> glyphPages = new ArrayList<GlyphPage>();
 	/** The glyphs queued up to be rendered */
-	private final List queuedGlyphs = new ArrayList(256);
+	private final List<Glyph> queuedGlyphs = new ArrayList<Glyph>(256);
 	/** The effects that need to be applied to the font */
-	private final List effects = new ArrayList();
+	private final List<Effect> effects = new ArrayList<Effect>();
 	
 	/** The padding applied in pixels to the top of the glyph rendered area */
 	private int paddingTop;
 	}
 
 	/**
-	 * Queues the glyphs in the ASCII character set (codepoints 32 through 255) to be loaded. Note that the glyphs are not actually
+	 * Queues the glyphs in the ASCII character set (codepoints 32 through 127) to be loaded. Note that the glyphs are not actually
 	 * loaded until {@link #loadGlyphs()} is called.
 	 */
 	public void addAsciiGlyphs () {
-		addGlyphs(32, 255);
+		addGlyphs(32, 127);
 	}
 
 	/**
 	 * Queues the glyphs in the NEHE character set (codepoints 32 through 128) to be loaded. Note that the glyphs are not actually
 	 * loaded until {@link #loadGlyphs()} is called.
+	 * 
+	 * @deprecated Use addAsciiGlyphs() (codepoints 32-127) or addGlyphs(int, int) for something more specific
 	 */
+	@Deprecated
 	public void addNeheGlyphs () {
 		addGlyphs(32, 32 + 96);
 	}
 	 * @throws SlickException if the glyphs could not be loaded.
 	 */
 	public boolean loadGlyphs (int maxGlyphsToLoad) throws SlickException {
-		System.out.println("loading glyphs "+maxGlyphsToLoad);
 		if (queuedGlyphs.isEmpty()) return false;
 
 		if (effects.isEmpty())
 	 * 
 	 * @return The glyph pages that have been loaded into this font
 	 */
-	public List getGlyphPages () {
+	public List<GlyphPage> getGlyphPages () {
 		return glyphPages;
 	}
 
 	 * 
 	 * @return The list of effects to be applied to the font
 	 */
-	public List getEffects () {
+	public List<Effect> getEffects () {
 		return effects;
 	}
 

File trunk/Slick/src/org/newdawn/slick/tests/UnicodeFontTest.java

 		// unicodeFont = new UnicodeFont("Arial", 25, false, false);
 		// unicodeFont = new UnicodeFont("Everson Mono", 44, false, false);
 
-		// font.addGlyphs(0, 255);
+		//NOTE: code points larger than 127 will significantly slow down loading on some Macs
+//		 font.addGlyphs(0, 127);
 		// font.addGlyphs("~!@#$%^&*()");
 
 //		long l = System.currentTimeMillis();
 	 * @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
 	 */
 	public void update (GameContainer container, int delta) throws SlickException {
-		unicodeFont.loadGlyphs(1);
+		unicodeFont.loadGlyphs(2);
 	}
 
 	/**