// given a texture with encoded glyphs, return a BitmapFont object public static GameFont FromTexture2D(Texture2D texture) { // new instance placeholder GameFont font = null; // first, make sure it's a valid texture if (texture == null) { throw new GameFontException("Texture2D cannot be null."); } else { // try to extract the glyphs from the texture font = new GameFont(); font.Texture = texture; font.ExtractGlyphDescriptors(); } // return the fruits of our labor return font; }