Beispiel #1
0
def find_box_extrema(boxes):
    """Returns a BoxLine with the extreme values of the boxes."""
    left = min(b.left for b in boxes)
    right = max(b.right for b in boxes)
    bottom = min(b.bottom for b in boxes)
    top = max(b.top for b in boxes)
    page = max(b.page for b in boxes)
    return BoxLine('', left, top, right, bottom, page)
Beispiel #2
0
def test_nosplit():
    box = BoxLine.parse_line('C 79 405 90 420 0')
    boxes = split_box(box)
    eq_(['C 79 405 90 420 0'], [str(x) for x in boxes])
Beispiel #3
0
def test_split22():
    box = BoxLine.parse_line('C 66 405 88 420 0')
    boxes = split_box(box)
    eq_(['C 66 405 77 420 0', 'C 77 405 88 420 0'], [str(x) for x in boxes])
Beispiel #4
0
def padded_box(box, pad_width, pad_height):
    """Adds some additional margin around the box."""
    return BoxLine(box.letter, box.left - pad_width, box.top + pad_height,
                   box.right + pad_width, box.bottom - pad_height, box.page)
def test_nosplit():
  box = BoxLine.parse_line('C 79 405 90 420 0')
  boxes = split_box(box)
  eq_(['C 79 405 90 420 0'], [str(x) for x in boxes])
def test_split22():
  box = BoxLine.parse_line('C 66 405 88 420 0')
  boxes = split_box(box)
  eq_(['C 66 405 77 420 0',
       'C 77 405 88 420 0'],
          [str(x) for x in boxes])