News: 11 March 2016 - Forum Rules, Mobile Version
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia

Author Topic: Basic font prerendering script  (Read 927 times)

Kiyoshi Aman

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 2232
  • Browncoat Captain
    • View Profile
    • Aerdan's Blog
Basic font prerendering script
« on: December 05, 2017, 10:16:24 pm »
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:
Code: [Select]
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 porygon.py for conversion to console graphics formats. Linear 1, 2, and 4; and planar 2 bits-per-pixel formats are supported, with aliases—run porygon.py without arguments for formats supported.
« Last Edit: December 08, 2017, 04:05:03 pm by Kiyoshi Aman »

Kiyoshi Aman

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 2232
  • Browncoat Captain
    • View Profile
    • Aerdan's Blog
Re: Basic font prerendering script
« Reply #1 on: January 17, 2018, 12:07:53 pm »
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

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 2232
  • Browncoat Captain
    • View Profile
    • Aerdan's Blog
Re: Basic font prerendering script
« Reply #2 on: February 23, 2018, 10:56:08 am »
Smeargle 0.4.0 released - download

This release is a rewrite of smeargle.py, 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.

q8fft

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
Re: Basic font prerendering script
« Reply #3 on: February 28, 2018, 08:53:29 am »
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\smeargle.py", line
 183, in <module>
    font   = sys.argv[1]
IndexError: list index out of range

Kiyoshi Aman

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 2232
  • Browncoat Captain
    • View Profile
    • Aerdan's Blog
Re: Basic font prerendering script
« Reply #4 on: February 28, 2018, 01:08:25 pm »
Did you read the readme? Smeargle won't run without arguments.

q8fft

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
Re: Basic font prerendering script
« Reply #5 on: February 28, 2018, 04:00:42 pm »
Yes. I keep trying from 0.1 to 0.4.0 version, and I did not succeed even once.

Kiyoshi Aman

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 2232
  • Browncoat Captain
    • View Profile
    • Aerdan's Blog
Re: Basic font prerendering script
« Reply #6 on: March 01, 2018, 09:07:16 am »
Okay, show me how you're running it.

Kiyoshi Aman

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 2232
  • Browncoat Captain
    • View Profile
    • Aerdan's Blog
Re: Basic font prerendering script
« Reply #7 on: March 14, 2018, 12:06:36 pm »
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.