FontMachine or Diddy ?

Monkey Forums/User Modules/FontMachine or Diddy ?

Paul - Taiphoz(Posted 2014) [#1]
I might be way off here, working on a vague memory of some one possibly ziggy or therevills talking about wring a function or method for loading fonts from an atlast, I cant recall if it was therevills talking about getting the atlas implementation in diddy to load ziggy's fonts or if it was ziggy wondering if he should add that functionality himself, but I am sure one of them mentioned it.

I think haha!.

So did anything ever happen with it ?


ziggy(Posted 2014) [#2]
Fontmachine is already loading fonts from an Atlas. You can see the sources, and it can be used with Diddy.


therevills(Posted 2014) [#3]
For my own projects I use FontMachine in Diddy :)


Paul - Taiphoz(Posted 2014) [#4]
Ziggy do you mean that the characters are packed into a small atlas or that your small character atlas is being loaded from a larger atlas i'm a little confused..

I am talking about taking fontmachines character atlas and packing that into a larger all game art atlas packed via texturePacker with sparrow or libgdx.

And therevills what do you mean IN diddy..?

/me walks off to troll through both modules .


therevills(Posted 2014) [#5]
There is an option in FontMachine to pack all the generated characters into a huge atlas, which is read by the FontMachine MonkeyX module. (So only one GPU load).

I use FontMachine side by side with Diddy.


Paul - Taiphoz(Posted 2014) [#6]
Yeah Fontmachine is my font of choice and you know diddy is my framework of choice :)

just so were all clear on what I am asking, this is what I want to load, well not this specifically but this situation.


Where I take a font created by fontmachine and then pack it using TexturePacker, where I would then use diddy and its loadatlas to grab all the atlas images, I guess I could then grab the fontsheet from diddys imagebank and pass it to an overloaded fontmachine Load method rather than it loading an image from the filesystem but before I went and did that I thought I would ask first, the last time I wrote a quick hack for fontmachine it turned out I didn't need to do it because ziggy was working on the problem already, so just trying to save myself some effort..

I will hack something in if I need to but I would rather use code that's written by the module author than a hack from me which I would need to constantly keep updating every time the module got an update.


ziggy(Posted 2014) [#7]
You need more info than a graphic atlase to be able to use Fonts. You need information about each character spacing I mean, not the size of the character image, but the information about how each character should overlap other characters, specialy when using Script and handwritting fonts. So, unless you are able to keep this information on exports, it's hard to integrate on a regular image atlas loader/exporter.


therevills(Posted 2014) [#8]
We could add something to diddy to load in FontMachine images from an atlas... but I would be concerned with the size of the atlas and what devices I would be targeting.

I keep my font images separate from my sprite atlas, this is how I normally do it in code:

Import diddy
Import fontmachine

Class MyGame Extends DiddyApp
	Global font:BitmapFont

	Method Create:Void()
		LoadImages()
		Start(GameScreen.GetInstance())
	End

	Method LoadImages:Void()
		font = New BitmapFont("fonts/playtime.txt", False)
		images.LoadAtlas("monkey.xml", images.SPARROW_ATLAS)
	End
End

Class GameScreen Extends Screen
	Global instance:GameScreen = Null

	Function GetInstance:GameScreen()
		If instance = Null
			instance = New GameScreen()
		End
		Return instance
	End

	Method DrawScore:Void(x:Int, y:Int)
		MyGame.font.DrawText(player.score, x, y, eDrawAlign.CENTER)
	End
End



Paul - Taiphoz(Posted 2014) [#9]
Yeah at the moment I keep mine apart from my other art assets as well, but there are times where just packing the font along with the art is possible because your finished atlas is still small, the above example is one such situation where my sprites are small and the atlas is small and throwing the fonts in there with them results in an atlas that's still under the 2048 recommended upper limit.

@Ziggy yeah I am talking about the image fontmachine creates not the data file, I have no issues with the data file, it's just the font image that I want to pack along with the games other art assets.


ziggy(Posted 2014) [#10]
Then it should be easy to make a loader that takes a pre-existing image and an offset into this image for the loading. But you should somehow allow fontmachine to load as many image pages as required.


Paul - Taiphoz(Posted 2014) [#11]
Yeah mean for the shadows etc?