Set the paragraph style wrap to " char "
.
python
document = pyglet.text.decode_text(text_data)
document.set_style(0, 0, {
"color": (255,255,255,255),
"line_spacing": 24,
"wrap": "char"
})
layout = pyglet.text.layout.TextLayout(document, 640, 480,
multiline=True, batch=batch)
It was prepared properly. I was about to write a wrapping text layout on my own.
In addition to " char "
, " word ", True, False
can be set for wrap.
" word "
is the same as True
.
Recommended Posts