monome / norns

norns is many sound instruments.
http://monome.org
GNU General Public License v3.0
630 stars 145 forks source link

Select font_face by font name string #1773

Open dansimco opened 6 months ago

dansimco commented 6 months ago

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 commented 6 months ago

this is an incredibly reasonable proposition!

can be the same function and check arg type.

tehn commented 6 months ago

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 commented 6 months ago

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

tehn commented 6 months ago

i'm wondering if passing the string to the C layer is faster than just having a lookup table within lua

On Wed, Mar 20, 2024 at 11:53 AM Dan Sim @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/monome/norns/issues/1773#issuecomment-2009910254, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB4I4GCCTOVJD6RARYMQWLYZGWHPAVCNFSM6AAAAABE7QIIEWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBZHEYTAMRVGQ . You are receiving this because you commented.Message ID: @.***>

dansimco commented 6 months ago

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?