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

Author Topic: Pixelated text  (Read 5355 times)

0 Members and 1 Guest are viewing this topic.

war_man333

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Pixelated text
« on: January 04, 2015, 09:19:45 pm »
I'd like an option for text/fonts to be pixelated.
Currently, SFML will always anti-aliase text.
This is how it should be:

This is how it is:

In order to fix this, the source code must be altered, as explained on page two of this thread:
http://en.sfml-dev.org/forums/index.php?topic=17166.0

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Pixelated text
« Reply #1 on: January 04, 2015, 10:35:26 pm »
I think it's a relative important feature, since a lot of games make use of pixelated fonts. If it can be added to SFML 2.x as an API extension, we should probably add it and maybe reevaluate the API design for SFML 3.0.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Pixelated text
« Reply #2 on: January 04, 2015, 10:52:00 pm »
To clarify a few points:

- it can't be done as an extension, the internals of sf::Font have to be changed to implement this feature

- pixelated fonts already work perfectly in most cases, thanks the latest changes in SFML 2.2; this case is special because the text is stretched

- if this feature was implemented, it would also work fine on fonts that are not natively pixelated

- it has to be an additional argument to the load functions of sf::Font, it can't be changed after the glyphs are rasterized
Laurent Gomila - SFML developer

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Pixelated text
« Reply #3 on: January 05, 2015, 12:54:58 am »
Quote
- it has to be an additional argument to the load functions of sf::Font, it can't be changed after the glyphs are rasterized
Does it really? Can't all the contents of m_pages be thrown out instead and allowed to reload naturally in getGlyph?
Back to C++ gamedev with SFML in May 2023

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Pixelated text
« Reply #4 on: January 05, 2015, 12:58:32 am »
It could also be an optional constructor argument.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Pixelated text
« Reply #5 on: January 05, 2015, 07:37:56 am »
Quote
Does it really? Can't all the contents of m_pages be thrown out instead and allowed to reload naturally in getGlyph?
That would work, yes.
Laurent Gomila - SFML developer

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Pixelated text
« Reply #6 on: January 05, 2015, 08:19:45 am »
It seems good enough, existing sf::Text instances would break (unless there is some dirtyness counter implemented) but they already do when sf::Font is reloaded (http://en.sfml-dev.org/forums/index.php?topic=14019.msg98183#msg98183) so using reloading to set pixelization would break them anyway.
Back to C++ gamedev with SFML in May 2023