Speaking of fonts...

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Speaking of fonts...

Post by Imerion »

I've been working on converting a standard font (Open Sans) to a bitmap font to import in my game. I'm using the CBFG program for the conversion and it all works fine when implemented. But I'm having trouble with too much space between each character. Is it possible to decrease the distance between each character, even when not using a monospace font? I'm mostly just looking for the "optimal settings", or something like that. :)

I have included a screenshot of my current settings if that would help. :)
Attachments
font.png
font.png (78.8 KiB) Viewed 8722 times
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Re: Speaking of fonts...

Post by Kjell »

Hi Imerion,
Imerion wrote:Is it possible to decrease the distance between each character, even when not using a monospace font?
Unfortunately there's no support for proportional fonts built-in ( i've requested this on May 7th, 2008 .. still waiting ). Personally i never use the RenderText component anymore ( for this reason among others ) .. but attached is a example that imports the FontData.dat file you can export from CBFG and uses it with the RenderText component ( Align = Center won't work properly though ).

Image

Here are the steps you need to follow ..

- Export your font as BMP + Binary Font Data (DAT) from CBFG.
- Import the ExportedFont.bmp file to the BitmapFromFile component in FontBitmap.
- Configure the Font component to match your CBFG configuration.
- Import the FontData.dat file to the FontDataFile component.
- Trigger the FileAction ( Read FontDataFile ) component once*

*You can do this by selecting it and pressing F5.

The example should look like this after processing FontData.dat ..

Image

Once you're done importing & processing FontData.dat, you can remove the CBFG group ( and rename the other components if you want ). And in case you're going to use many RenderText components, you might want to wrap the RenderCharExpression in a function.

If you have any questions, let me know.

K
Attachments
OpenSans.zgeproj
(22.75 KiB) Downloaded 517 times
airpas
Posts: 48
Joined: Wed Apr 18, 2012 11:50 am

Post by airpas »

didn't work here
Attachments
Untitled.jpg
Untitled.jpg (102.03 KiB) Viewed 8678 times
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi airpas,
airpas wrote:didn't work here
Did you follow all steps or at the very least trigger the FileAction component ( as demonstrated below )?

Image

K
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Post by Imerion »

That is very smart! And works great! Another big thanks!
airpas
Posts: 48
Joined: Wed Apr 18, 2012 11:50 am

Post by airpas »

Ops sorry Kjell, seems i skipped reading the infos .
it works great :D
Post Reply