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

Select font_face by font name string #1773

Open
dansimco opened this issue Mar 20, 2024 · 5 comments
Open

Select font_face by font name string #1773

dansimco opened this issue Mar 20, 2024 · 5 comments

Comments

@dansimco
Copy link
Contributor

This is something I'm interested in implementing, opening an issue here to discuss feasibility and potential pitfalls.

Assuming this is a desirable feature, would it be preferable to add a check if the input to screen.font_face(i) is number or a string, or would it be best a separate function. Separate function seems noisier but I'm wondering if doing a string check inside redraw loop is wasted cycles.

@tehn
Copy link
Member

tehn commented Mar 20, 2024

this is an incredibly reasonable proposition!

can be the same function and check arg type.

@tehn
Copy link
Member

tehn commented Mar 20, 2024

ah, just sunk in that it'd be called a lot in the redraw. there's likely an optimized approach, let's think on it.

@dansimco
Copy link
Contributor Author

I don't love this idea, but there's potentially a get_font_index(str) angle here to do the lookup manually.

@tehn
Copy link
Member

tehn commented Mar 20, 2024 via email

@dansimco
Copy link
Contributor Author

dansimco commented Mar 21, 2024

That might be enough? Thinking about this for a couple of days, of all the logic I've shoved into the redraw loop, these checks would not be the biggest offender by a long shot.

edit: How might we measure the impact of a particular approach?

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