text_size_infocan give both the box where the font wants to be logically placed to form a line (But depending on the font it might draw pixels out of this box) and the pixel-bounding box where pixels were really placed.
I know that it'll be controversial as it changes some details from #689 but I think it's the right choice:
Fonts can put pixels out of any of the "logical" bounds passed to them, most of the time it's a little overshoot but some fonts can draw widely out of their boxes. px_bounds doc essentially says "everything goes" and trying to guess the pixel size from the reported logical size by the font is bound to create errors.
Sometimes when positioning you want the logical box (To position more text after/under) and sometimes the pixels (To visually center the pixels)
By providing both, the consumer can take correct decisions.
I'm not sure what text_sizeshould return, as the logical size is bound to be a bit surprising (some pixels would go out of there) but the pixel size is useless to position text relative to other text...
I'm opening this PR more as a discussion starter, as I think whatever design ends up being the final one the coordinate system and it's relation with the sizing methods need to be documented in the draw methods.
text_size_info
can give both the box where the font wants to be logically placed to form a line (But depending on the font it might draw pixels out of this box) and the pixel-bounding box where pixels were really placed.I know that it'll be controversial as it changes some details from #689 but I think it's the right choice:
By providing both, the consumer can take correct decisions.
I'm not sure what
text_size
should return, as the logical size is bound to be a bit surprising (some pixels would go out of there) but the pixel size is useless to position text relative to other text...I'm opening this PR more as a discussion starter, as I think whatever design ends up being the final one the coordinate system and it's relation with the sizing methods need to be documented in the draw methods.