Skip to content
/ txt2gb Public

A script to generate background images with text and font.png for GB Studio

Notifications You must be signed in to change notification settings

kresp0/txt2gb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

txt2gb

A script to generate background images with text and text.png fonts for GB Studio

Features

  • Support for any compatible font (unicode looking good at 8x8)
  • Accepts text of any lenght
  • Generates either images with text or a font.png file for its use in GBS
  • 3 different font sizes: 8, 16 and 32 px
  • Optional line spacing
  • Options to adjust left and top padding, interword spacing and kerning.
  • Customizable maximum height for the images
  • Automatically splits lines that are too long
  • Automatically splits images that are too long
  • Automatically tries to find the correct top padding and kerning when creating a font.png

Usage

    ./txt2gb.sh [OPTIONS ...] input.txt
    ./txt2gb.sh [OPTIONS ...] -g -f font

Text settings: 
    -f font         Font name to render text. Known working fonts are: ACM-VGA (default), CompaqThin, GBStudio-Stars (uppercase only) and Public-Pixel
    -s px           Font Size: 8 (default, 19 char/line), 16 (9 char/line) and 32 (4 char/line)
    -l lines        Leading (line spacing): 0 or 1 (default)
    -p px           Padding to the left. Between 0 and 152. Usually a multiple of 8. Default: 8
    -w char         Line Width in number of char: 1 to 20. It won't cut words. Defaults depending on size: 19, 9, 4

Advanced Font settings:
    -t px           Padding to the Top of each line. Between 1 and 64. Defaults depending on size: 7, 15, 30
    -i px           Interword spacing. Between -5 and 64. Default: 0
    -k px           Kerning: add or remove spacing between each letter. Between -5 and 5. Default: 0

Image settings:
    -c px           Maximum height for cutting the images. A multiple of 8 between 8 and 2040 (default)   
    -a px           Image width. A multiple of 8 between 8 and 2040. Default: 160.

GBS Font generation:
    -g            Generate a font.png to use in GBStudio from a font. Required: -f font.

Fonts for GB Studio

The ACM-VGA and CompaqThin fonts for GB Studio are also available, so you can use it for the dialogs and elsewhere.

Sample text 8px

ACM-VGA

ACM-VGA ACM-VGA

CompaqThin

CompaqThin CompaqThin

GBStudio-Stars

GBStudio-Stars GBStudio-Stars

Sample text 16px

ACM-VGA

ACM-VGA ACM-VGA

CompaqThin

CompaqThin CompaqThin

GBStudio-Stars

GBStudio-Stars GBStudio-Stars

Sample text 32px

ACM-VGA

ACM-VGA

CompaqThin

CompaqThin

GBStudio-Stars

GBStudio-Stars

About

A script to generate background images with text and font.png for GB Studio

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages