Fixed Width Fonts #2
Mark Swindell
mdswindell at cruzio.com
Tue Mar 11 16:21:56 EDT 2008
I'm not sure why it showed up two months later, either. I think we
figured out how to achieve a desired result back then. There was some
helpful discussion at the time.
Mark
On Mar 11, 2008, at 10:33 AM, Len Morgan wrote:
> I'm not sure why this message just showed up in my mailbox (it's
> almost 2 months old!) but is it possible that the field actually has
> to be rendered in order to measure the formatedWidth? I'm not sure
> how you'd know except maybe to set the fields and then have a
> handler on the second field that would be triggered AFTER it has
> been written to.
>
> Just a guess
>
> len morgan
>
> Mark Swindell wrote:
>>
>> On Jan 27, 2008, at 3:54 PM, Scott Rossi wrote:
>>
>>> Recently, Mark Swindell wrote:
>>>
>>>> Is there for Rev to determine which system fonts are of fixed
>>>> width?
>>>> If not directly, then indirectly? Comparing widths of "i" and
>>>> "w" on
>>>> a font by font basis? How might this work?
>>>
>>> Tried your idea using the following: Created two 18pt text
>>> fields, put "W"
>>> into fld 1, "I" into field 2, ran the following function:
>>>
>>> return (formattedWidth of fld 1 = formattedWidth of fld 2)
>>>
>>> Results were false with Rev's default font, true with Monaco and
>>> Apple Mono
>>> (OS X).
>>>
>>> Seems like a valid direction.
>>>
>>> Regards,
>>>
>>> Scott Rossi
>>> Creative Director
>>> Tactile Media, Multimedia & Design
>>>
>>
>> Scott,
>>
>> Thanks for your help. Curious thing, though. I created a script
>> ( below) which works fine when I run it line by line in the
>> debugger, and _sometimes_ when I run it from a button, and then the
>> next time(s), from the same button, it just chugs along and and
>> returns nothing. Any ideas?
>>
>> on mouseUp
>> global gFixedWidthFonts
>>
>> put empty into field "fixedWidth" of cd 1 of stack "FixedWidth"
>> put "iiiii" into field "skinnyLetter" of cd 1 of stack
>> "FixedWidth"
>> put "wwwww" into field "fatLetter" of cd 1 stack "FixedWidth"
>>
>> put the fontnames into vAvailableFonts
>> sort lines of vAvailableFonts
>>
>> repeat with x = 1 to the number of lines of
>> vAvailableFonts set the textfont of field "skinnyLetter"
>> to line x of vAvailableFonts
>> set the textfont of field "fatLetter" to line x of
>> vAvailableFonts
>>
>> wait .05 seconds -- needs time to evaluate, maybe? dunno
>> put the formattedwidth of fld "skinnyLetter" into vSkinny
>> put the formattedwidth of fld "fatLetter" into vFat
>>
>> if vSkinny = vFat then
>> put line x of vAvailableFonts &return after field
>> "FixedWidth" of cd 1 of stack "FixedWidth"
>> end if
>>
>> end repeat
>>
>> put field "FixedWidth" into gFixedWidthFonts
>> end mouseUp
>> _______________________________________________
>> 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
>>
>>
> _______________________________________________
> 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
>
Thanks,
Mark
More information about the use-livecode
mailing list