Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Dwarf Fortress Text Fixer  (Read 6044 times)

CyberPhantom

  • Bay Watcher
    • View Profile
Dwarf Fortress Text Fixer
« on: March 23, 2015, 08:22:28 pm »

Download Link: DFFD Page
Source Link: GitHub Page
Tested on Dwarf Fortress 0.40.24



Purpose

This utility mitigates a bug in TrueType font rendering in Dwarf Fortress 0.40.xx (and some earlier versions). If you've used TrueType fonts in fortress mode (by pressing F12 or using a mod with TrueType on by default), you've likely noticed long lines of text in one column can overlap and "black out" the text in subsequent columns.

For more information on the bug, see http://www.bay12games.com/dwarves/mantisbt/view.php?id=5097.

What This Does

It runs in the background and tells Dwarf Fortress to redraw its window over and over. This does use up a few extra CPU cycles, but my testing shows no noticeable change in FPS.

Screenshots
Spoiler (click to show/hide)

How to Use It
  • Start df_text_fixer.exe
  • Start Dwarf Fortress
It also works if you do step #2 before step #1.
Logged

CyberPhantom

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress Text Fixer
« Reply #1 on: March 23, 2015, 08:23:42 pm »

Let me know what you all think. I'm interested in seeing if anyone experiences a drop in FPS while using this (I didn't). Also let me know if you see any bugs or have any suggestions.
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Dwarf Fortress Text Fixer
« Reply #2 on: March 24, 2015, 08:16:16 am »

With your permission I'd add it to Masterwork DF. Most people use Twbt now, so TTF is disabled by default, but I think those that are using TTF will like this. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

lethosor

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress Text Fixer
« Reply #3 on: March 24, 2015, 01:57:21 pm »

Interesting idea. I believe that F10 in-game accomplishes the same thing, so it might be easier (and certainly more portable) to set up a DFHack script to trigger that key at regular intervals.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

CyberPhantom

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress Text Fixer
« Reply #4 on: March 24, 2015, 02:24:18 pm »

With your permission I'd add it to Masterwork DF. Most people use Twbt now, so TTF is disabled by default, but I think those that are using TTF will like this. :)

Absolutely, go for it. And if you can think of any changes I could implement to make it more mod builder-friendly, just let me know.

Interesting idea. I believe that F10 in-game accomplishes the same thing, so it might be easier (and certainly more portable) to set up a DFHack script to trigger that key at regular intervals.

Indeed, F10 does fix the problem, and it would probably be possible to automate triggering F10 via DFHack. However, F10 also resets the zoom level which isn't always what you want. There might be another way to trigger a redraw of the screen via DFHack -- that's something to look into since, as you said, it would be portable. (As it stands, I went with a non-DFHack approach as I haven't been using DFHack as much lately due to game instability when running DFHack on 0.40.24.)
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress Text Fixer
« Reply #5 on: March 24, 2015, 03:17:15 pm »

game instability when running DFHack on 0.40.24
Hm, it should be reasonably stable (I've never had a DFHack-related crash in recent versions, aside from development-related crashes). Are you using TwbT or any other nonstandard plugins?
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

lethosor

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress Text Fixer
« Reply #6 on: March 25, 2015, 06:09:43 pm »

However, F10 also resets the zoom level which isn't always what you want. There might be another way to trigger a redraw of the screen via DFHack -- that's something to look into since, as you said, it would be portable.
It turns out that DF itself (libgraphics, technically speaking) does have a way to refresh the screen without resetting the zoom level (F10 does both). It took some effort to implement, since the relevant code wasn't exposed in a way where DFHack could trigger it safely, but it should be possible to trigger a screen refresh now, along with other zoom events.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

CyberPhantom

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress Text Fixer
« Reply #7 on: March 27, 2015, 08:06:17 am »

Hm, it should be reasonably stable (I've never had a DFHack-related crash in recent versions, aside from development-related crashes). Are you using TwbT or any other nonstandard plugins?

You're right, I haven't had any stability issues with the latest DFHack.

It turns out that DF itself (libgraphics, technically speaking) does have a way to refresh the screen without resetting the zoom level (F10 does both). It took some effort to implement, since the relevant code wasn't exposed in a way where DFHack could trigger it safely, but it should be possible to trigger a screen refresh now, along with other zoom events.

Awesome. I'm going to look into this as I think I'd prefer a DFHack-based approach as opposed to a separate utility.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress Text Fixer
« Reply #8 on: March 30, 2015, 06:55:53 pm »

Here is a script (which requires DFHack 0.40.24-r3 or later).
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.