Skip to Content

Is there fonts with fixed height and width?

10 replies [Last post]
larienna
larienna's picture
Offline
Joined: 07/28/2008

It's for video game. It's easier to align stuff on the screen when every character has a fixed width. For example, with courier fonts.

But the could also also be some advantage to have the height match the width of the characters. But I am not sure if such fonts actually exist without making my own. And if they do, how are they called? That would make searching easier.

FrankM
Offline
Joined: 01/27/2017
Dare to be square

They're called square fonts, but youy'll probably need to add "fixed width" or "monospaced" to your search to get what you're looking for.

Jay103
Jay103's picture
Offline
Joined: 01/23/2018
courier. And, yes, see above.

courier. And, yes, see above.

larienna
larienna's picture
Offline
Joined: 07/28/2008
Square fonts seems to be

Square fonts seems to be somewhat related.

They are pretty rare, so either I'll have to design my own fonts, or edit fonts to stretch them accurately.

I guess I'll eventually need to learn font editing, unless I do them bit by bit(pixel fonts). But I would only do that with low res fonts.

Jay103
Jay103's picture
Offline
Joined: 01/23/2018
Blah sorry I misread your

Blah sorry I misread your first post. I was not helpful :(

Depending on where you're doing your text entry, you should be able to adjust the distance between characters. Combining that with a mono-space font, I'd think you could make a square font within about 10 minutes of trying.

"Forced Square" appears to be a square font.

pelle
pelle's picture
Offline
Joined: 08/11/2008
Fixed-width bitmap fonts was

Fixed-width bitmap fonts was the only type of font we had back in the day, and still not uncommon in games. You can search for them on OpenGameArt for instance:

https://opengameart.org/art-search-advanced?keys=&title=&field_art_tags_...

larienna
larienna's picture
Offline
Joined: 07/28/2008
I'll have to sheck which font

I'll have to sheck which font editing software are available for free and see if I could resize the fonts easily.

I would already use monospace fonts to make the job easier.

larienna
larienna's picture
Offline
Joined: 07/28/2008
I found FontForge which is a

I found FontForge which is a software that allows independent x and y scaling. I'll try it.

larienna
larienna's picture
Offline
Joined: 07/28/2008
Whew! Font editing is

Whew! Font editing is horribly painful. I tried to take a font and scale it. It worked partially, letters were not aligned correctly. You needed like a dozen of steps and verification just to generate the TTF. You almost need to be an expert in font editing to do it.

Considering I don't really need the TTF since I use bitmap fonts, I could scale down the fonts in a picture editor like GIMP instead. The problem is that I cannot generate fonts using custom resolutions, I must generate them by hand first.

FrankM
Offline
Joined: 01/27/2017
RasterMaster

Is it possible to rasterize the font from TTF when loading the game or level? That would give you a lot of flexibility to match the font to the screen size. If it's computationally trivial, you could do it on a window resize.

Or just rasterize it once at the biggest size you can foresee it needing to be (on some 32K monitor invented five years from now) and down-scale it at runtime.

I only mention future-proofing because I remember seeing a video of some guys running videogames on a wall-of-monitors to see how they'd react. Lara Croft was life-sized. Civ4 worked just fine except that the interface elements were little postage-stamp-sized things in the corners.

larienna
larienna's picture
Offline
Joined: 07/28/2008
Normally I do that, generate

Normally I do that, generate the raster version from the TTF. It's just that if modifying TTF is actually a real pain, I might just keep a good quality raster version instead.

The idea of having fixed width and height is that instead of calculating if something fit on the screen, and resize fonts accordingly, I'll instead define a fixed number of lines and columns (like old terminals) and stretch the display to the screen.

So the characters could be designed squarish at the origin, but once the screen is stretch/sqeezed, according to screen size, the letters might end up more rectangular.

Syndicate content


forum | by Dr. Radut