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

Using DrawText with a different font size #2

Open
tupini07 opened this issue Nov 30, 2022 · 3 comments
Open

Using DrawText with a different font size #2

tupini07 opened this issue Nov 30, 2022 · 3 comments

Comments

@tupini07
Copy link
Contributor

hi! First of all, I wanted to thank you for publishing this project 😄 I've wanted to start using MonoGame for a while now, but I always got discouraged by its complexity and I'm finding PlayPlayMini provides just the right level of abstraction.

Anyway, I wanted to ask whether it was possible to use Graphics.DrawText to draw some text with varying font sizes. Right now, unless I'm mistaken, it seems to be taking the font size directly from what I specify when initializing FontMeta.

I know scaling fonts can create a whole lot of issues, but I was just curious whether this was possible as it is right now.

@BenMakesGames
Copy link
Owner

BenMakesGames commented Nov 30, 2022

hm! that isn't possible right now, no. the only work around I can think of is creating different sizes yourself. the various DrawText methods return the coordinates they left off at, so you might even be able to string DrawText calls together, one after another, to change font size as you go??? I haven't tried that - there may be issues.

anyway, sorry: you've definitely identified a limitation. I'll keep that in mind as a possible, future improvement.

can you tell me more about the effect you're aiming for, with multiple font sizes? the easiest thing for me to implement would probably be some integer size multiplier as an additional parameter to the DrawText methods... but I don't know if that would actually let you accomplish what you're trying to do!

@tupini07
Copy link
Contributor Author

tupini07 commented Dec 1, 2022

hm! that isn't possible right now, no. the only work around I can think of is creating different sizes yourself

Yeah that's what I ended up doing 😅

the easiest thing for me to implement would probably be some integer size multiplier as an additional parameter to the DrawText methods

That would perfectly cover the use case I was thinking of!

I'm sorry if I didn't explain myself correctly in the original issue description. Let me add an example. Suppose you load a single font and you want to use that same font for the title, menu options, chat bubbles, etc. It is very likely that you want each of those items to have different font size. For example, the title might be bigger that the menu options, and so on.

@tupini07
Copy link
Contributor Author

I've been thinking and another option in the meantime is to just use different-sized font files! As a side question, is there an easy way to produce font png's starting from, say, a .otf font file? I saw imagemagic can kind of do it (create a png for a font), but the produced image does not seem to be loaded correctly in PlayPlayMini (the letters are out of order and partially overlapping).

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

No branches or pull requests

2 participants