text example update
This commit is contained in:
parent
cacd430c7d
commit
0dabb6ae63
|
@ -1,13 +1,44 @@
|
||||||
import axi
|
import axi
|
||||||
|
|
||||||
|
LINES = [
|
||||||
|
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor',
|
||||||
|
'incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis',
|
||||||
|
'nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
|
||||||
|
'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu',
|
||||||
|
'fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in',
|
||||||
|
'culpa qui officia deserunt mollit anim id est laborum.',
|
||||||
|
]
|
||||||
|
|
||||||
|
LINES = [
|
||||||
|
'When you wish upon a star',
|
||||||
|
'Makes no difference who you are',
|
||||||
|
'Anything your heart desires will come to you',
|
||||||
|
]
|
||||||
|
|
||||||
|
def stack_drawings(ds, spacing=0):
|
||||||
|
result = axi.Drawing()
|
||||||
|
y = 0
|
||||||
|
for d in ds:
|
||||||
|
d = d.origin().translate(-d.width / 2, y)
|
||||||
|
result.add(d)
|
||||||
|
y += d.height + spacing
|
||||||
|
return result
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
text = 'Hello, world!'
|
font = axi.SCRIPTS
|
||||||
font = axi.FUTURAL
|
ds = [axi.Drawing(axi.text(line, font)).scale_to_fit_height(1) for line in LINES]
|
||||||
d = axi.Drawing(axi.text(text, font))
|
d = stack_drawings(ds, 0.1)
|
||||||
# d = d.rotate_and_scale_to_fit(12, 8.5, step=90)
|
# d = d.rotate_and_scale_to_fit(12, 8.5, step=90)
|
||||||
d = d.scale(0.01, 0.01)
|
# d = d.scale(0.02, 0.02)
|
||||||
d = d.center(12, 8.5)
|
# d = d.center(12, 8.5)
|
||||||
|
# d = d.move(0, 0, 0, 0)
|
||||||
|
d = d.scale_to_fit(12, 8.5)
|
||||||
|
# d = d.center(12, 8.5)
|
||||||
|
d = d.move(6, 0, 0.5, 0)
|
||||||
|
d = d.translate(0, 0.01)
|
||||||
|
d = d.join_paths(0.01)
|
||||||
d.render().write_to_png('out.png')
|
d.render().write_to_png('out.png')
|
||||||
|
print sum(x.t for x in axi.Device().plan_drawing(d))
|
||||||
# axi.draw(d)
|
# axi.draw(d)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue