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

Author Topic: SFML text outline  (Read 1612 times)

0 Members and 1 Guest are viewing this topic.

Doodlemeat

  • Guest
SFML text outline
« on: April 28, 2014, 06:36:54 pm »
Hello.

I really must have outline on my text and I am wondering how to do it - the real way. I know that there is no real way but let go with some examples like Photoshop or maybe the HTML5 2d context.

I have found 2 solutions for how to do it.

* Increase size and change color of the outline text and render it before the real text.
* Get some sort of vertices and draw fat lines with a rounded line join by all vertices.

I think the first solution is the best, but it seems so "hacky".
I can see that freetype has outline support(http://www.freetype.org/freetype2/docs/reference/ft2-glyph_management.html#FT_OutlineGlyph).
Can I implement by myself someway?
Why does not SFML has support for it?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: SFML text outline
« Reply #1 on: April 28, 2014, 06:41:25 pm »
Fast and easy method: offset text in 4 direction and draw it using the outline color, then without any offset draw it using the foreground color.

More and advanced method: like the first method, but instead of 4 directions write a loop that goes 1-360, then use sin/cos to offset the text depending on the angle and draw the outline. Note: you might want to step 25 degrees with this method.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Doodlemeat

  • Guest
Re: SFML text outline
« Reply #2 on: April 28, 2014, 06:43:18 pm »
That is definitly a hacky solution. I need some official kind of solution. Because I guess the freetype has support for it? Do you know if that is true?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: SFML text outline
« Reply #3 on: April 28, 2014, 07:13:47 pm »
FreeType supports it, yes. And it will probably be exposed when SFML uses an OpenGL 2 architecture internally.
Laurent Gomila - SFML developer

 

anything