Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font sheet generator: Allow generation of monospace fonts #743

Open
davesmith00000 opened this issue May 26, 2024 · 3 comments
Open

Font sheet generator: Allow generation of monospace fonts #743

davesmith00000 opened this issue May 26, 2024 · 3 comments

Comments

@davesmith00000
Copy link
Member

I'd like to be able to generate Dwarf Fortress compatible font sheets from normal monospace fonts.

To do that, we need to be able to say "the square you need to render each glyph into is 16x16".

@davesmith00000
Copy link
Member Author

Like this:

image

@mprevel
Copy link
Contributor

mprevel commented Dec 14, 2024

Hi,

I assume it's an improvement of #731 that does not exactly handle a squared shape of the output character.
But, is it really possible?

I mean, I've tried it with Robot mono font to ask for 16px characters and all of them have the same size 10x22px. As far as I'm concerned, this is good to me since I can check the FontInfo default character to get the exact size of each character and adapt my text accordingly to fit the area where the text will appear.

So, adding padding is possible to enforce the square shape and this 10x22 could become 22x22.
It's also possible to use temporary buffers to compute the exact character size to input to get the configured output size. I mean like setting 13px to get something like 7x16 then padding to 16x16.
Unfortunately it will add a lot of blank space to do so.
If we want to reduce this blank space it could be possible to write each character to the buffer and then checking the exact space required for each of them and adapting the position where to write them on the final buffer. Nonetheless, I'm not sure about the result that can be obtained since this will change a lot the original font look.

So, is it really suited to do it with fonts that do not already have a square shape?

@davesmith00000
Copy link
Member Author

This is one of those great moments where I didn't write enough information in the original ticket, and now I'm unsure exactly what I meant.

The DF sheets are 16x16 characters. So it may be that I meant it needs to render into a 16x16 grid. Otherwise you are quite correct, and I'll bear that in mind if / when I get around to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants