building a font picker

Alex Rice alrice at ARCplanning.com
Fri Jul 18 20:43:50 EDT 2003


I'm building a font picker using a list field and htmlText. I have a 
checkbox to filter out non-fixed width fonts. My function for deciding 
if a font is fixed width is

--
-- isFixedWidthFont()
--
function isFixedWidthFont pFontFaceName
   if pFontFaceName = empty then
     return "false"
   end if
   set the textFont of fld "fixedWidth1" to pFontFaceName
   set the textFont of fld "fixedWidth2" to pFontFaceName
   put the formattedWidth of fld "fixedWidth1" into twd1
   put the formattedWidth of fld "fixedWidth2" into twd2
   return (twd1 = twd2)
end isFixedWidthFont

fixedWidth1 has the lower-case alphabet and fixedWidth2 has the upper 
case alphabet.

1) Is there a way that's faster than this? If the user had lots of 
fonts on their system, it would take a bit to grind through them all.

2) On Mac OS X, this yields the list

#PCÌ¡ 12
Andale Mono 12
Courier 12
Courier CE 12
Courier New 12
Letter Gothic MT 12
Letter Gothic MT Bold 12
Letter Gothic MT Bold Oblique 12
Letter Gothic MT Oblique 12
Monaco 12
Monaco CE 12
OsakaÅ|ìôïù 12
VT100 12

Now- Courier, Courier New, Monaco, Andale Mono, and VT100 all were 
expected. I wasn't expecting Letter Gothic, but it does appear to be 
fixed width.

But what are the "CE" fonts?

Letter Gothic seems strange also: it has it's available styles listed 
in the font names list (bold, obl, bold/obl).

3) The "CE" fonts as well as Letter Gothic fonts do not scale when I 
change the point size in the htmlText of the field. What is different 
about these fonts?

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
http://ARCplanning.com




More information about the use-livecode mailing list