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

Author Topic: A few Questions regarding Text  (Read 3934 times)

0 Members and 1 Guest are viewing this topic.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
A few Questions regarding Text
« on: January 17, 2012, 12:20:39 am »
So far my project is coming along well. I am currently using .NET SFML 2. I only have a few questions around drawing text. My first question is that sometimes when drawing text at a low font size around 10-20 the text appears blurry. I was reading in some other threads to disable smoothing but I was unable to find that (so maybe an example?). The second question regards drawing text with an outline. I was also reading another (old) thread where the solution was to use a bitmap font or some form of shaders. I really do not want to use bitmap fonts because I load a font that is specified by the user. So that leaves me with only shaders. If using shaders is possible then could someone post an example on using them? (I'm new to the graphics stuff 8) )  Thanks in advance for replies.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
A few Questions regarding Text
« Reply #1 on: January 18, 2012, 12:04:57 am »
Just look for an edge detector - should work fine (just detect changes in alpha).

Another solution (that might be slower but won't require shaders) would be rendering the same text multiple times:

Render in black at an offset of (-1, -1), (0, -1), (1, -1), etc. (8 positions), then render the final (and colored) text in the center (offset (0,0)). That way you'll get a nice thin outline, but you have to essentially draw the text 9 times. Depending on what you're doing, this might be acceptable or slow you down too much.

To mix, this would as well work by rendering into a RenderTexture, so you don't have to redraw everything every frame.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
A few Questions regarding Text
« Reply #2 on: January 18, 2012, 02:20:52 am »
Quote from: "Mario"
Just look for an edge detector - should work fine (just detect changes in alpha).

Another solution (that might be slower but won't require shaders) would be rendering the same text multiple times:

Render in black at an offset of (-1, -1), (0, -1), (1, -1), etc. (8 positions), then render the final (and colored) text in the center (offset (0,0)). That way you'll get a nice thin outline, but you have to essentially draw the text 9 times. Depending on what you're doing, this might be acceptable or slow you down too much.

To mix, this would as well work by rendering into a RenderTexture, so you don't have to redraw everything every frame.


Thanks for the reply Mario, drawing a border by offsetting the text looks like what I want.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

 

anything