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

Author Topic: Applying text outline  (Read 1227 times)

0 Members and 1 Guest are viewing this topic.

toricray

  • Newbie
  • *
  • Posts: 2
    • View Profile
Applying text outline
« on: July 18, 2022, 10:21:20 am »
I want to understand how text outline is applying, but I cant find the answer in code.

Text has m_vertices and m_outlineVertices. Text::ensureGeometryUpdate function adds glyphs to them.
My question is: how glyph without outline are centered in outlined glyph?
Its better described in an attached image:
1st letter is sf::Text, 2nd letter is my attempt to recreate it from two sf::Glyph`s.
How to make proper padding betwen regular and outlined glyphs?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Applying text outline
« Reply #1 on: July 18, 2022, 05:17:12 pm »
I don't fully understand how it works either, looking at the code however it seems like it should set the bounds of the glyph correctly already. I'd assume that the outlined glyph might end up with a negative glyph bound.
At least I can see any special padding going on, but SFML directly uses the glyph's bounds: https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/Text.cpp#L534-L557
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything