Font.Draw With Rows / Columns (Text.Locate())?
Author |
Message |
Fexter
|
Posted: Tue May 01, 2012 9:21 pm Post subject: Font.Draw With Rows / Columns (Text.Locate())? |
|
|
What is it you are trying to achieve?
I want to be able to center text that I enter. I found a way to do this with Text.Locate(), but I need to be able to have this work for Font.Draw() as I have a special font that I am using other than the normal put font.
What is the problem you are having?
I can't seem to find a way to use rows and columns, and pixels make it a lot tougher to center the text.
Describe what you have tried to solve this problem
I have tried checking the Turing Documentation for something that would work with this.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Turing: |
procedure center (text: string)
Text.Locate(12, 40 - length(text ) div 2) % Center the text location
put text % I want to change this to Font.Draw() for my specific font
end center
center ("Hello World!")
|
Please specify what version of Turing you are using
Turing 4.1.1. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Amarylis
|
Posted: Tue May 01, 2012 9:37 pm Post subject: Re: Font.Draw With Rows / Columns (Text.Locate())? |
|
|
If you're looking for the very center of the window, then it'd be something like this
|
|
|
|
|
|
Fexter
|
Posted: Tue May 01, 2012 9:53 pm Post subject: RE:Font.Draw With Rows / Columns (Text.Locate())? |
|
|
@Amarylis
I've tried that several times, and it's never worked (The letters seem to have different lengths -- For example, the letter R is longer than l). However, Font.Width() seems to work with what I want, so I can use that.. |
|
|
|
|
|
Amarylis
|
Posted: Tue May 01, 2012 10:17 pm Post subject: RE:Font.Draw With Rows / Columns (Text.Locate())? |
|
|
..Whoops, confused length with Font.Width |
|
|
|
|
|
evildaddy911
|
Posted: Wed May 02, 2012 2:35 pm Post subject: Re: Font.Draw With Rows / Columns (Text.Locate())? |
|
|
ive had that same problem, so i made this procedure
the x is where the center of the text is located |
|
|
|
|
|
|
|