britzl / defold-richtext

Defold-RichText is a system to create styled text based on an HTML inspired markup language
MIT License
75 stars 12 forks source link

Sprites being scaled when they shouldn't be? #21

Closed subsoap closed 6 years ago

subsoap commented 6 years ago

What's happening here? There are two icons. One is displayed like how it should be, the second looks incorrect. I tried to reset the size but it did not seem to help.

local text = [[<img=icons:document/><size=1>Kalipi</size><br/><size=0.7>Well, hello there! He he he... ho ho ho...</size><br/><size=0.7>What do we have here?</size><size=1.0></size><img=icons:document/>]]        

2018-03-06 22_48_37-vn

Adding some size 1 text doesn't help either

2018-03-06 22_51_31-vn

Putting second on its own line also doesn't help

2018-03-06 22_52_36-vn

subsoap commented 6 years ago

It's because the node position is like this DEBUG:SCRIPT: vmath.vector3(0, -102.59999847412, 0) I tested forcing the node to vmath.vector3(0, -102, 0)

2018-03-06 22_57_01-vn

So may need a feature to floor/round the position of sprites so they align with the pixel grid.

britzl commented 6 years ago

Ah, I see. Should that be an option perhaps? And what should the option be called?

subsoap commented 6 years ago

Something like image_pixel_grid_snap = true

britzl commented 6 years ago

Added the setting and released a new version: https://github.com/britzl/defold-richtext/releases/tag/3.0.0