Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Looking for feedback/suggestions on my free bitmap font library (bit like TextCandy ...)
Started by paulscottrobson May 08 2014 01:11 PM

* * * * * 1 votes
125 replies to this topic
[TOPIC CONTROLS]
« Page 5 of 6 3 4 5 6
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#101

paulscottrobson

[GLOBAL: userInfoPane.html]
paulscottrobson
  • Contributor

  • 456 posts
  • Corona SDK

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



[TOPIC: post.html]
#102

richard9

[GLOBAL: userInfoPane.html]
richard9
  • Corona Geek

  • 1,118 posts
  • Enterprise

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.*?)



[TOPIC: post.html]
#103

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,925 posts
  • Enterprise

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



[TOPIC: post.html]
#104

paulscottrobson

[GLOBAL: userInfoPane.html]
paulscottrobson
  • Contributor

  • 456 posts
  • Corona SDK

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.



[TOPIC: post.html]
#105

paulscottrobson

[GLOBAL: userInfoPane.html]
paulscottrobson
  • Contributor

  • 456 posts
  • Corona SDK

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 :(

 

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.



[TOPIC: post.html]
#106

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

@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)



[TOPIC: post.html]
#107

paulscottrobson

[GLOBAL: userInfoPane.html]
paulscottrobson
  • Contributor

  • 456 posts
  • Corona SDK

Excellent, I'll close that then.



[TOPIC: post.html]
#108

richard9

[GLOBAL: userInfoPane.html]
richard9
  • Corona Geek

  • 1,118 posts
  • Enterprise

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. :)



[TOPIC: post.html]
#109

paulscottrobson

[GLOBAL: userInfoPane.html]
paulscottrobson
  • Contributor

  • 456 posts
  • Corona SDK

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.



[TOPIC: post.html]
#110

paulscottrobson

[GLOBAL: userInfoPane.html]
paulscottrobson
  • Contributor

  • 456 posts
  • Corona SDK

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



[TOPIC: post.html]
#111

richard9

[GLOBAL: userInfoPane.html]
richard9
  • Corona Geek

  • 1,118 posts
  • Enterprise

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

 

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



[TOPIC: post.html]
#112

paulscottrobson

[GLOBAL: userInfoPane.html]
paulscottrobson
  • Contributor

  • 456 posts
  • Corona SDK

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.



[TOPIC: post.html]
#113

richard9

[GLOBAL: userInfoPane.html]
richard9
  • Corona Geek

  • 1,118 posts
  • Enterprise

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



[TOPIC: post.html]
#114

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

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...



[TOPIC: post.html]
#115

paulscottrobson

[GLOBAL: userInfoPane.html]
paulscottrobson
  • Contributor

  • 456 posts
  • Corona SDK

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 :) 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.



[TOPIC: post.html]
#116

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

...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.



[TOPIC: post.html]
#117

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

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.



[TOPIC: post.html]
#118

richard9

[GLOBAL: userInfoPane.html]
richard9
  • Corona Geek

  • 1,118 posts
  • Enterprise

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. ;) (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)



[TOPIC: post.html]
#119

paulscottrobson

[GLOBAL: userInfoPane.html]
paulscottrobson
  • Contributor

  • 456 posts
  • Corona SDK

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. ;-)

 

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



[TOPIC: post.html]
#120

richard9

[GLOBAL: userInfoPane.html]
richard9
  • Corona Geek

  • 1,118 posts
  • Enterprise

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.



[TOPIC: post.html]
#121

paulscottrobson

[GLOBAL: userInfoPane.html]
paulscottrobson
  • Contributor

  • 456 posts
  • Corona SDK

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 ?



[TOPIC: post.html]
#122

richard9

[GLOBAL: userInfoPane.html]
richard9
  • Corona Geek

  • 1,118 posts
  • Enterprise

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)



[TOPIC: post.html]
#123

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,925 posts
  • Enterprise

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



[TOPIC: post.html]
#124

paulscottrobson

[GLOBAL: userInfoPane.html]
paulscottrobson
  • Contributor

  • 456 posts
  • Corona SDK

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 :)

 

Paul.



[TOPIC: post.html]
#125

cbt

[GLOBAL: userInfoPane.html]
cbt
  • Enthusiast

  • 78 posts
  • Corona SDK

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.




[topic_controls]
« Page 5 of 6 3 4 5 6
 
[/topic_controls]