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.

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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to