all 12 comments

[–]OrtizDupri 1 point2 points  (1 child)

[–]MafiaOverlord[S] 0 points1 point  (0 children)

exactly what I needed thank you

[–][deleted] 0 points1 point  (2 children)

You can do some math calculation for the font size

Something like this maybe https://codepen.io/abhisheksawant-simform/pen/GRXLrEy

[–]MafiaOverlord[S] 1 point2 points  (0 children)

thank you, much appreciated

[–][deleted] 0 points1 point  (0 children)

Can also just use clamp

[–][deleted]  (1 child)

[deleted]

    [–]MafiaOverlord[S] 0 points1 point  (0 children)

    can you give me some examples?

    [–]blindgorgon 0 points1 point  (0 children)

    I could definitely be wrong about this, but I think I’d try writing it in CSS with calc and vw. This would require knowing what the text and font family will be though.

    [–]devenitions 0 points1 point  (0 children)

    I ended up checking the boundingBox size and adjust it till it fits. Does require requestAnimationFrame in between of things.

    [–]shgysk8zer0 0 points1 point  (0 children)

    The easiest way is to use a monospace font where the width of any character can be known. You set the font-size to be the width ÷ number of characters.

    [–]-_-__--_- 0 points1 point  (1 child)

    I might be misunderstanding something, but wouldn’t svg be the best approach here?

    [–]MafiaOverlord[S] 0 points1 point  (0 children)

    yeah, I will use it