Skip to content

Fix mathtext image bounding box #4148

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

Merged
merged 4 commits into from
Feb 25, 2015
Merged

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Feb 23, 2015

This fixes #4147, so that characters with a negative depth (such as the minus sign) are not arbitrarily clipped.

Going down that rabbit hole, discovered two other bugs related to text buffers, including a buffer overrun.

Fix #4147.

@mdboom mdboom added this to the next point release milestone Feb 23, 2015
@mdboom mdboom self-assigned this Feb 23, 2015
@mdboom
Copy link
Member Author

mdboom commented Feb 23, 2015

I seem to be getting the same test failures on master as this (but Travis hasn't tested master in 5 days). Not sure what's up there...

@tacaswell
Copy link
Member

Some how travis got turned off

@mdboom
Copy link
Member Author

mdboom commented Feb 24, 2015

No worries -- in any event, it seems to be back on and master is passing. I'll restart this PR's build on Travis and see how it works now.

Oops... still turned off.

@mdboom
Copy link
Member Author

mdboom commented Feb 24, 2015

Ok -- I think we're back in business. This is ready for a final review.


for (size_t j = y0; j < y1 + 1; j++) {
for (size_t i = x0; i < x1 + 1; i++) {
for (size_t j = y0; j < y1; j++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the limits in the case where m_width is the minimum, is that intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. x0 and x1 represent an inclusive range here, i.e. to fill, say, a one pixel line at pixel 5, x0 == 5, and x1 == 5. (One could argue that's not the best interface, but it's what we have). The problem is that occasionally, the line requested goes outside of the edge of the image, and we need to protect against that at all costs (because that would be a buffer overflow). This wasn't an issue in practice until the bounds of the image was corrected to something more accurate in mathtext.py.

tacaswell added a commit that referenced this pull request Feb 25, 2015
FIX :  mathtext image bounding box
@tacaswell tacaswell merged commit 4615720 into matplotlib:master Feb 25, 2015
@mdboom mdboom deleted the minus-sign branch March 3, 2015 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problems with text that is just a LaTeX minus sign
2 participants