Cross-platform fonts...what is everyone else doing?

Richard Gaskin ambassador at fourthworld.com
Tue Jul 27 06:13:53 EDT 2004


Frank Leahy wrote:
> 1) Is there a hack to determine the system font at runtime on Windows?   
> Or should I just assume "MS Sans Serif"?

In XP I believe it's Verdana.   And it can be changed by the user, as on
Mac OS and most Linux window managers.

> 2) Is using a "preOpenStack" handler that runs through every control  
> and sets the textFont attribute -- at *runtime* -- the only way to do  
> what I want to do?

Not at all:  font attributes, along with color and patterns, are
inherited.  You can set things once for the stack and all objects which
don't have their own settings will be rendered with the inherited settings.

> 3) Can anyone suggest a better alternative (and no, having the user  
> install a good looking cross-platform font isn't an option :-)

I set the font for the mainStack to "0" (zero), and then set textSize
appropriate for the target platform.  Whenever the engine can't find a 
specified font it will render in the systemFont.

Scott Raney advises me not to rely on that, but in the absence of a
systemFont function I can't think of another way to avoid hard-wiring
the font name.  Besides, any font vendor that names a font "0" should
expect trouble. ;)

-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________
  Rev tools and more:  http://www.fourthworld.com/rev




More information about the use-livecode mailing list