[comp.sys.amiga] SetFont

shf@well.UUCP (Stuart H. Ferguson) (05/22/89)

+-- ejkst@unix.cis.pittsburgh.edu (Eric J. Kennedy) writes:
|In article <705@solaria.csun.edu> ecphssrw@io.csun.edu (Stephen Walton) writes:
| >Rick then describes a way to make your machine crash using a very
| >obscure combination of reboots, SetFont's and WordPerfect's.  Since
| >SetFont is definitely *not* a supported part of the Amiga's OS, but a
| >quick hack Dave Haynie put together which works _sometimes_, blaming
| >WordPerfect ...
| ...  If it's going to use the default system font, then it had darn
| well better check the size of that font before squashing it into an 8-
| pixel-high line.  And WP isn't alone.  Lots of software breaks if you
| don't have an 8x8 font as the default.  ...

Is SetFont really buggy -- or lets say, not fully reliable?  I've been
trying to write a program that will work with whatever the system font
is and I've been testing it with SetFont.  It seems that about half the
time SetFont will crash if I use it *after* running my program.  It
always works before I run my program (i.e. right after a reboot), so I
just assumed it was something I was doing.  But if SetFont is flakey,
perhaps that's the reason, not my code.

Can anyone clarify under what circumstances SetFont will work correctly,
and set my mind at ease (or not)?  Thanx.
-- 
		Stuart Ferguson		(shf@well.UUCP)
		Action by HAVOC

mlelstv@immd4.informatik.uni-erlangen.de (Michael van Elst ) (05/23/89)

shf@well.UUCP (Stuart H. Ferguson) writes:

>Can anyone clarify under what circumstances SetFont will work correctly,
>and set my mind at ease (or not)?  Thanx.
>-- 

Since intuition (V1.2) keeps track of window fonts only, you can only
set fonts of windows, not screen fonts.

The way FastFonts works is, to swap the contents of two font structures,
actually redefining the bitmap for the fonts, i.e. you use the same font
but it looks like another font.

				Michael van Elst

E-mail: UUCP: ...uunet!unido!fauern!immd4!mlelstv

ejkst@unix.cis.pittsburgh.edu (Eric J. Kennedy) (05/25/89)

In article <11767@well.UUCP> shf@well.UUCP (Stuart H. Ferguson) writes:
>Is SetFont really buggy -- or lets say, not fully reliable?  I've been

Well, not really.  I haven't noticed problems with SetFont itself.  The
problem is the programs that assume the default font is 8x8.  Of which
WordPerfect, Dirmaster, Comm (and many term programs derived from it),
vt100 (at least an older version), Blitz, and Less are just a few.

>trying to write a program that will work with whatever the system font
>is and I've been testing it with SetFont.  It seems that about half the
>time SetFont will crash if I use it *after* running my program.  It
>always works before I run my program (i.e. right after a reboot), so I
>just assumed it was something I was doing.  But if SetFont is flakey,
>perhaps that's the reason, not my code.

It's been quite awhile since SetFont has crashed on me, and I use it
quite a bit because of certain unmentionable programs.  I'd keep
checking your code...

Oh, setfont and fed (the font editor) are a bad combination.  Actually,
fed + anything is a bad combination.

-- 
Eric Kennedy
ejkst@cisunx.UUCP

daveh@cbmvax.UUCP (Dave Haynie) (05/25/89)

in article <18178@unix.cis.pittsburgh.edu>, ejkst@unix.cis.pittsburgh.edu (Eric J. Kennedy) says:
> In article <11767@well.UUCP> shf@well.UUCP (Stuart H. Ferguson) writes:
>>Is SetFont really buggy -- or lets say, not fully reliable?  I've been

> Well, not really.  I haven't noticed problems with SetFont itself.  
> Eric Kennedy

Looks like it's "Dave comments on his programs" day.  Eric's basically right,
when SetFont comes along and changes the system font, it can mess up a number
of programs.  Some programs don't adjust well to any font other than topaz
8, some will work fine with any 8x8 font but fail with larger fonts (like
WorkBench), some work fine with any fixed font but fail with proportional
fonts (like CON:).  There's nothing SetFont can do about this; a proper program
would check the font it's inheriting from the screen or window, and specify a
known replacement if it can't use the given font, but I don't think Commodore
has ever really given out guidelines on this, as the main system as of 1.3
wasn't really expecting variable fonts at the system level.

SetFont does, however, hack some thing it's really not supposed to touch.  So
it is possible for it to confuse system things, like the WorkBench, that don't
adjust to font changes.

-- 
Dave Haynie  "The 32 Bit Guy"     Commodore-Amiga  "The Crew That Never Rests"
   {uunet|pyramid|rutgers}!cbmvax!daveh      PLINK: D-DAVE H     BIX: hazy
              Amiga -- It's not just a job, it's an obsession

bartonr@psu-cs.cs.pdx.edu (Robert Barton) (05/28/89)

 Dave Haynie writes:
=>Looks like it's "Dave comments on his programs" day.  Eric's basically right,
=>when SetFont comes along and changes the system font, it can mess up a number
=>of programs.  Some programs don't adjust well to any font other than topaz
=>8, some will work fine with any 8x8 font but fail with larger fonts (like
=>WorkBench), some work fine with any fixed font but fail with proportional
=>fonts (like CON:).  There's nothing SetFont can do about this; a proper program
=>would check the font it's inheriting from the screen or window, and specify a
=>known replacement if it can't use the given font, but I don't think Commodore
=>has ever really given out guidelines on this, as the main system as of 1.3
=>wasn't really expecting variable fonts at the system level.
=>
=>SetFont does, however, hack some thing it's really not supposed to touch.  So
=>it is possible for it to confuse system things, like the WorkBench, that don't
=>adjust to font changes.

  How does SetFont notify other programs that it has just changed a font?
Does it call the SetPrefs() function or use some other mechanism?
Many programs (including some commercial ones) apparently don't check for
NEWPREFS IntuiMessages.  Workbench and AmigaBasic do, and then adjust their
menus accordingly.

jwl@Feanor.Stanford.EDU (John Lockhart) (05/31/89)

In article <6981@cbmvax.UUCP> daveh@cbmvax.UUCP (Dave Haynie) writes:
 [stuff deleted]
>   Some programs don't adjust well to any font other than topaz
>8, some will work fine with any 8x8 font but fail with larger fonts (like
>WorkBench), some work fine with any fixed font but fail with proportional
>fonts (like CON:).  There's nothing SetFont can do about this; a 
>proper program
>would check the font it's inheriting from the screen or window, and specify a
>known replacement if it can't use the given font, but I don't think Commodore
>has ever really given out guidelines on this, as the main system as of 1.3
>wasn't really expecting variable fonts at the system level.

>Dave Haynie  "The 32 Bit Guy"     Commodore-Amiga  "The Crew That Never Rests"

All of this makes me wonder:  what degree of flexibility will 1.4
allow us in the choice of fonts available?  I mean, will I be able
to use proportional fonts in CON:?  Will there be a means to replace
Topaz (say, from Preferences, not from FastFonts)?  

Will it be easier to use larger fonts (whether proportional or not) in 
more applications?  How will programs have to change to take advantage 
of any changes in the way fonts are handled in 1.4?

I hope that SetFont, FastFonts, and the like are not necessary in
1.4; the system should really support this in a very easy and standard
fashion.  Then again, there's a lot I'm hoping for in 1.4, and from
what I've seen on BIX, it looks like CBM's going to do a great job.

-------------------------------------------------------------------------------
                         -- John Lockhart
               jwl@feanor.stanford.edu  BIX: jlockhart

daveh@cbmvax.UUCP (Dave Haynie) (06/01/89)

in article <1275@psueea.UUCP>, bartonr@psu-cs.cs.pdx.edu (Robert Barton) says:

> =>SetFont does, however, hack some thing it's really not supposed to touch.  So
> =>it is possible for it to confuse system things, like the WorkBench, that don't
> =>adjust to font changes.

>   How does SetFont notify other programs that it has just changed a font?
> Does it call the SetPrefs() function or use some other mechanism?
> Many programs (including some commercial ones) apparently don't check for
> NEWPREFS IntuiMessages.  Workbench and AmigaBasic do, and then adjust their
> menus accordingly.

It doesn't.  In fact, calling up preferences can reset the font.  While you
can use SetFont at any point, I really intended it as something that's 
used once, like in your Startup-Sequence.  

Actually, that's almost true.  If you're setting the font of the CLI you're
in ("SetFont..." or "SetFont ... WINDOW" does this), I do actually in effect
notify the console device of the window's font change by sending the init
sequence (ESC-c as I recall), which causes the console handler to rebuild
it's ConUnit.  Which tells me that consoles currently do the Right Thing.
A ConUnit gets built when that console starts up, and it reads the window 
font (which is inherited from the screen font descriptor) and uses that font
from then on, unless the unit gets rebuilt.  Thus, I can change the window
font all I like, and not trip up the console using that window, since it's
using it's own idea of the proper font.

Workbench seems to do the wrong thing.  It uses statically created menus,
but updates the font used based on the action of SetFont.  So if you go to a
font larger than the 8 point topaz fonts, WB will get in trouble.  Now, as
I mentioned, SetFont is really mucking with stuff that WorkBench never 
intended it to muck with, but it is possible to build programs, today, that
adjust properly to different system fonts.  Hopefully the system stuff will
handle this right, at least, in 1.4...
-- 
Dave Haynie  "The 32 Bit Guy"     Commodore-Amiga  "The Crew That Never Rests"
   {uunet|pyramid|rutgers}!cbmvax!daveh      PLINK: D-DAVE H     BIX: hazy
              Amiga -- It's not just a job, it's an obsession