[comp.sys.mac] Document fonts: I thought this would work -- why not?

kevin@kosman.UUCP (Kevin O'Gorman) (05/15/88)

It seems to me this trick used to work: what has happened?

I thought that I could option-open a document in Font/DA mover, and put
a font in the resource fork for that document, and have it used just by
that document.

I tried it in MacWrite, and Word, and no such luck.  I thought I remembered
that this worked because the system sees the resources of all open files.
Shouldn't this work?  It sure seems like a good idea for seldom-used
display fonts and the like.

cloos@batcomputer.tn.cornell.edu (James H. Cloos Jr.) (05/18/88)

Not sure why it didn't work in MacWrite or Word, but I do know that many
terminal emulators use this trick.  VersaTerm Pro has its Bold and about
8 or 9 sizes of a custom Courier (and a custom Monaco, now that I  think
or it).  MacTerminal also has Bold in its Resource Fork rahter  than  in
the System's.

I'm not sure if I ever tried this w/ MacWrite or Word, but I  have  done
it with some other programs.  It worked fine as I remember.

-JimC
-- 
batcomputer!cloos@cornell.UUCP  |James H. Cloos, Jr.|#include <disclaimer.h>
cloos@batcomputer.tn.cornell.EDU|B7 Upson, Cornell U|#include <cute_stuff.h>
cloos@tcgould.tn.cornell.EDU    |Ithaca, NY 14853   |"Entropy isn't what
cloos@crnlthry.BITNET           |  +1 607 272 4519  | it used to be."

shane@pepe.cc.umich.edu (Shane Looker) (05/18/88)

In article <394@kosman.UUCP> kevin@kosman.UUCP (Kevin O'Gorman) writes:
>It seems to me this trick used to work: what has happened?
>
>I thought that I could option-open a document in Font/DA mover, and put
>a font in the resource fork for that document, and have it used just by
>that document.
>
>I tried it in MacWrite, and Word, and no such luck.  I thought I remembered
>that this worked because the system sees the resources of all open files.
>Shouldn't this work?  It sure seems like a good idea for seldom-used
>display fonts and the like.

It is a good idea, but... it doesn't work.  The reason that it doesn't
work is because of the way fonts are installed when the program is run.

During the initialization phase of the program, all fonts (in MacWrite)
are loaded with a call to AddResMenu (I think, don't have IM here right now).
(Word does essentially the same thing, but plays around some more.)

As a result, the Font menu list is installed *before* your document is
even opened.  (It is just a parameter to the program after all.)  So
when the Font menu is built, it does have all the known fonts put into it.

A little extra code could make the font menu add document fonts, but the
code is trickier to make the fonts dissappear when the document is closed.


Shane Looker
shane@pepe.cc.umich.edu 
uunet!umix!pepe.cc.umich.edu!shane
Looker@um.cc.umich.edu

levin@bbn.com (Joel B Levin) (05/19/88)

In article <515@mailrus.cc.umich.edu> shane@pepe.cc.umich.edu (Shane Looker) writes:
(In article <394@kosman.UUCP> kevin@kosman.UUCP (Kevin O'Gorman) writes:
(>I thought that I could option-open a document in Font/DA mover, and put
(>a font in the resource fork for that document, and have it used just by
(>that document.
(>display fonts and the like.
(
(It is a good idea, but... it doesn't work.  The reason that it doesn't
(work is because of the way fonts are installed when the program is run.
( ...

Another poster mentioned an alternate solution, which is useful when
you want to have some particular font available whenever you run (say)
MacWrite, but don't need it for other applications: place the font in
MacWrite itself (using option-open in F/DA mover).  This works, well,
almost.  If two fonts in two different resource files (e.g., System
and MacWrite) use the same font number, they will get confused in
mysterious ways when you try to use these fonts.  The only two
solutions for this I know of involve having the font around all the
time: put all fonts in the System file, or put them all in a single
font file and use Suitcase or F/DA Juggler (I presume) to make them
available.  (This works because F/DA mover can resolve conflicting
font numbers.)  Neither of these solutions helps your problem.

	/JBL
UUCP: {backbone}!bbn!levin     USPS: BBN Communications Corporation
ARPA: levin@bbn.com                  50 Moulton Street
POTS: (617) 873-3463                 Cambridge, MA  02238

dorourke@polyslo.UUCP (David M. O'Rourke) (05/19/88)

In article <394@kosman.UUCP> kevin@kosman.UUCP (Kevin O'Gorman) writes:
>I tried it in MacWrite, and Word, and no such luck.  I thought I remembered
>that this worked because the system sees the resources of all open files.
>Shouldn't this work?  It sure seems like a good idea for seldom-used
>display fonts and the like.

   It depends, If MacWrite doesn't leave the file open after reading it
then MacWrite won't find the font, also just because you open a file that
doesn't mean you open the Resource Fork of the file.  I believe MacWrite
puts all of it's stuff in the data fork, so if it opens a document it
doesn't even touch the resource fork, and hence the Font is not found
since the resource fork isn't open.


David M. O'Rourke

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| dorourke@polyslo | Disclaimer:  All opinions in this message are mine, but  |
|                  |              if you like them they can be yours too.     |
|                  |              Besides I'm just a student so what do I     |
|                  |              know!                                       |
|-----------------------------------------------------------------------------|
|    When you have to place a disclaimer in your mail you know it's a sign    |
| that there are TOO many Lawyer's.                                           |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

anson@spray.CalComp.COM (Ed Anson) (05/19/88)

In article <4840@batcomputer.tn.cornell.edu> cloos@tcgould.tn.cornell.edu (James H. Cloos Jr.) writes:
>Not sure why it didn't work in MacWrite or Word, but I do know that many

It is known to work well with applications, but with documents there is another
problem:

Many (most?) applications periodically do a UseResFile for the application
file, which has the effect of making the document's resource fork
invisible to the resource manager.

By the way, this is done at Apple's suggestion, because a DA might have
changed the resource search path. Since the application doesn't know that
you want to use resources from its documents, it doesn't make any provision
for that.
-- 
=====================================================================
   Ed Anson,    Calcomp Display Products Division,    Hudson NH 03051
   (603) 885-8712,      anson@elrond.CalComp.COM

peter@aucs.UUCP (Peter Steele) (05/20/88)

> I thought that I could option-open a document in Font/DA mover, and put
> a font in the resource fork for that document, and have it used just by
> that document.

I tried the same thing with MacDraw and no luck. I found that I had to
install the font in MacDraw itself (which I didn't really want to do).
My guess is that if a program's normal document doesn't make use of a
resource fork, it doesn't open it. In the case of MacDraw documents
(at least the one I had) there was no resource fork until I created
one. I've never checked Word documents but I bet they don't have a
resource fork either.

-- 
Peter Steele, Microcomputer Applications Analyst
Acadia University, Wolfville, NS, Canada B0P1X0 (902)542-2201x121
UUCP: {uunet|watmath|utai|garfield}dalcs!aucs!Peter
BITNET: Peter@Acadia  Internet: Peter%Acadia.BITNET@CUNYVM.CUNY.EDU