Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Text is blurred  (Read 3710 times)

0 Members and 1 Guest are viewing this topic.

Felheart

  • Newbie
  • *
  • Posts: 23
    • View Profile
Text is blurred
« on: February 29, 2012, 04:10:54 pm »


In the bottom example I commented out the scaling and changed the font size from 20 to 10 to maintain the size.
So scaling the text down resolves the issue.

No changes to View or any other transformations have been made.

Is it advised to always scale down the text when rendering?
Is this intended? Is there some better way to fix this?

Using the .NET bindings in C# if that matters.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Text is blurred
« Reply #1 on: February 29, 2012, 04:40:06 pm »
Strange, the best result is supposed to be obtained by changing the character size, scaling should make things a little blurry. And you get the opposite.
Laurent Gomila - SFML developer

Felheart

  • Newbie
  • *
  • Posts: 23
    • View Profile
Text is blurred
« Reply #2 on: February 29, 2012, 04:49:12 pm »
Code: [Select]

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SFML.Window;
using SFML.Graphics;
using System.IO;
using System.Diagnostics;

namespace SFML_Test3
{
static class Program
{
static RenderWindow renderWindow;

static void Main(string[] args)
{
renderWindow = new RenderWindow(new VideoMode(800, 500), "SFML 2", Styles.Default, new ContextSettings(32, 0, 16));
renderWindow.Show(true);
renderWindow.ShowMouseCursor(true);
renderWindow.SetFramerateLimit(60);

renderWindow.Closed += (s, e) => { Environment.Exit(0); };
renderWindow.Resized += (s, e) => { renderWindow.SetView(new View(new FloatRect(0, 0, e.Width, e.Height))); };


Font debugFont = new Font(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "visitor1.ttf"));
Text debugText1 = new Text("TEST1", debugFont, 10);
Text debugText2 = new Text("TEST2", debugFont, 20);

debugText2.Scale = new Vector2f(0.5f, 0.5f);

while (renderWindow.IsOpen())
{
renderWindow.DispatchEvents();

renderWindow.Clear();

//

debugText1.Position = new Vector2f(50, 50);
debugText2.Position = new Vector2f(50, 80);

renderWindow.Draw(debugText1);
renderWindow.Draw(debugText2);
//

renderWindow.Display();
}
}
}
}


Font used is this one:

http://www.dafont.com/visitor.font

there are 2 versions, obviously (from looking at the source) I am using visitor1

I'm getting similar results for all other fonts too.

EDIT:
I just noticed that changing: new ContextSettings(32, 0, 16);
to
new ContextSettings(32, 0, 8)); // 8 or lower
resolves the problem, the question remains... why ?

When I use (for example) Arial and antialiasing == 0, it's like you said, the first result looks better.
Does that mean that I shouldn't use antialiasing:16 or is it some kind of bug?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Text is blurred
« Reply #3 on: February 29, 2012, 05:41:39 pm »
Quote
Does that mean that I shouldn't use antialiasing:16 or is it some kind of bug?

I don't think it's a bug in SFML. I don't know why the results are this way with antialiasing x16, but this is how your graphics driver behaves.
Laurent Gomila - SFML developer