justification in gr.text (graphics)
Oldbitcollector (Jeff)
Posts: 8,091
I'm attempting to do some calculated placement of text using "graphics"
I suspect that the 'justification' settings are getting in the way.
With this example, the placement of 0,0 should have set the "A" at left/middle of the screen,
instead it's middle/middle. I suspect it has to do with the 5 in the 'gr.textmode' command,
but I can't understand the bits explanation in graphics. It's as if it's auto-centering.
Could someone tell me how to turn the 'justify' off that is centering the text based on content?
I'd like to define the exact position of the text with col,row
If I add a few more letters to the string (change the "a" to "Jeff Ledger') then it starts to behave the way
I'd like it to. This still is a problem for me as I want exact placement of one letter at a time.
[noparse][[/noparse]Can this be done? Or do I just not see it?]
thanks!
Oldbitcollector
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
Post Edited (Oldbitcollector) : 9/17/2007 1:18:33 AM GMT
I suspect that the 'justification' settings are getting in the way.
gr.textmode(1,1,6,5) ' width, height, spacing gr.colorwidth(2,0) ' color, width gr.text(0,0,string("a"))
With this example, the placement of 0,0 should have set the "A" at left/middle of the screen,
instead it's middle/middle. I suspect it has to do with the 5 in the 'gr.textmode' command,
but I can't understand the bits explanation in graphics. It's as if it's auto-centering.
Could someone tell me how to turn the 'justify' off that is centering the text based on content?
I'd like to define the exact position of the text with col,row
If I add a few more letters to the string (change the "a" to "Jeff Ledger') then it starts to behave the way
I'd like it to. This still is a problem for me as I want exact placement of one letter at a time.
[noparse][[/noparse]Can this be done? Or do I just not see it?]
thanks!
Oldbitcollector
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
Post Edited (Oldbitcollector) : 9/17/2007 1:18:33 AM GMT
Comments
I used a loop to write 1 letter at a time. I used the loop-variable as part of the calculation to determine the horizontal position.
-78 is how far to the left I wanted to start
* 12 is the width of each letter
FreqCounter is the Nth letter in the string (My string was 13 characters long)
example:
Nice routine! Perhaps one of the .spin 'gods' might look at graphics to repair this issue.
In the meantime, it seems I could simply pad the character with 12 empty spaces since all
I'm doing in writing text left-to-right. As long as I keep track of my position, it "should"
work.
Oldbitcollector
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
So "5" WILL center the strings.
Are you really sure it does not work with "0"??