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

There’s no call for if a file exists. I believe you just have to attempt the load in an if statement to ensure that you handle loading alternatives.

There is a safe, silent way to do it using LFS (Lua File System) but you’d have to check it against iOS (device!) and Android (device!) to ensure it works since they both have different ways of handling the ResourceDirectory. I would think it should work because neither .png or .fnt is on the protected list (for example, you can’t use LFS to look for lua files) but I do remember having quite the time trying to autoload assets across sim and two device platforms. (I think my specific problem was that I was trying to load TexturePacker Lua files corresponding to .png files though. With .png and .fnt only it might have worked)

I’ll look into it. The warnings are annoying ; it works fine, I think, but I don’t really like superfluous warnings. 

This is the thread where I detailed how I was using lfs. It’s pretty code light, but does have the extra require. The difference is that this one is trying to load everything from a directory and not a specific file.

I ended up abandoning the approach because I wanted to auto-require imageSheet .lua files generated by TexturePackerPro, and sadly lua is that special case that really can’t be handled in this manner. Irregular files are just assets (i.e.: .fnt) so they should be fine. The Corona SDK documentation mentions that you can’t read .png files from the resource directory in Android, so that might be a show stopper though. (the detail is a bit unclear; does that mean LFS can’t find it, or just system.*?)

Wow, I ask a question and wake up the next morning and this thread exploded…

Good news, not using Corona 2.0 seems to have solved my blurry issues.

Thanks,

Rob

The “Ingemar bug”, that is the display box showing the bounds of the text and the whole text string being initially shown wrongly has been closed. 

The “Richard9 bug” (not detecting when @2x is used in config.lua but isn’t actually present) is fixed, but it is chucking out warnings, hope to fix this tomorrow.

Thanks everyone.

Having experimented with LFS this AM, it seems to work fine on iDevices and the simulator, but not on Android ; seems to be the problem about the zipped directory.  My simple test program to read it using system.pathForFile(nil,system.resourceDirectory) seems to have crashed my Android tablet :frowning:

As such I’m tempted to leave it as it is, using system.pathForFile as a file exists test, and just live with the warning messages.

@paulscottrobson

Good news! It looks like the warnings are only printed in the Corona Simulator. When I test on device (iOS and Android) I don’t see any warnings in the device Console/logcat.

PS.

I think that CoronaLabs have changed the behavior of pathForFile() at some point in time, because I can’t remember that it checked for a file’s existence before. It *is* documented that a warning will be displayed though. (But it doesn’t on a device… which is a good thing)

Excellent, I’ll close that then.

paulscottrobson, the library works great so far. I have an RPG-style text window printing out characters like a champ.

There’s only one thing I can’t puzzle out - most likely because I just don’t have a good handle on your speed calculation method: how do I create a pause command? i.e.: {pause} being wait 2000ms before the next character printout?

I could just make a {pause} event that sets an absurdly low text speed, but the problem with that is that I have to set it before the character, not after. So, "lorem ipsum.{pause}"is intended but the workaround would need “lorem ipsum{pause}.”

EDIT: I’m specifically looking to jury-rig the Rollout code. :slight_smile:

Hi, the RolloutModifier class has a faux time, which isn’t actually real time, it ‘pretends’ to be, but actually it is adjusted by the speed, so what needs to happen is this needs to be able to be stopped altogether, so to speak. I will try and add this tomorrow.

Sorry, haven’t forgotten about this, I’ve been out all day, pretty much literally, I will try and amend this tomorrow.

No worries; the great thing about game development is there are about 10 other major tasks at any given time. :slight_smile:

I should upload a new version of addLineBreaks() - extended it to support font manager. :slight_smile:

Hi, I’ve added code to the rollout modifier and the main_roll demo now has a {pause4} command which is easy to clone/modify if you want a variety of pauses.

Works great so far, thanks paulscottrobson. Will be working with this closely soon to shake it out a bit, but seems solid!

Yeah, it’s very solid and performs well.

I added preliminary support for kerning in my fork of the library. In my projects it works well, but I haven’t tested it yet with any of the fancy features available…

That looks great - I will review it to check it fits in with the design, but if you have done it the way I had planned to, which is fairly likely :slight_smile: then it should work fine and everything else should work pretty much automatically. (I haven’t looked yet, but I’m presuming you parsed the .fnt file to get kerning pairs out and modified the reformatText() method appropriately.

…but I’m presuming you parsed the .fnt file to get kerning pairs out and modified the reformatText() method…

 
Almost. Yes I parsed the fnt file to get the kerning data. But I modified the reformatLine() method.

I also added a new function BitmapString:applyKerning(flag) where flag is true/false. This is so that you can disable kerning on specific strings if needed (like scores/timers etc). Kerning is enabled by default as long as kerning data exists in the fnt file.

The way I implemented it was to create a global kerning table for the font, which is loaded into a property named kerningInfo.

To make things easier in the reformat method I included links for each character into the kerningInfo table (kerning property). It only links to the appropriate subtable for that specific character.

Hmm, I look forward to seeing kerning in action. Has this been merged yet?

Also, paulscottrobson, I noticed the rollout library doesn’t include any sort of onComplete functionality (important for a variety of reasons, like pages). That being said, the workaround is fairly easy; I just created an {onComplete} event and make sure to automatically append it to my strings. :wink: (It almost works better than an actual onComplete call, as I can determine whether to call a page onComplete (i.e.: setup next page) or a text onComplete (setup window close)

I had forgotten ! Sorry - I’m away tomorrow for a couple of days but it will be first thing to do when I come back (after saying hi to Children, Wife, Cats etc. :wink:

Richard9, quite happy to add that into the main_roll.lua if you want.