Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:How to wrap text in canvas screen

From Wiki
Jump to: navigation, search

Archived.pngAquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

Article Metadata
Article
Created: cyke64 (19 Mar 2007)
Last edited: hamishwillee (31 May 2013)

Sometimes you want some text and image together, you need to use canvas. However, there's no way to calculate the length of text and wrap them properly. Simo's dashboard provide a solution to this using his akntextutils C++ extension.

from akntextutils import wrap_text_to_array
 
# long_str is a long string to be wrapped
lines = wrap_text_to_array(long_str, 'dense', 176)
 
x, y = 2, 0
for line in lines:
y += 14
canvas.text((x, y), line, font='dense')

Issue : With 3rd Edition there's a bug in the font displaying so you can use akntextutils module. Fortunately there's a workaround : you can use the unofficial enhanced graphics module from GameDude.

This page was last modified on 31 May 2013, at 01:05.
28 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×