Looking for feedback/suggestions on my free bitmap font library (bit like TextCandy ...)

I’ll provide the code, but kind of trying to solve a bigger problem:

I just noticed that your method of setText overwrites the old text. Is there a way to append?

I’m trying to find a way to mimic the old method of text displays where the game pauses at the end of each “page” and then on button press, continues like a typewriter. I have the basics (display.newContainer will handle keeping the text within a window, and then I presumably just need to call a transition with each page break) But the trick here is that I either need an :append() action or I need to stall (but not stop) the bitmap rollout until an arbitrary time occurs (ex: touch event). But since rollout is handled with a while loop, adding an arbitrary variable will just end the loop, putting me back in the “need append” zone.

I have reviewed Ingemar’s code and merged it into the main tree, so Kerning now works by default.

Richard 9 ; I think the best way to handle that is not to append it but to divide the text into chunks - do you mean on the same page or a new page ?

Dividing into chunks was my original thought, but what I’m trying to build is basically an 8-bit typewriter, so it would actually work like this, assuming a container that can display 3 lines of text at a time:

  1. Print Line 1

  2. Print Line 2

  3. Print Line 3

  4. Wait for container touch

  5. Scroll “up” by one line. (Line 1 is now no longer visible within the container)

  6. Print Line 4

  7. Scroll up again

  8. Print Line 5

  9. Scroll up again

  10. Print Line 6

  11. 3 more lines have printed, so wait for touch

The crucial things here are interrupting print based touch or appending text. (Actually, now that I think of it, old Dragon Quest games do this too; see this youtube)

Hey Paul.  I don’t know if you’re still working on this or not, but I have a couple of observations that you may want to consider implementing.

With Windows Phone 8’s performance issues with display.newText() it’s now standard operating procedure to use bitmap text instead.  You’re library is quite strong and is useful.  In learning to port apps to WP8, I’ve hit a couple things with your display.newBitmapText() that you might want to consider adjusting.  Both are to bring them into compliance with display.newText() with regards to just being able to swap the string display.newText() for display.newBitmapText().  They are:

:setTintColor() – should be :setFillColor()

.text = some string – should work instead of calling a setter Method.  

The first one could just be adding an alias function that passes it’s parameters to :setTintColor() since you probably want to support both.   The second one is a bit more tricky.  There is a technique that lets a object monitor attributes for changes and then execute code.  This is an old tutorial that kind of explains the concept:  http://coronalabs.com/blog/2012/05/01/tutorial-property-callbacks/

Using this you could watch for changes to .text and have it call your :setText() method where you do all your magic.  This would make them call compatible from what I can tell.

Rob

Hi Rob. I’m not working on Corona at the moment - for reasons that are nothing to do with Corona incidentally. I’m quite happy to transfer the repository to anyone who wants it - or completely open source it - or Corona can have it for free if you want - and assist with anyone who wants to work with it. I’m quite happy to sign it away if you are worried about it.

As you say, the first one is easy enough. All you actually need to do is to create a setFillColor member with the same value as setTintColor. Though it should be recalled, it isn’t a setFillColor in the same way it’s done with (say) polygons, it can’t make blue into red (this is probably why I called it setTintColor !)

The second one, I’m not so sure about. I’d be slightly worried about performance impact. The other thing is there is all the other Corona stuff - xScale, yScale, anchorX, anchorY, rotation and so on - these things ‘sort of work’ as I recall, in that it picks them up when you call one of the methods. 

Realistically I would suggest that you probably need to integrate it properly into the SDK - I am limited because I don’t know how it works internally - if it was a real displayObject it would probably work an awful lot better, because I would guess you do the actual translation and stuff at the point of rendering.

Please feel free to borrow/steal/alter any of my code if you want to do this, I genuinely don’t mind.

If you did something like the animation, this does have consequences though, because the Anchor point will be on the move as it animates which will make it look very jerky. The Anchor point needs to fit about the unanimated text. Having said that, I think the text animation is a minor thing anyway, it could rapidly become seriously cliched

Regards to all at Corona and good luck with the free stuff :slight_smile:

Paul.

Hey Paul.  I don’t know if you’re still working on this or not, but I have a couple of observations that you may want to consider implementing.

With Windows Phone 8’s performance issues with display.newText() it’s now standard operating procedure to use bitmap text instead.  You’re library is quite strong and is useful.  In learning to port apps to WP8, I’ve hit a couple things with your display.newBitmapText() that you might want to consider adjusting.  Both are to bring them into compliance with display.newText() with regards to just being able to swap the string display.newText() for display.newBitmapText().  They are:

:setTintColor() – should be :setFillColor()

.text = some string – should work instead of calling a setter Method.  

The first one could just be adding an alias function that passes it’s parameters to :setTintColor() since you probably want to support both.   The second one is a bit more tricky.  There is a technique that lets a object monitor attributes for changes and then execute code.  This is an old tutorial that kind of explains the concept:  http://coronalabs.com/blog/2012/05/01/tutorial-property-callbacks/

Using this you could watch for changes to .text and have it call your :setText() method where you do all your magic.  This would make them call compatible from what I can tell.

Rob

Hi Rob. I’m not working on Corona at the moment - for reasons that are nothing to do with Corona incidentally. I’m quite happy to transfer the repository to anyone who wants it - or completely open source it - or Corona can have it for free if you want - and assist with anyone who wants to work with it. I’m quite happy to sign it away if you are worried about it.

As you say, the first one is easy enough. All you actually need to do is to create a setFillColor member with the same value as setTintColor. Though it should be recalled, it isn’t a setFillColor in the same way it’s done with (say) polygons, it can’t make blue into red (this is probably why I called it setTintColor !)

The second one, I’m not so sure about. I’d be slightly worried about performance impact. The other thing is there is all the other Corona stuff - xScale, yScale, anchorX, anchorY, rotation and so on - these things ‘sort of work’ as I recall, in that it picks them up when you call one of the methods. 

Realistically I would suggest that you probably need to integrate it properly into the SDK - I am limited because I don’t know how it works internally - if it was a real displayObject it would probably work an awful lot better, because I would guess you do the actual translation and stuff at the point of rendering.

Please feel free to borrow/steal/alter any of my code if you want to do this, I genuinely don’t mind.

If you did something like the animation, this does have consequences though, because the Anchor point will be on the move as it animates which will make it look very jerky. The Anchor point needs to fit about the unanimated text. Having said that, I think the text animation is a minor thing anyway, it could rapidly become seriously cliched

Regards to all at Corona and good luck with the free stuff :slight_smile:

Paul.

Hello,

I know it has been a while since this thread was active and I know paulscottrobson said he is away from Corona but I just loved this whole thing. I want to use it but I can’t.

Works well in simulator but when I try to play the game on my android device I get the error:

“No image file in fnt file, contact the author” fontmanager.lua:102

And I don’t know what causes it. I tried changing some directories but nothing helped.

I used BMFont to create the .png and .fnt files and placed them in /fonts folder. As I said, works perfect on simulator but not on device.

@cbt, I was wrestling with this a little while ago and finally got it working. I was using BMFont as well. Have you confirmed that the delivered fonts with the library work as intended? I had a few different problems with this library, and I think the one you outline above was one of them.

Since I modified mine to circumvent the Windows Phone “text performance” issue, I haven’t seen a problem. I can send you my implementation, along with the font bitmap I generated, and see if it works for you, if you want. Let me know and I’ll zip it up and send it over for you to test.

Hello,

I know it has been a while since this thread was active and I know paulscottrobson said he is away from Corona but I just loved this whole thing. I want to use it but I can’t.

Works well in simulator but when I try to play the game on my android device I get the error:

“No image file in fnt file, contact the author” fontmanager.lua:102

And I don’t know what causes it. I tried changing some directories but nothing helped.

I used BMFont to create the .png and .fnt files and placed them in /fonts folder. As I said, works perfect on simulator but not on device.

@cbt, I was wrestling with this a little while ago and finally got it working. I was using BMFont as well. Have you confirmed that the delivered fonts with the library work as intended? I had a few different problems with this library, and I think the one you outline above was one of them.

Since I modified mine to circumvent the Windows Phone “text performance” issue, I haven’t seen a problem. I can send you my implementation, along with the font bitmap I generated, and see if it works for you, if you want. Let me know and I’ll zip it up and send it over for you to test.