Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Custom Text Font Questions  (Read 897 times)

TheBeardyMan

  • Bay Watcher
    • View Profile
Custom Text Font Questions
« on: March 05, 2010, 04:41:28 pm »

I'm trying to create a custom text font and it appears that RGB#FF00FF is drawn as the background colour and RGB#FFFFFF is drawn as the foreground colour, but RGB#C0C0C0 is used for dwarf beards.

Are the dimensions of a .png sufficient for Dwarf Fortress to compute the dimensions of a character, or are hints in the filename required?

Is the use of greyscale in the foreground universal, or is it restricted to dwarf beards in characters 1 and 2?

Does it have to be greyscale? Will an arbitrary RGB (other than #FF00FF) in a custom text font correctly modulate the foreground colour of a character?
Logged

Phssthpok

  • Bay Watcher
    • View Profile
Re: Custom Text Font Questions
« Reply #1 on: March 06, 2010, 03:00:17 am »

You don't need to specify size with anything but the dimensions of the image.

All colors can be used in all tiles. The foreground color and object color will be multiplied together. There are some examples here. Some tilesets use a reddish gray to get brown tree trunks, red and green for levers, and so on.
Logged

Sizik

  • Bay Watcher
    • View Profile
Logged
Skyscrapes, the Tower-Fortress, finally complete!
Skyscrapes 2, repelling the zombie horde!

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: Custom Text Font Questions
« Reply #3 on: March 08, 2010, 02:04:48 pm »

Quote
For example, if a bright red object and a bright blue object use the same tile, the tile can use bright red for all pixels that only the red object uses, bright blue for all pixels only the blue object uses, and bright magenta [....] for all pixels both objects use. In this fashion the two objects that share a tile would look completely different. In practice however, this is probably impossible because so many objects share the same tile, the chances of the potential foreground colors sharing a red, green, or blue color component are too great.
So it's impossible to work with combined colours because so many objects share a tile, but you can work with combined colours when two objects share a tile. Does that mean it's not tile-sharing per se that's the problem, but the sheer number of individual objects that can be attached to a tile?

Is there an example that neatly illustrates the use of colours that aren't magenta or shades of grey? From that article, I don't understand the point of using other colours at all.
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.

Phssthpok

  • Bay Watcher
    • View Profile
Re: Custom Text Font Questions
« Reply #4 on: March 09, 2010, 02:28:41 am »

Quote
For example, if a bright red object and a bright blue object use the same tile, the tile can use bright red for all pixels that only the red object uses, bright blue for all pixels only the blue object uses, and bright magenta [....] for all pixels both objects use. In this fashion the two objects that share a tile would look completely different. In practice however, this is probably impossible because so many objects share the same tile, the chances of the potential foreground colors sharing a red, green, or blue color component are too great.
So it's impossible to work with combined colours because so many objects share a tile, but you can work with combined colours when two objects share a tile. Does that mean it's not tile-sharing per se that's the problem, but the sheer number of individual objects that can be attached to a tile?

Is there an example that neatly illustrates the use of colours that aren't magenta or shades of grey? From that article, I don't understand the point of using other colours at all.

The connecting + tile is used for doors, designating engravings, and stationing squads. Doors have white foreground and various backgrounds, but the others are always cyan on black. Cyan × Red is black, so any red pixels in the tile will show as black in the cyan object.

You could use this to make a red door around a white +, so designations wouldn't look funny, but then all the details on your doors would have to be shades of pure red.
Logged

Sizik

  • Bay Watcher
    • View Profile
Re: Custom Text Font Questions
« Reply #5 on: March 09, 2010, 03:23:54 pm »

What it does is, for each color channel in the pixel, it takes the value of the tile and multiplies that as a percentage with the foreground color (All numbers in this post are in hexadecimal). For example, if the color of the pixel is FF8000 (orange), and the foreground color is 808080 (dark gray), the red value becomes 80 * FF/100 = 7F, the green value becomes 80 * 80/100 = 40, and the blue value becomes 80 * 00/100 = 00, so the pixel is color 7F4000 (dark orange/brown).

Visual example:
This is a square consisting of red, green, and yellow tiles surrounded by a white border.

When colored red, the white (FFFFFF) border's green and blue values are multiplied by the red's values of 00, so only red is left. The same happens to the yellow (FFFF00) The red (FF0000) pixels are left as they are. The green pixels (00FF00) and the color red have no values in common, so they're turned black.

When colored green, the same thing happens, but the red tiles are turned black and all others become green.

One example in which you couls use this is with the Φ (capital phi) character, which is the default tile used for sweet pods (red, FF0000), bloated tubers (brown, 808000), and kobold bulbs (dark gray, 808080). Blue pixels in the tile would only show up in kobold bulbs, and green pixels would not appear in sweet pods. Pixels with multiple color values would show up as different colors in each plant. For example, a cyan (00FFFF) pixel would be black in sweet pods, dark green (008000) in bloated tubers, and dark cyan (008080) in kobold bulbs.
Logged
Skyscrapes, the Tower-Fortress, finally complete!
Skyscrapes 2, repelling the zombie horde!