-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix scaling distortion #159
base: master
Are you sure you want to change the base?
Fix scaling distortion #159
Conversation
filippos-lagopoulos
commented
Mar 24, 2017
- Added a pixel to the left and top of a glyph to get rid of distortion when scaling. I suspect this only needs to be used with glyphs that are adjacent to the edges of the texture but given that the packing algorithm here is pretty awesome, it doesn't look like this will have a major impact on the texture's size.
- Moved the texture coordinates by the left&top padding and used the unpadded glyph size for the calculation of the coordinates. It seems to me that glyphs are stretched by one pixel on both axis if we use the padded size.
What is the distortion you're referring to? Would you have some example before/after your fix (because it is not totally clear to me)? |
Thanks, I see the problem now but there is still problems with the fix you made I think. It's like some glyphs are cut at the bottom (maybe one pixel cut). I don't have much time right now to investigate but I will as soon as I can (unless you fix the remianing bug). |
You're right I noticed that but thought the size must be right when using src_w and src_h. But the glyphs on master do have 1 additional pixel at the edge which makes them look smoother. I'll keep investigating. |
Very interesting work! I have had similar issues even when unscaled and would appreciate it very much to see this fixed. Unfortunately I also don't have the time to look into it right now. |
Here is a hack to fix this. Although I would suggest to keep this PR open until we find a proper fix and the reason why this is happening. I will use this hack to make the text in our application look better but will not commit to this branch. Its dead easy though.
You can obviously skip this bit now (since uvx and uvy already contain the padding):
This will remove the scaling distortion and it will add the missing pixel that exists on master and not on this branch. You also get cleaner rotated text using this. |