@Tom, you will have to add a letter and check the width when the width reached the target, you need to start a new line. That is how most text wrapping takes place.
I'm getting a strange result with ComickBook_Simple.ttf in 2012.09.9 The number 4 isn't aligning as it used to using 2012.09.2 - see attached pictures which were generated using this code:
local numbers={}local font = TTFont.new("ComickBook_Simple.ttf", 80)for c=1, 9do
numbers[c]=TextField.new(font, c)
numbers[c]:setX(math.floor(c*70-numbers[c]:getWidth()/2))
numbers[c]:setY(200)
stage:addChild(numbers[c])end
I've tried a different font and it behaves perfectly in both versions. It also works OK with ComickBook_Simple.ttf when using 2012.9.6. It's just 2012.9.9 causing the misalignment. Any thoughts on what might be causing the problem and how I might beat it? I really want to use ComickBook_Simple.ttf as it has an 'open' 4. Thanks, Pete
ComickBook_Simple.ttf has a garbage/wrong kerning table (even Mac refuses to show it). I've deleted the kerning table and attaching the corrected font file. You can use it.
Thanks. At the moment I'm using the brilliant modified BMFont.lua which allows me to do this:
local signText = BMTextField.new(font, "text here...", 300, "justify")
So with the integrated bmfont in this version, I'd have to code a solution to width setting? Or is this something that is already in this addition to Gideros?
The documentation mentions:
"Talk about kerning, advance and widths.. TO BE WRITTEN MORE...."
Comments
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Likes: SinisterSoft
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
The number 4 isn't aligning as it used to using 2012.09.2 - see attached pictures which were generated using this code:
Any thoughts on what might be causing the problem and how I might beat it? I really want to use ComickBook_Simple.ttf as it has an 'open' 4.
Thanks, Pete
ComickBook_Simple.ttf has a garbage/wrong kerning table (even Mac refuses to show it). I've deleted the kerning table and attaching the corrected font file. You can use it.
Thanks. At the moment I'm using the brilliant modified BMFont.lua which allows me to do this:
The documentation mentions:
"Talk about kerning, advance and widths.. TO BE WRITTEN MORE...."
So I'm perhaps jumping the gun a little.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
https://github.com/nascode/BMFont
@Atilim - are these features in this new version of Gideros, without using this? Thanks
Alternatively you could use Textwrap lib by @ar2rsawseen https://github.com/ar2rsawseen/TextWrap
Using native bmf should be faster performance-wise. But if you want to animate per-letter then you could use my mod
http://www.nightspade.com