image-rs / imageproc

Image processing operations
MIT License
758 stars 149 forks source link

Introduce text_size_info and change back where text is positioned #692

Open vbfox opened 3 weeks ago

vbfox commented 3 weeks ago

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:

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.