17cupsofcoffee / tetra

🎮 A simple 2D game framework written in Rust
MIT License
909 stars 63 forks source link

Tall characters break Text bounds calculation #240

Closed tesselode closed 3 years ago

tesselode commented 3 years ago

Summary: Text::get_bounds returns incorrect Rectangles when the first character is not the tallest one in the string.

Steps to reproduce: Create any Text where one of the characters after the first character is taller than the first. The longer the string is, the more the Rectangle returned by Text::get_bounds will be shifted below where it should be.

https://user-images.githubusercontent.com/2637802/107469961-aaa1c080-6b38-11eb-8c93-be85c15187d1.mp4

Expected behavior: The Rectangle should correctly surround the visible bounds of the Text.