Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Crashing Due to Bad BBox Calculation #92

Open
speedplane opened this issue Jan 19, 2015 · 0 comments
Open

Crashing Due to Bad BBox Calculation #92

speedplane opened this issue Jan 19, 2015 · 0 comments

Comments

@speedplane
Copy link

In layout.py, we're calculating the bbox incorrectly, which is leading to crashes with certain PDFs.

 def __init__(self, name, bbox, matrix):
        self.name = name
        self.matrix = matrix
        (x, y, w, h) = bbox
        bbox = get_bound(apply_matrix_pt(matrix, (p, q))
                         for (p, q) in ((x, y), (x+w, y), (x, y+h), (x+w, y+h)))
        LTLayoutContainer.__init__(self, bbox)
        return

Should be Changed to:

def __init__(self, name, bbox, matrix):
        self.name = name
        self.matrix = matrix
        (x0, y0, x1, y1) = bbox
        points = [apply_matrix_pt(matrix, p) 
            for p in [(x0, y0), (x1, y0), (x0, y1), (x1, y1)]]
        bbox = get_bound(points)
        LTLayoutContainer.__init__(self, bbox)
        return

Here is a link to the PDF where this crashes.

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

No branches or pull requests

1 participant