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:
- https://www.w3schools.com/tags/canvas_font.asp
- https://www.w3schools.com/tags/playcanvas.asp?filename=playcanvas_fontweight
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!