Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix return value of FreeTypeFont.textsize() does not include font offsets #784

Merged
merged 1 commit into from
Jul 8, 2014

Conversation

tk0miya
Copy link
Contributor

@tk0miya tk0miya commented Jul 7, 2014

Fixes #644

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0%) when pulling 60628c7 on tk0miya:master into 6c0fcef on python-pillow:master.

@wiredfool
Copy link
Member

This is going to change the rendering for anyone who's got code that uses textsize. We should be very reluctant to break peoples code like that, especially since it's a silent break that changes the behavior.

@aclark4life
Copy link
Member

True, I would deprecate in the next release & fix in the next next release. So this PR should add a deprecation warning… and nothing else. Maybe.

@wiredfool
Copy link
Member

Perhaps getBoundingBox as a new api?

We should also be thinking about incorporating some of the metrics in a decent api, so that people can place the text accurately. That had come up in an issue or two before. (a: size is lost once youmake the font, and b: metrics are very ill defined from the various methods).

@tk0miya
Copy link
Contributor Author

tk0miya commented Jul 8, 2014

In PIL-1.1.7 and Pillow-2.1.0, ImageDraw#textsize() and ImageFont.textsize() return size of bounding box for text.
but after Pillow-2.2.0, these methods return size of text (without offset).

This change came from #185 and #333.
but it seems that these pull requests do not attempt to change behavior of the methods.

So I think this is a bug fix, not a breaking change.

of course, decent APIs are welcome.
I want standard method for getting bounding box to all ImageFont subclasses.

aclark4life added a commit that referenced this pull request Jul 8, 2014
Fix return value of FreeTypeFont.textsize() does not include font offsets
@aclark4life aclark4life merged commit 962f1b4 into python-pillow:master Jul 8, 2014
@aclark4life
Copy link
Member

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImageDraw.textsize() returns incorrect textsize for truetype fonts
4 participants