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

Multiline strings break, linebreaks of multiline strings should be ignored? #17

Closed subsoap closed 6 years ago

subsoap commented 6 years ago
    local text = [[
    <size=1>Lara</size><br/>
    <size=0.7>Well, hello there!</size><br/>
    <size=0.7>What do we have here?</size><img=icons:waiting/>]]

Becomes

2018-03-01 21_56_28-vn

It should be

2018-03-01 21_57_28-vn

Which requires

local text = [[<size=1>Lara</size><br/><size=0.7>Well, hello there!</size><br/><size=0.7>What do we have here?</size><img=icons:waiting/>]]

It would be nice to be able to format in scripts with multiline strings so it's a little easier to manage.

britzl commented 6 years ago

Couldn't you just ignore the <br/> tags? Line-breaks (\n) are accepted as well.

subsoap commented 6 years ago

If I remove the <br/> tags it looks like this

2018-03-02 08_21_58-defold editor 2 0 - vn 2018-03-02 08_21_52-vn

It's the tabs adding the extra initial character removing them

2018-03-02 08_25_16-defold editor 2 0 - vn

2018-03-02 08_25_33-vn

Something changed since last update to make words squish together?

subsoap commented 6 years ago

If I set the size to 1 it looks closer to right, related to that in some way?

2018-03-02 08_35_33-vn

Higher scales seem to have more space than they need

2018-03-02 08_36_23-vn

britzl commented 6 years ago

Ah, I do not properly handle \r\n. Fixed in 2.5.2

subsoap commented 6 years ago

I'm still seeing

2018-03-02 13_13_04-vn

2018-03-02 13_14_07-vn

with I think latest release

local text = [[
<size=1>Lara</size><br/>
<size=1.2>Well, hello there!</size><br/>
<size=0.3>What do we have here?</size><img=icons:waiting/>]]

local text = [[<size=1>???</size><br/><size=0.7>Well, hello there!</size><br/><size=0.7>What do we have here?</size><img=icons:waiting/>]]  
subsoap commented 6 years ago

Happens in example too

2018-03-02 16_58_21-richtext

local text = "<size=0.5>RichText several words to test this</size>Lorem <color=0,0.5,0,1>ipsum </color><img=smileys:zombie/> dolor <color=red>sit </color><color=#ff00ffff>amet, </color><size=1.15><font=Nanum>consectetur </font></size>adipiscing elit.<br/><b>Nunc </b>tincidunt <b><i>mattis</i> libero</b> <i>non viverra</i>.\n\nNullam ornare <img=smileys:hungry></img>accumsan rhoncus.\n\nNunc placerat nibh a purus auctor, id scelerisque massa <size=2>rutrum.</size>"
britzl commented 6 years ago

Ok, what about now? https://github.com/britzl/defold-richtext/releases/tag/2.5.3

subsoap commented 6 years ago

Looks to be fixed!