- Mar 2, 2012
- Reaction score
- First Language
- Primarily Uses
Text Cache v 1.03Introduction
VX Ace is a huge improvement over VX in many different ways. However, although text processing has a number of new features, it has also introduced a number of new bugs.
- Text is squeezed when drawn to the rect given by text_size. Subsequent text shrinking also occurs long before needed.
- Bitmap#draw_text wraps around on itself after ~640 pixels.
- Individually drawn characters for certain fonts are drawn incorrectly
- Implements a text cache. Trades a small amount of memory for a large amount of processing speed (~2 to 5x as fast for most strings).
- Draws each character with padding, accounting for its actual size when placed adjacent other characters. Each character is now drawn consistently whether it is drawn independently or not.
- Automatically uses original method when dealing with "squeezed" text (manually squeezing text looks terrible, so this was left in)
How to Use
Install on its own script page in the materials section of the script editor above main and below default scripts.
q. Any simpler way to handle this?
a. Add two pixels to width before attempting to draw text to its own text_size rect. Split up any string longer than 640 text_size width and draw each piece successively (or don't draw strings longer than 640 text_size width, you'd only need them for horizontally scrolling windows). Use a non-TrueType Font (like the default one, I believe). Following these three rules you'll likely never run into any of the bugs fixed by this script. This script will still allow faster text processing, if you choose to use it.
q. I'm using draw_text every frame, it still lags.
a. This script is not a substitute for poor procedures. draw_text is still very time consuming, and should be using sparingly as before.
Credit and Thanks
May be distributed with a link to these forums, original unedited script, and with credit. May be used in any project, so long as the credit in the script remains intact (individual credit in the project as a whole is not required).
If you have a crashing bug, please provide the complete error code as well as a short description on how to reproduce. If you have a display bug, please include a screenshot and a short description.
Last edited by a moderator: