Speaking of fonts...

All topics about ZGameEditor goes here.

Moderator: Moderators

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

Speaking of fonts...

Post by Imerion » Thu Dec 04, 2014 4:43 pm

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 2151 times

User avatar
Kjell
Posts: 1669
Joined: Sat Feb 23, 2008 11:15 pm

Re: Speaking of fonts...

Post by Kjell » Thu Dec 04, 2014 6:02 pm

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 115 times

airpas
Posts: 48
Joined: Wed Apr 18, 2012 11:50 am

Post by airpas » Fri Dec 05, 2014 8:45 am

didn't work here
Attachments
Untitled.jpg
Untitled.jpg (102.03 KiB) Viewed 2107 times

User avatar
Kjell
Posts: 1669
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell » Fri Dec 05, 2014 11:17 am

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: 197
Joined: Sun Feb 09, 2014 4:42 pm

Post by Imerion » Fri Dec 05, 2014 1:19 pm

That is very smart! And works great! Another big thanks!

airpas
Posts: 48
Joined: Wed Apr 18, 2012 11:50 am

Post by airpas » Fri Dec 05, 2014 4:01 pm

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

Post Reply