| 1 |
py |
| 2 |
|
| 3 |
import sys, fontforge |
| 4 |
|
| 5 |
font = fontforge.open(sys.argv[1]) |
| 6 |
|
| 7 |
expected = (63.0, 57.0, 315.0, 309.0) |
| 8 |
assert font[0].boundingBox() == expected |
| 9 |
assert font[1].boundingBox(layer=1) == expected |
| 10 |
nullbb = (0.0, 0.0, 0.0, 0.0) |
| 11 |
assert font[1].boundingBox(layer=0) == nullbb |
| 12 |
|
| 13 |
expected = (63.0, 57.0, 315.0, 711.0) |
| 14 |
assert font[2].boundingBox() == expected |
| 15 |
expected = (63.0, 459.0, 315.0, 711.0) |
| 16 |
assert font[2].boundingBox(layer=2) == expected |
| 17 |
|
| 18 |
xmin, ymin, xmax, ymax = font[2].boundingBox() |
| 19 |
|
| 20 |
assert (xmin, xmax) == font[2].xBoundsAtY(ymin, ymax) |
| 21 |
assert font[2].xBoundsAtY(ymax+1) == None |
| 22 |
|
| 23 |
assert (ymin, ymax) == font[2].yBoundsAtX(xmin, xmax) |
| 24 |
assert font[2].yBoundsAtX(xmax+1) == None |