Questions(or feature request?) about pyglet.text.*

21 views
Skip to first unread message

Proton

unread,
Jan 31, 2012, 3:26:52 AM1/31/12
to pyglet-users
Hi all,

I'm currently writing a simple game, and used pyglet.text.layout,
but the 2 things below makes me crazy ->
:: layouts have an attribute called 'wrap', if true, layout will break
long lines from spaces,
if a single long word exceeds layout width, it won't snap but just
overflow.
This may not be a problem for English(or sth. similar) users, since
there's always spaces,
but for chinese it won't wrap at all.
I tried to insert ZWSP(Zero width space) character after chinese
chars, but they appear as
little boxes, not 'zero width'

:: Is there any means to add attributed/html text to a document
incrementally?
pyglet.text.decode_attributed always return a new document,
if i want to append some more text, i have to
decode_attributed(the_whole_text + new_text),
and the speed is unacceptable.
currently i use a custom grammar to achieve the same effects.

Nathan

unread,
Feb 12, 2012, 9:22:39 PM2/12/12
to pyglet...@googlegroups.com

Have you tried the latest version of pyglet from the repository? I
looked at pyglet.text.layout in the repository, and it appears you can
also pass 'char' as an argument to the wrap parameter, which will
cause it to wrap at any character.

~ Nathan

Bruce Smith

unread,
Feb 13, 2012, 9:10:53 PM2/13/12
to pyglet...@googlegroups.com
On Tue, Jan 31, 2012 at 12:26 AM, Proton <feis...@gmail.com> wrote:
...

:: Is there any means to add attributed/html text to a document
incrementally?...

Yes. I forget the details, but there is an easy way to change text attributes on any subrange of text. There is an example program in the repository that has a simple text editor with operations to set the selected text to bold or italic, which shows how.

- Bruce
 

Reply all
Reply to author
Forward
0 new messages