New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve speed of text(x, y, w, h) when using large strings with no spaces #211

Closed
processing-bugs opened this Issue Feb 10, 2013 · 4 comments

Comments

Projects
None yet
2 participants
@processing-bugs

processing-bugs commented Feb 10, 2013

Original author: b...@processing.org (June 07, 2010 01:13:51)

This bug automatically added from:
http://dev.processing.org/bugs/show_bug.cgi?id=1207

Comment from mkn, 2009-03-15 07:55

  1. Using long strings of characters without any breaking ones stops execution.
  2. There is no way to turn off wrapping of entire words? Nothing in the
    Processing JavaDoc either (AFAICouldFindWithGoogle). A lil boolean would
    do. :)

Original issue: http://code.google.com/p/processing/issues/detail?id=172

@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

processing-bugs Feb 10, 2013

From b...@processing.org on June 07, 2010 01:13:52
Comment from fry, 2009-03-15 10:25

please post a short sketch (then use archive sketch, and attach it to the
bug report), i don't quite follow.

processing-bugs commented Feb 10, 2013

From b...@processing.org on June 07, 2010 01:13:52
Comment from fry, 2009-03-15 10:25

please post a short sketch (then use archive sketch, and attach it to the
bug report), i don't quite follow.

@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

processing-bugs Feb 10, 2013

From b...@processing.org on June 07, 2010 01:13:52
Comment from mkn, 2009-03-16 03:40

Created an attachment (id=299)
Simple code to illustrate text() rendering lag

processing-bugs commented Feb 10, 2013

From b...@processing.org on June 07, 2010 01:13:52
Comment from mkn, 2009-03-16 03:40

Created an attachment (id=299)
Simple code to illustrate text() rendering lag

@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

processing-bugs Feb 10, 2013

From b...@processing.org on June 07, 2010 01:13:53
Comment from mkn, 2009-03-16 03:41

  1. Aha. Spotted it. It seems that the cocktail of large fonts and a very
    long string without spaces is a bad one. When the above fed to text(), P5
    renders the entire string even though only a fragment is visible, thus
    taking so long time that execution seems to be halted as no indication is
    given of what is going on.

This means that text() currently relies on spaces (and \n) for preliminary
segmentation before rendering. (Arguably this might be up to the user to
know his/her code, so maybe just a warning in the console would be enough.)

  1. The way text() works now is that it wraps words automatically to the
    next row, which is a good default setting. It would be useful with a flag
    to simply wrap per character instead, like text.wordWrap(false) (Maybe
    there is, but I couldn't find it in the JavaDoc), or optional by
    punctuation (as mentioned above), like text.wordWrap( WRAP_WORDS |
    WRAP_CHARS | WRAP_PUNCTUATIONS | ... ) for future proof extendability.

PS. Um, yeah. Sorry about that initial bug report. It was not very useful.
Tired etc. :)

processing-bugs commented Feb 10, 2013

From b...@processing.org on June 07, 2010 01:13:53
Comment from mkn, 2009-03-16 03:41

  1. Aha. Spotted it. It seems that the cocktail of large fonts and a very
    long string without spaces is a bad one. When the above fed to text(), P5
    renders the entire string even though only a fragment is visible, thus
    taking so long time that execution seems to be halted as no indication is
    given of what is going on.

This means that text() currently relies on spaces (and \n) for preliminary
segmentation before rendering. (Arguably this might be up to the user to
know his/her code, so maybe just a warning in the console would be enough.)

  1. The way text() works now is that it wraps words automatically to the
    next row, which is a good default setting. It would be useful with a flag
    to simply wrap per character instead, like text.wordWrap(false) (Maybe
    there is, but I couldn't find it in the JavaDoc), or optional by
    punctuation (as mentioned above), like text.wordWrap( WRAP_WORDS |
    WRAP_CHARS | WRAP_PUNCTUATIONS | ... ) for future proof extendability.

PS. Um, yeah. Sorry about that initial bug report. It was not very useful.
Tired etc. :)

@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

processing-bugs Feb 10, 2013

From b...@processing.org on June 07, 2010 01:13:53
Comment from fry, 2009-03-17 15:31

as far as i can tell, this isn't a bug--it's just slow when you have
exceptionally long lines with no spaces, so i'll mark this as an
enhancement request. (it's also gonna depend on your machine, java version,
renderer setting, etc...)

if a word doesn't fit on the line, it breaks and wraps to the next row the
same way as text blocks work in other programs (such as page layout software).

processing-bugs commented Feb 10, 2013

From b...@processing.org on June 07, 2010 01:13:53
Comment from fry, 2009-03-17 15:31

as far as i can tell, this isn't a bug--it's just slow when you have
exceptionally long lines with no spaces, so i'll mark this as an
enhancement request. (it's also gonna depend on your machine, java version,
renderer setting, etc...)

if a word doesn't fit on the line, it breaks and wraps to the next row the
same way as text blocks work in other programs (such as page layout software).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment