textHeight and textSize
Ferdinand
fwvo at planet.nl
Mon Apr 23 15:24:22 EDT 2007
So I did the scripting like below.
But I wish there was a "fontHeight" property in Revolution... :-(
-- find size ratio...
-- field "fontRatio" is a table like this:
Arial, 1.14583
Comic Sans MS, 1.39583
Courier New, 1.13542
Geneva, 1.33333
Gill Sans, 1.14583
Helvetica, 1.19792
Palatino, 1.32292
Times, 1.19792
Times New Roman, 1.15625
Verdana, 1.21875
Zapfino, 3.375
put (4/3) into myRatio -- default
put lineoffset (the effective textFont of field "text" & ",",
field "fontRatio") into myline
if myline > 0 and item 2 of line myline of field "fontRatio" is
not empty then
put (item 2 of line myline of field "fontRatio") into myRatio
end if
set the textHeight of field "text" to round (myRatio * the
textSize of field "text")
> Thanks for your time and answer.
>
> Setting the font works fine here. I try to be more specific with my
> point:
>
> I need the exact line height needed for the font and font size. So
> the font fits exactly in the line.
> For example:
>
> For the font "Arial" with a size of 96 pts, the line height should
> be 110 pts to fit the font exactly.
> But for the font "Zapfino" with a size of 96 pts it should be 324 pts.
> And "Verdana" needs 117 pts to fit on a line. (with a font size of 96)
>
> (i checked this on the texteditor on my Mac... )
>
> It would be nice if there was a way to find this out and program it
> within Revolution.
> Otherwise I think I need to make a table with the font name and the
> line height/font size ratio...
>
> I hope I made my point clear this time, and I am sorry if it was
> not before...
>
> thanks again for your time.
>
> Ferdinand.
>
>
>
> simplsol at aol.com wrote:
>
>> With textSize it's either automatic or manual.
>> To make manual adjustments:
>> First set choose the textFont and textSize from the Text
>> Formatting Palette
>> Second choose the textHeight from the Basic Properties Palette
>> ANY change to the first palette will change the textHeight to
>> Rev's default (not just textSize changes).
>> You can set a typeface or font for the entire stack, rather than
>> field by field and button by button, if you want. However any
>> fields or buttons that already have a typeface selected will not
>> have it overrided. So if you are going for a global typeface
>> change run a script similar to this:
>> repeat with i = 1 to the number of flds
>> set the textFont of fld i to empty
>> set the textSize of fld i to empty
>> set the textHeight of fld i to empty
>> end repeat
>>
>> Paul Looney
>>
>>>
>>>
>>> Hi All,
>>>
>>> I have some troubles with the textHeight and textSize properties.
>>>
>>> The documentation says:
>>>
>>> "
>>> If you change the field's textSize, Revolution automatically
>>> sets the textHeight to trunc(4/3 * the textSize of field). For
>>> example, if the textSize is set to 12, the textHeight is set to
>>> 16 by default. If the textSize is set to 14, the textHeight is
>>> set to 18.
>>> "
>>>
>>> With some fonts this is okay, but I have some fonts with a
>>> greater textHeight/textSize ratio. For example handwriting fonts.
>>> With these fonts the text looks not so nice in a field.
>>> Is there a way to determine the good textHeight : textSize ratio
>>> within Revolution ?
>>>
>>> Thanks for your help!
>>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list