Skip to content
Cody Byrnes edited this page Feb 1, 2018 · 3 revisions

PhiOS uses the default REXPaint Codepage 437 font to help you get started quickly. You can also use your own fonts in one of two ways :-

  1. Use a REXPaint-compatible font tileset. This is the preferred method.
  • Simply copy and paste the REXPaint font .png directly into your Unity project. The higher the resolution the better, so I upscaled the default 20x20 font to 60x60 using Nearest Neighbour scaling in order to preserve the hard pixels.
  • Your .png texture should be imported into Unity with the Alpha From Grayscale and bilinear filtering enabled.
  • Create a new material for your font texture, you can use my Phigames/Alpha Vertex Color shader but any transparent vertex color shader will work.
  • Assign this material to the BitmapFont MonoBehaviour component on the Display object of the bootstrap in your scene hierarchy, under the REXPaint CP437 header.
  • Make sure "Use REX Paint Font" IS ticked.
  • Ensure texture size and grid size is correct for your .png font texture.
  • Bilinear filtering will cause some bleeding artifacts, so set your bleed here to counteract this. The bleed value of 3 works well with the default font.
  • You can use the Quad Height Scale variable to vertically stretch your font. Square fonts (scale of 1) are preferable for topdown map tiles, but this is less readable as text. The default 1.4 scale seems to be a nice compromise between readable text and aesthetically pleasing map tiles.

OR...

  1. Convert a TTF to bitmap using BMFont. I used the following settings to generate the font used by PhiOS (Source Code Pro from the Font Squirrel website, license is included).

    Font Settings: Size 72px, do not include kerning pairs, use TTF outline, hinting, smoothing, super sampling level 4

    Export Options: 0 padding, 5 spacing, equalize cell heights, 2048x2048 texture size, white text with alpha, XML file format, .png textures

  • You will require both the .fnt (XML) and .png exported files, drop them both into your Unity project.
  • Your .png texture should be imported into Unity with both alpha options and bilinear filtering enabled.
  • Create a new material for your font texture, you can use my Phigames/Alpha Vertex Color shader but any transparent vertex color shader will work.
  • Assign your .fnt and material to the BitmapFont MonoBehaviour component on the Display object of the bootstrap in your scene hierarchy, under the BMFont header.
  • Make sure "Use REX Paint Font" is NOT ticked.
  • Ensure your glyph height and glyph width (default is 72x34) matches the values in your .fnt (XML) file.
  • You can use the Quad Height Scale variable to vertically stretch your font, but as you're using a TTF it's probably best to keep this at 1, unless you want to artificially make your font square.
Clone this wiki locally