| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
import fontforge |
| 7 |
|
| 8 |
f=fontforge.open("../test.sfd") |
| 9 |
g = f['A'] |
| 10 |
l = g.layers[g.activeLayer] |
| 11 |
c = l[0] |
| 12 |
|
| 13 |
fontforge.logWarning( "have glyph : " + g.glyphname ) |
| 14 |
fontforge.logWarning( "glyph has layer count: " + str(len(g.layers))) |
| 15 |
fontforge.logWarning( "glyph has active layer: " + str(g.activeLayer) ) |
| 16 |
fontforge.logWarning( "layer has contour count: " + str(len(l))) |
| 17 |
fontforge.logWarning( "contour.is_quad: " + str(c.is_quadratic)) |
| 18 |
fontforge.logWarning( "contour.len : " + str(len(c))) |
| 19 |
|
| 20 |
|
| 21 |
mag = 2 |
| 22 |
|
| 23 |
for x in range(0, len(c)): |
| 24 |
p = c[x] |
| 25 |
fontforge.logWarning( "old x:" + str(p.x) + " y:" + str(p.y) ) |
| 26 |
p.x = p.x * mag |
| 27 |
p.y = p.y * mag |
| 28 |
|
| 29 |
for x in range(0, len(c)): |
| 30 |
p = c[x] |
| 31 |
fontforge.logWarning( "new x:" + str(p.x) + " y:" + str(p.y) ) |
| 32 |
|
| 33 |
g.layers[g.activeLayer] = l |
| 34 |
|
| 35 |
fontforge.logWarning( "saving..." ) |
| 36 |
f.save("/tmp/out.sfd") |
| 37 |
|
| 38 |
|
| 39 |
fontforge.logWarning( "script is done. output at /tmp/out.sfd" ) |