Using bitmap as a font

Hey,

I’m playing the mac homebrew version and I’m wondering is there any way for me to use a .bmp or .png file in place of a font (tff)? (I know it is / used to be a possibility?)

I just love playing in ASCII but haven’t found a square font that I like and that is big enough for my setup.

There are a few lovely IBM square fonts but they are all 8x8, which is a bit too small for my monitor.
Using a bitmap file from the Dwarf Fortress tileset repository would be lovely.

I just love how this screenshot looks like.

See https://github.com/CleverRaven/Cataclysm-DDA/pull/35723

Hm, based on the font.json in that mod something like this should work?

{
  "typeface_fontwidth": 12,
  "typeface_fontheight": 12,
  "typeface_fontsize": 12,
  "typeface": "Alloy_curses_12x12",
  "map_typeface": "Terminus",
  "overmap_typeface": "Terminus"
}

Alloy_curses_12x12 is the .png file located in data/font and entered into the fontlist.txt with the correct path.

When I try to start cataclysm all I get is:
Error while initializing the interface: loading font data failed

Did you move the font.json from the mod folder? I just copied it into the config folder and got an error as well. Had to remove it from the mod folder and then it worked.

Nope, but since I’m trying to use a different .png than the mod uses copying wouldn’t help me, I think?

I just edited the current font.json located in the config folder.

Just try to remove the font.jsom from the mod folder.

Doesn’t work for me. I’m still not sure what that should do for me since I’m not trying to change the overmap font but the typeface.

Well… That’s way above me then. Following the readme closely helped in my case. Hope you’ll manage to get it to work.

1 Like

You need to enter correct filename.

I’ve now tried the following font.json:

{
  "typeface_fontwidth": 12,
  "typeface_fontheight": 12,
  "typeface_fontsize": 12,
  "typeface": "Alloy_curses_12x12.png",
  "map_fontwidth": 12,
  "map_fontheight": 12,
  "map_fontsize": 12,
  "map_typeface": "Alloy_curses_12x12.png",
  "overmap_fontwidth": 12,
  "overmap_fontheight": 12,
  "overmap_fontsize": 12,
  "overmap_typeface": "Alloy_curses_12x12.png"
}

Alloy_curses_12x12.png is placed in the data/font folder and entered into the fontlist.txt with the corresponding path.

Edit / Update:

I just changed the .png file suspecting that there might be somehting wrong with it. But that didn’t change the situation, still the same error message.
If I use the complete filename instead of just the “name” entered into the fontlist.txt

"typeface": "Sample_Tiles.png" instead of "typeface": "Sample_Tiles"

the game starts but simply using the pre-installed unifont or Terminus.

I’m at a loss here.

There is no need to edit fontlist.txt - it is generated automatically. You better delete it, so it would be regenerated. Font dimensions are defined in graphics tab of options menu.

For me there is, I just deleted it but then the game just starts using the pre-installed FixedSys font no matter what font I enter into the fonts.json. And no it doesn’t update automatically.

Thats how I handled it before using .tff’s , but the mod you linked has the .png dimensions written into the json. So thats what I copied and adjusted to the size of the bitmap.
Quoting the (very old) github comment I linked above:

If you drop one of the bitmap font PNGs compatible with DF in the Font folder, you can use it in FONTDATA. So if you have say, 10x10.png as a bitmap font, you’d format FONTDATA like so.
The dimensions must be the same as the tile size in the bitmap font or it’ll crash on load.

All files inside of config folder are created by game. Normally there is no need to edit them manually.

fontlist.txt there should be generated automatically. If it is not after you delete it - there is a problem.

It is created after I delete it, but if I dont enter the fonts I want to use into it, they won’t show up ingame.

Update:

The debug.log is giving me the following lines:

13:00:46.044 : Starting log.
13:00:46.045 INFO : Cataclysm DDA version ba759885df
13:00:46.121 INFO : Number of render drivers on your system: 4
13:00:46.121 INFO : Render driver: 0/metal
13:00:46.121 INFO : Render driver: 1/opengl
13:00:46.121 INFO : Render driver: 2/opengles2
13:00:46.121 INFO : Render driver: 3/software
13:00:46.143 INFO : Language is set to: 'en'
13:00:48.391 INFO : SDL version used during compile is 2.0.10
13:00:48.391 INFO : SDL version used during linking and in runtime is 2.0.10
13:00:48.963 INFO : Active renderer: 3/software
13:00:49.033 INFO : USE_COLOR_MODULATED_TEXTURES is set to 0
13:00:49.214 ERROR SDL : (error message will follow backtrace)
    0   cataclysm-tiles                     0x0000000100e12e6d _Z21debug_write_backtraceRNSt3__113basic_ostreamIcNS_11char_traitsIcEEEE + 57
    1   cataclysm-tiles                     0x0000000100e125bc _Z8DebugLog10DebugLevel10DebugClass + 576
    2   cataclysm-tiles                     0x0000000101646df3 _ZN4Font9load_fontERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiiib + 807
    3   cataclysm-tiles                     0x0000000101645ebd _ZN10catacurses14init_interfaceEv + 7671
    4   cataclysm-tiles                     0x00000001011789f4 main + 2564
    5   libdyld.dylib                       0x00007fff7096f3d5 start + 1
    6   ???                                 0x0000000000000001 0x0 + 1

    Attempting to repeat stack trace using debug symbols…
    backtrace: Could not extract binary name from line
    backtrace: Could not extract binary name from line
    backtrace: Could not extract binary name from line
    backtrace: Could not extract binary name from line
    backtrace: Could not extract binary name from line
    backtrace: Could not extract binary name from line
    backtrace: Could not extract binary name from line
Backtrace emission took 0 seconds.
src/sdltiles.cpp:3513: Failed to load Haberdash_curses_12x12: Couldn't load font file
13:00:49.225 ERROR : Error while initializing the interface: loading font data failed

13:00:49.350 : Log shutdown.

After I’ve spent quite some time trying various endeavours like reinstalling the SDL2 frameworks, rumagign through the sdltiles.cpp, deleting and compiling the game myself and a few other things, I’m none the wiser.
(I’ve also not managed to get the aforementioned overmap mod to work)

Something must go wrong when it detects that the file is a bitmap and tries to load it accordingly.