elmesque icon indicating copy to clipboard operation
elmesque copied to clipboard

Force text position to round to the nearest integer before drawing.

Open mitchmindtree opened this issue 10 years ago • 4 comments

If text is placed at a fractional position (i.e. [30.3, 20.5] instead of [30.0, 20.0]) it causes artefacts to appear and a slight warping when drawn.

@bvssvni is there maybe a way we can "round" or "floor" the transform position to the nearest whole number position just before drawing text (perhaps somewhere around here)?

Normally i've been avoiding this by making sure that whenever I .shift a text Form I use .floored or .rounded values, however this becomes too hard to keep track of when shifting groups of groups of Forms for example. It would be nice if the user didn't have to think about it and the backend handled it automatically.

mitchmindtree avatar Sep 02 '15 13:09 mitchmindtree

Could add Text::roundto piston-graphics, which rounds the translated position.

bvssvni avatar Sep 02 '15 13:09 bvssvni

I opened https://github.com/PistonDevelopers/graphics/issues/998

bvssvni avatar Sep 02 '15 13:09 bvssvni

oooo that sounds good :+1: would be interesting to see if it fixes all the text artefacts issues in conrod :)

mitchmindtree avatar Sep 02 '15 13:09 mitchmindtree

Just for fun, a related slide that describes our issue pretty nicely. I guess what we're doing by .floor/.rounding the position is converting to a Signed Distance Field.

mitchmindtree avatar Sep 07 '15 13:09 mitchmindtree