★ wanayoo — archive 1999 https://github.com/libtcod/python-tcod/issues/75Nouvelle recherche | Portail wanayoo
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

Better options for TrueType Fonts. #75

Open
jsbeckr opened this issue May 13, 2019 · 2 comments
Open

Better options for TrueType Fonts. #75

jsbeckr opened this issue May 13, 2019 · 2 comments
Assignees
Labels

Comments

@jsbeckr
Copy link

@jsbeckr jsbeckr commented May 13, 2019

Hey! :)

I was playing around with TrueType fonts (OpenSans, Courier New, Fira Code) on MacOS. And it seems that the font is rendered to small in comparison to the tile size.

image

tcod.tileset.set_truetype_font("data/OpenSans-Regular.ttf", 24, 24)

Is it possible to control the size of the font inside a tile?

There is also an issue with Fira Code (it doesn't render correctly). But I think that might be the custom glyphs they included in the font?

@HexDecimal HexDecimal self-assigned this May 13, 2019
@HexDecimal
Copy link
Collaborator

@HexDecimal HexDecimal commented May 13, 2019

As far I've gotten the best option is to exclude the width (use a width of 0) of the font, then the font loader will automatically pick the width with the best fit. If you pick both a width and height then the font will be scaled down to fit without stretching it. The best results will come from fonts designed to be used as monospace fonts.

There's no options for fine tuning the font size, but now is a good time to make suggestions.

@jsbeckr
Copy link
Author

@jsbeckr jsbeckr commented May 14, 2019

I guess if I could wish for an API I would like the following:

tcod.tileset.set_truetype_font("data/OpenSans-Regular.ttf", 24, 24, font_size=16, antialiasing=True)

It would be cool to set an anchor point for the tiles where the bounding box of the font sits. Something like upper_left, bottom_right, etc. Which could enable nice effects like distinguishing small and big items for example?

@HexDecimal HexDecimal changed the title How to use TrueType Fonts correctly? Better options for TrueType Fonts. May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.