fText, the text formatting library

Share your scripts and packages with other Mudlet users.
Thodak
Posts: 2
Joined: Sat May 02, 2020 7:00 pm

Re: fText, the text formatting library

Post by Thodak »

Thanks for the response @demonnic. I tried this but it didn't work:
Code: [show] | [select all] lua
myFormatter = demonnic.TextFormatter:new( {
  width = 40, 
  cap = "[CAP]",
  capColor = "<white>",
  textColor = "<light_blue>"
})

myFormatter:setType('h')

myFormatter:setCapColor("#9AC48D")
Can you help me figure out what I'm missing?

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: fText, the text formatting library

Post by demonnic »

how are you echoing the information? Also, I see some places where I can improve this for an upcoming version

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: fText, the text formatting library

Post by demonnic »

I could have sworn I made a post here about this but... released 1.3.0! https://github.com/demonnic/fText/tree/1.3.0

Mainly, this is a fix for word wrapping coloured lines. It should be much more intelligent about that now.

If you are using demonnic:wordWrap directly, you should change it to demonnic.wordWrap with this version.
If you want to word wrap text with colour codes, use demonnic.xwrap(str, width, type) where type is 'c' for cecho text, 'd' for decho text, and 'h' for hecho text. If you do not pass a type in, then xwrap quietly passes the information along to the old wordWrap function and returns that.

Post Reply