Scripts / Text (Font) Size

Author
Message
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 4th Jul 2017 01:18
Been getting into some LUA scripting today and playing around with text displays and such. I had a question though. Why are the text sizes so drastically different? For example 3 is incredibly small compared to 4. Is this dude to what font image is loaded from the fontbank?

How is this all determined?
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GT 740
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 4th Jul 2017 06:03 Edited at: 4th Jul 2017 06:05
I'm not sure why those specific ones were chosen, but they're not really text sizes as such, they're more like 7 (I think its 7) text styles. They're kind of based on the old HTML headings system.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 4th Jul 2017 17:25
You would imagine the value would represent text size but as Belidos says, it isn't the case for some odd reason. It would be nice to be able to use larger text though, rather than have to use bitmaps. A way to change the size of each style would be useful

This will display the styles so you can see the sizes do not uniformly go up and that there are clearly different styles.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 8th Jul 2017 01:30 Edited at: 12th Jul 2017 05:23
I feel like a text sprite sheet should only be called based on its font name and the size it just for scaling? I could be wrong.

Going to play with the text sprite sheets in photoshop and see what I can do. Maybe create my own.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GT 740
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 8th Jul 2017 10:11 Edited at: 8th Jul 2017 10:14
Game Guru is hard coded to reference certain font sizes for certain things. I changed the colour of the font sprite sheets to see what they do:

Text Size 1 - 12px - Editor Text

Text Size 2 - 24px - Test game loading screen

Text Size 3 - 25px - not sure (possibly multiplayer?)

Text Size 4 - 36px - Prompts, Health max, Ammo remaining

Text Size 5 - 40px - Health current and ammo current

Text Size 6 - 72px - Lives

Text Size 7 - 128px - ??

So every time you put "Prompt" in a LUA script, Game Guru is hard-wired to look for the 36px font file. The "Text" command gives you a little more control.

Here's a mini-tutorial on how to change your fonts:
1) Make a folder containing your original fonts within the fontbank folder. I called my folder "original".

2) Download BMFont

Once in BMFont...
3) Go to Options -> Font Settings. Here you can change your font, and change the size. Refer to my list above for what sizes to use, so if you want text that is the same size as your existing prompts but in a different font, use 36px.

4) In Options -> Export Options you can play around with the padding, spacing and (most importantly) texture size.

5) Options -> Visualize allows you to see a preview of your sprite sheet. Go back and forth between this and Export Options to tweak your texture size so there isn't too much empty space. I once exported a sprite sheet at 608 x 608...although it's not a typical texture size, it worked fine and was an efficient use of space.

6) Export Options also give you options for file format and whether or not to export an alpha channel (which you almost certainly will want). I've never had much success exporting with an alpha channel from BMfont so I tend to have to edit the sprite sheet afterwards and add in my own one. This will obviously require an art package like Photoshop, Paint Shop Pro, or Gimp etc.

7) Make sure your Font Descriptor is set to Text.

8) When you're happy, go to Options -> Save bitmap font as... and save the font into Game Guru's fontbank folder. The name doesn't matter too much at this stage but be aware that you will be replacing an existing sprite sheet so you can only have a maximum of 7 fonts/font sizes.

9) BMFont will create 2 files, a sprite sheet in whatever format you specified, and a .fnt font descriptor which is a basically just a text file. Rename the sprite sheet to overwrite an existing font, for example "FPSCR-Font-36px.png". Rename your text descriptor to "FPSCR-Font-36px-Subimages.fnt".

10) Open your .fnt file in notepad. There's a lot of useless data here that needs to be deleted as Game Guru is only interested in the numbers. The quickest way to do this is to do Ctrl+H (or Edit -> Replace).
- Delete the first few lines up to and including "chars count=185" (or however many chars you have!)
- Replace "char id=" with nothing (leave it blank)
- Replace "x=" with a colon ":"
- Replace "y=" with a colon ":"
- Replace "width=" with a colon ":"
- Replace "height=" with a colon ":"

11) All of the rest of the data in each line from "xoffset=" onwards is now superfluous. Delete everything from "xoffset=" to "chnl=15". You can use replace to get rid of the words (by replacing with a blank) but the numbers will need to be done by hand. That will take a while depending on how many characters you have. Sorry!

12) Your font descriptor should now basically be 5 columns of numbers that read something like this "32 :36 :276 :8 :45". Note; the spacing between the numbers and the colons doesn't seem to matter, "32:36" will return the same result as "32 :36". Save.

Your font should now work in Game Guru. To test this out, either write a script that calls text of the size you just replaced, or use DVader's script above to test out your new font.

Hope that helps!

AE
granada
Forum Support
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 8th Jul 2017 10:45
Thanks Avenging Eagle

Now that post would be perfect for a tutorial board

Dave
Windows 10 Pro
GeForce GTX 1050 Ti
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
1920x1080,60 Hz
PM
Avenging Eagle
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 8th Jul 2017 14:52
If they create one, I will gladly contribute. And this time I'll add screenshots and everything!

AE
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 10th Jul 2017 18:59
I suppose it could go in the 'Scripts' board as changing fonts is only available via scripting, and it would be a great source of information until the last bits of the hard coding have been removed from the engine. Thanks for the info so far, it will come in handy if someone searches for information on font sizes.
PC SPECS: Windows 8.1 Pro 64-bit, Intel Core i7-5930K (PASSMARK:13645), NVIDIA Geforce GTX 980 GPU (PASSMARK:9762) , 32GB RAM

Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 11th Jul 2017 05:38
Thanks Lee, I actually was going to mention if a mod could move it. Avenging Eagle thanks for all that information! Very helpful indeed
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GT 740

Login to post a reply

Server time is: 2024-12-23 00:45:07
Your offset time is: 2024-12-23 00:45:07