11 March 2016 - Forum Rules

Main Menu

Basic font prerendering script

Started by Kiyoshi Aman, December 05, 2017, 10:16:24 PM

Previous topic - Next topic

Kiyoshi Aman

Due to discussions in the #romhacking_discussion channel on Discord, I accidentally a script for prerendering text.

Requires Python 3 and PyQt5 (which, if you have Python 3.5 or later, just needs pip3 install PyQt5). See included readme for additional information.

Sample output:

EDIT: Smeargle 0.1 release.
EDIT: Smeargle 0.2 release, same URL. This version emits a new file <script>_index.txt, which provides a line<->tile map.

Sample output, using the same file as was used in the above image:
Potion -> 0, 1, 2, 3, 4, 4
Hi Potion -> 5, 6, 7, 8, 9, 10, 4, 4, 4
Phoenix Tail -> 11, 12, 13, 14, 15, 16, 17, 18, 4, 4, 4, 4
X-Potion -> 19, 20, 21, 22, 23, 24, 4, 4
Huh?! -> 25, 26, 27, 28, 4
Oh my god, are you serious?! -> 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 27, 28, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4

EDIT: Smeargle 0.3.2 released. New utility for conversion to console graphics formats. Linear 1, 2, and 4; and planar 2 bits-per-pixel formats are supported, with aliases—run without arguments for formats supported.

Kiyoshi Aman

Just a note, smeargle 0.3.4 was out for a while now. I just forgot to update this thread.

Notable improvements:

  • Palette mapping. Provide a plaintext file with n=m, one per line, to force a specific palette order. Note that this is going to have to be edited for each run of smeargle, because Qt5's indexed conversion doesn't have a defined order.
  • The planar2 mode for porygon works now.
I'm waiting on Pagure to run on Python3 before I make the git repository for smeargle available, but in the meantime I do accept patches.

Kiyoshi Aman

Smeargle 0.4.0 released - download

This release is a rewrite of, making it more modular (you can import it for access to the Font and Script classes) and allowing for output images to use the font's palette in index 8-bit colour mode. Please see the readme for how the palette addition's supposed to look in your font metadata.

As usual, let me know if there are additions or bugs I should look at.


I know the basics of Python like running scripts but your script all versions does not work with me, I do not know what the problem?

  File "XXXX\smeargle-0.4.0\smeargle-0.4.0\", line
183, in <module>
    font   = sys.argv[1]
IndexError: list index out of range

Kiyoshi Aman

Did you read the readme? Smeargle won't run without arguments.


Yes. I keep trying from 0.1 to 0.4.0 version, and I did not succeed even once.

Kiyoshi Aman

Okay, show me how you're running it.

Kiyoshi Aman

Smeargle 0.5.0 released (download)

This release wraps everything in a game.json file for batch processing. This enables per-script features such as instituting a hard cap on line length (also implemented). It also prints a usage message in the event that you don't read the documentation before attempting to use it.

Kiyoshi Aman

Smeargle 0.5.1 released (download)

This release addresses an issue where would fail if the output directory did not previously exist.

Kiyoshi Aman

Smeargle 0.6.0 released (download)

This release adds support for thingy & Atlas tilemap formats, and implements several ROM-hacking oriented features. Additionally, development sources are now available via If you'd like access in order to contribute, please contact me.

Gideon Zhi

Specific changelog:

Adds the following optional keys to script elements in game.json:

  • output_format: Determines how the tilemap text file gets rendered. Possible values are "atlas", "thingy", null

    • null/omit: Outputs in the format "line = 0x00 0x01 0x02"
    • 'atlas': Outputs in the format "line = <$00><$01><$02>"
    • 'thingy': Outputs in the format "000102=line"
  • leading_zeroes: Forces output to be 16-bit, e.g. "line = 0x0000 0x0001 0x0002"
  • tile_offset: Adds a constant to the initial tile value. e.g. tile_offset: 256 would output "line= 0x0100 0x0101 0x0102"
  • raw_fn: Allows the user to specify the filename for the raw tile graphic png.
  • deduped_fn: Allows the user to specify the filename for the de-duped tile graphic png.
  • tilemap_fn: Allows the user to specify the filename for the tilemap text file.