[futurebasic] Re: Another font question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: Mel and Carol <mel@...>
Date: Mon, 29 Dec 1997 09:42:22 -0800
>>Why do some fonts have numbers?  And others do not?  I use the command
>>GETFNUM (fontName$,fontNum)
>>and supply the fontName$ and expect a font number in fontNum.  Sometimes
>>it's there with one font and sometimes it's not for another font???
>>What's happening?  Can anyone tell me?
>If you get a "zero" in fontNum, the font you passed in fontName$ doesn't
>exist. Remember that the _suitcase_ name is not necessarily the _font_
>name, and fonts will only "exist" if they are open and accessible to the
>system at the time you make the call...

Not exactly Bill, the System FontNum is usually 0 as in the case of
Chicago. Hence 0 is a valid font number.

Heres a little FN that I use to handle fonts :

LOCAL FN SetDisplayFont
  CALL GETFNUM(gFontName$,theFontNum):'      this will get us a font number
  CALL GETFONTNAME(theFontNum,Temp$):'     check to see if the font changed
  LONG IF Temp$=gFontName$:'     if these match the font is still available
    TEXT theFontNum,gFontSize,_plainBit,_srcOr:'                do this now
  XELSE:'     something has happened to the last selection, use system font
    theFontNum=_sysFont:'                   default back to the system font
    CALL GETFONTNAME(theFontNum,gFontName$):'     and get the font name now
    gFontSize=9:'                                    use 9 point by default
    TEXT theFontNum,9,_plainBit,_srcOr:'         revert to default set font
  fntHt=USR FONTHEIGHT+4:'               gets the height of the font in use
Apple says that font numbers can change so the above routine verifies that
the number of the font and the name of the font match before using it. It
just sets a bunch of globals in my software, and the font names have been
stored in my prefs file. I don't check for a 0 font number because thats
Chicago, I do a name compare to make sure the font is the same, if not, I
default to whatever.

Mel Patrick - theWabbitGuy - mel@...