Closed tsnl closed 5 years ago
If no one is working on this I can work on it. I don't know how to assign myself to it
it should be done using the vw/vh modern font sizes. See this mdn wiki for info https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Values_and_units
submitted pr
Text does not scale to fit inside tiles when we resize windows. While it is ideal that fonts are rendered at a constant size (in device-independent pixels), we cannot help if a user makes their window so small, the text would otherwise be unreadable. We need a better way to scale font-sizes.
An early implementation of this repo brute-forced a range of font-sizes to find one that would fit in the tile-rectangle specified in the layout. This looked very ugly because two
Hp_TextTile
instances with text of differing length that we expect to be of the same font-size would render at different sizes.Thus, we need some way to ensure that:
Requirements:
fontSize
style property inHp._TextTile
a font size in 'em' to a size hint. Allow the designer to select from a few options, like"x-small"
,"small"
,"medium"
,"large"
,"x-large"
, e.t.c. Whatever you find appropriate.Hp._context.measureText
for this.min-width
andmin-height
properties on the canvas.Note:
updateSize
because these values could go stale if someone mutatesHp._BaseTile.tileRect
when the window isn't being resized. Also, it shouldn't be too much work to do so every frame for what will never be more than a couple elements.measureText
really helps you with).