Confining text to text box limits

stevenshepherd

New member
I really like the addition of the green box that shows how your text will fit in the text box. However, even with that, I am going back and forth a lot editing it, finding that somehow text keeps going over the edge. It would also be nice to be able to auto center it as well. I don't really like my text going right to the edge (like to have a bit of buffer on each side) just as a personal preference. I also like it all centered as opposed to left justified.

Of course, I could be missing something completely about the textbox that makes this moot. It might not be possible either. Just thought I would mention it :)
 

FrankenGraphics

New member
I haven't had time to play around with the text function, but you'd only be wasting 1 byte per row if you let it begin with an empty space tile to create a padded left adjustment. You can fake center-adjusted texts the same way if there isn't a routine to let the printout know on what x offset to begin a row.

General tip: Sometimes you need to space words with two tiles to have it look aesthetically formatted that goes for center-adjusted and box-spread text especially.
 

stevenshepherd

New member
Thanks for the suggestions. I have basically been trying to do that but it is a bit of a pain. In some cases I have to have several spaces because I can't fit the next word on a line. Each space takes up a character and you can only have 256 characters per textbook.
 

FrankenGraphics

New member
I took a really quick glance in the files. In macros, there's a function called DrawText.asm. It'll call the more general function getUpdateTileOffsetPosition. You don't want to modify that one if it is used elsewhere. But in DrawText.asm, you should be able to replace the following:

Code:
LDA arg0
STA tileX
LDA arg1
STA tileY

with

Code:
LDA arg0
INC
STA tileX
LDA arg1
INC
STA tileY

to get a hard-wired permanent padding by adding an offset of 1 tile on both x and y axes. If you only want padding on the x axis (indentation), remove the INC before "STA tileY". Let me know if that worked. You're still left to manual editing to ensure that the text doesn't go out of bounds, though.

This is also the place where you could add center-alignment. On top of my head, if you can get the length of the text string (needs a new routine to count it, i'm afraid - that's the stuff that comes for free in high level languages (like so: len(myString)) but needs to be coded when in assembly), then divide it by 2 to get the center aligned offset, then store it in a user variable (let's call it MyCenterAlignmentVariable), then replace the x-axis "INC" with "ADC MyCenterAlignmentVariable". Note that without any decisionmaking, ALL text printout will then be center aligned.
 
Top Bottom