1
Graphics / Re: sf::Text missing glyphs [Bug]
« on: May 04, 2012, 05:26:34 pm »
I have also encountered the bug. The bug does not occur under all situations; however, I have gotten it to consistently occur with a simple framerate counter.
Here is the code for SFML.NET:
I hope this helps the problem.
Here is the code for SFML.NET:
using System;
using SFML.Window;
using SFML.Graphics;
using System.Timers;
namespace MissingGlyphs
{
class Program
{
static Text text = new Text();
static Random r = new Random();
static int frames = 0;
static RenderWindow app;
static void Main()
{
app = new RenderWindow(new VideoMode(800, 600), "Missing Glyphs");
app.Closed += new EventHandler(app_Closed);
text.CharacterSize = 18; //The larger the font, the more issues it has. Nothing displays at 72.
text.Position = new Vector2f(4, 4);
text.Color = Color.White;
Timer fpsTimer = new Timer();
fpsTimer.Elapsed += new ElapsedEventHandler(fpsTimer_Elapsed);
fpsTimer.Interval = 1000;
fpsTimer.Start();
while (app.IsOpen())
{
frames++;
app.DispatchEvents();
app.Clear(Color.Black);
app.Draw(text);
app.Display();
}
}
static void fpsTimer_Elapsed(object sender, ElapsedEventArgs e)
{
text.DisplayedString = frames.ToString() + " FPS";
app.SetTitle("Missing Glyphs - " + frames.ToString() + " FPS");
frames = 0;
}
static void app_Closed(object sender, EventArgs e)
{
app.Close();
}
}
}
using SFML.Window;
using SFML.Graphics;
using System.Timers;
namespace MissingGlyphs
{
class Program
{
static Text text = new Text();
static Random r = new Random();
static int frames = 0;
static RenderWindow app;
static void Main()
{
app = new RenderWindow(new VideoMode(800, 600), "Missing Glyphs");
app.Closed += new EventHandler(app_Closed);
text.CharacterSize = 18; //The larger the font, the more issues it has. Nothing displays at 72.
text.Position = new Vector2f(4, 4);
text.Color = Color.White;
Timer fpsTimer = new Timer();
fpsTimer.Elapsed += new ElapsedEventHandler(fpsTimer_Elapsed);
fpsTimer.Interval = 1000;
fpsTimer.Start();
while (app.IsOpen())
{
frames++;
app.DispatchEvents();
app.Clear(Color.Black);
app.Draw(text);
app.Display();
}
}
static void fpsTimer_Elapsed(object sender, ElapsedEventArgs e)
{
text.DisplayedString = frames.ToString() + " FPS";
app.SetTitle("Missing Glyphs - " + frames.ToString() + " FPS");
frames = 0;
}
static void app_Closed(object sender, EventArgs e)
{
app.Close();
}
}
}
I hope this helps the problem.