[HTML5] Canvas font-weight support

Currently OpenFL 5.1.5 only supports bold or normal for the canvas context font property’s weight segment.

https://github.com/openfl/openfl/blob/develop/openfl/_internal/text/TextEngine.hx#L299

I’d like to start a conversation on how we would / should approach getting support for all the possible values:

E.g. Load a Google font - https://fonts.google.com/specimen/Roboto?selection.family=Roboto [customize to add more weights]. The only way to access the weight variants is to set the font-weight segment.

My suggestion would be to add a html5 only property to TextFormat called weight as a abstract enum with all the supported values.

I’m happy to start with the PR, but it’s possibly a API disruptor, so I’d like some input.

Thanks!

1 Like

I’ve created a PR: https://github.com/openfl/openfl/pull/1625

A post was split to a new topic: Possible to set the font weight on HTML5?

Hi, I wish I could help you. I’m so far removed from this now I won’t be of much help. Good luck!!

I’m sorry I’ve dragged you back into it then @Matan, but I appreciate you providing the clarity you did.

I’ve started a new topic for this now (as I probably should have in the first place).

Aaah, no worries! Was nice seeing some of the old days! Unfortunately haxe/openfl isn’t part of my day to day anymore.