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

Author Topic: Drawing text using when using a view causes bad aliasing  (Read 620 times)

0 Members and 1 Guest are viewing this topic.

kenpower

  • Newbie
  • *
  • Posts: 5
    • View Profile
Drawing text using when using a view causes bad aliasing
« on: February 17, 2023, 01:50:52 pm »
Hi,

I'm drawing text into a window with a custom view. I'm using the view to zoom in/out. But my text is suffering terrible aliasing (thin horizontal lines are disappearing) when I zoom in. My guess is that the text is being draw on non-integer positions within the view.

What can be done to mitigate this?

Thanks


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: Drawing text using when using a view causes bad aliasing
« Reply #1 on: February 17, 2023, 06:16:03 pm »
You really shouldn't be zooming in or out on text, instead you should adjust the text size accordingly and render the text on a separate unscaled view to the screen.
That then also allows you to ensure you're always rendering on integer positions.

Otherwise, there isn't too much you can do, as the rasterizer has to cut some information when zooming out and there's a good chance that sharp edges will visually suffer.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/