User avatar
ai_enabled
Topic Author
Posts: 221
Joined: 18 Jul 2013, 05:28
Contact:

Setting the text hinting

27 Mar 2019, 20:29

Hi guys,

I'm curious if there is a way to apply something like WPF TextOptions.TextHintingMode="Animated" to the textblock?

The use case is the credits menu in the game - it's scrolled every frame on some small distance. The text produces some flickering while scrolling - I suppose this is related to the text hinting.
AFAIK, I could avoid this by using a storyboard - as the animated text is automatically should not be hinted - but rewriting the already perfectly implemented code from scroll viewer to something custom is out of the question.

Regards!
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
 
User avatar
jsantos
Site Admin
Posts: 2900
Joined: 20 Jan 2012, 17:18
Contact:

Re: Setting the text hinting

27 Mar 2019, 21:11

Hinting is always enabled (for now we only expose a compile time macro to disable it) but I think the problem you are observing is the snapping (moving the quad to the nearest pixel, so if it is in 5.23 we move it to 5.00). Snapping is only applied to static text and only vertically, once the text is animated the snapping is temporarily disabled to allow subpixel positioning and smooth movement.

So If I understand you correctly, this text is only being animated during a few frames, the it stops and then it animates again?
 
User avatar
ai_enabled
Topic Author
Posts: 221
Joined: 18 Jul 2013, 05:28
Contact:

Re: Setting the text hinting

04 Apr 2019, 02:21

Right, this seems to be related to the text snapping. I've tried to disable SnapsToDevicePixel but can't see any difference.
We're not actually using animation but simply adjusting the vertical scroll offset every frame. This way it's much easier to program the complex behavior we need (so it's possible to scroll using the scroll wheel, press-and-move like with the touch controls, simply scroll every frame on some constant distance, and also the scroll viewer is looped so when it's reaching the end it starts from the beginning).
You can see this in our game which is released in Early Access now! :-) Credits menu.

Regards!
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
 
User avatar
jsantos
Site Admin
Posts: 2900
Joined: 20 Jan 2012, 17:18
Contact:

Re: Setting the text hinting

05 Apr 2019, 21:07

Yes, I saw it! And I am a bit confused because in my machine the quality is quite good. I can slightly notice the snapping being activated when I stop the scroll by clicking with the mouse. Is that the behavior you want to improve, when the scroll is manually stopped and snapping is enabled? Because, during the scroll the text is moving and no snapping is being applied.
 
User avatar
ai_enabled
Topic Author
Posts: 221
Joined: 18 Jul 2013, 05:28
Contact:

Re: Setting the text hinting

06 Apr 2019, 02:38

I definitely can see the text glimmering more than it should when it slowly scrolls up. Especially noticeable on 1920x1080 or lower resolution screen.
And the text is very clear every frame. So I assume the snapping is applied every frame as the text is not actually animated via storyboard, but the scroll value is manipulated vertically.
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
 
User avatar
jsantos
Site Admin
Posts: 2900
Joined: 20 Jan 2012, 17:18
Contact:

Re: Setting the text hinting

08 Apr 2019, 17:47

Is the scroll chaning per frame? Even if the text movement is caused by moving the scroll we disable the snapping. So I am not sure if you are observing bilinear artifacts instead. Could you please make a small video capture?

Anyway, we should expose a property to indicate that a text shouldn't be snapped...
 
User avatar
ai_enabled
Topic Author
Posts: 221
Joined: 18 Jul 2013, 05:28
Contact:

Re: Setting the text hinting

12 Apr 2019, 15:07

Thanks for your responses. Yes, the scroll value is changed every frame.
Well, it doesn't look bad, I just wanted to be sure the pixel snapping is disabled :-) Support for TextOptions.TextHintingMode="Animated" would have helped me to ensure this, but if you're 100% certain the snapping is disabled if the scroll value is changed every frame, then I can rest assured that I did my best with it!

Regards!
AtomicTorch Studio Pte. Ltd. http://atomictorch.com

Who is online

Users browsing this forum: No registered users and 1 guest