From: ib@ivan.asd.sgi.com (Ivan Bach)
Newsgroups: comp.sys.sgi.apps
Subject: Re: FrameMaker 3.1 Goes Crazy! (long)
Keywords: FrameMaker, fonts, SGI, IBM
Date: 30 Dec 92 19:31:39 GMT
Organization: Silicon Graphics, Inc., Mountain View, CA

In article <1992Dec29.040152.18074@ringer.cs.utsa.edu>, 
senseman@lucy.brainlab.utsa.edu (David M. Senseman) writes:
> Everytime I open a document on my Indigo that was previously created
> on the IBM I get a warning about "unavailable fonts"
You should determine which fonts are available to FrameMaker (FM) on your
IBM computer, which fonts are available to FM on your SGI computer, and
which fonts are used in the document you prepared on your IBM computer.

To find out which fonts are available to FM, select the option 'Character' in
the 'Format' menu.  When the 'Character Format' window is displayed, look for
a list called the 'Font Family' list.  You can scroll through that list to see
which fonts are available in your FrameMaker installation.

Alternatively, enter the commands:

    cd install_dir/.fminit2.0.ps/fontdir
    ls

on your SGI machine.  The default name for the install directory is /usr/frame.
That should give you a list of installed fonts.  FrameMaker uses the file
fontlist in that directory.  Take a look at that file.

I'll append a script that can be used to find out which fonts are used
in an FM document stored in the MIF format.  You should determine which
fonts are installed on both machines, and then use only those fonts, or
install on your SGI machine the fonts you are missing.  As it says in
Appendix F of the SGI FrameMaker Reference manual, you can order additional
technical documents about the adding of PostScript fonts to FM from SGI.  
I have added Macintosh PS fonts to FM on an SGI machine.

Technical writers from Intuit reported:
--------------------------------------------------------------------------
The situation seems to be that if a font exists on both the Mac and a Unix
machine, FrameMaker recognizes that font. Otherwise, it reformats the 
unknown font as Times or makes a "best guess." For example, the Unix FM 
reformats Helvetica Condensed as Helvetica Narrow.
--------------------------------------------------------------------------

I have been reading articles in the newsgroup comp.text.frame, and I don't
remember anybody reporting a similar problem.  I think that you should post
an article in that newsgroup, and send a bug report to comments@frame.com.
You should tell them which versions of FM you have on your computers, and
give them a sample file prepared on your IBM machine.

Here is a script for finding font names in a MIF file:
--------------------------------------------------------------------------
From: bae@col.hp.com (Bruce Erickson)
Date: Fri, 28 Aug 92 21:44:16 CDT
Newsgroups: comp.text.frame
Subject: List information about paragraphs
Message-Id: <1992Aug28.195011.7007@col.hp.com>
X-Orig-Date: 28 Aug 92 20:44:20 GMT
Organization: Hewlett-Packard Logic Systems Operation

A while ago I posted a note asking if there was a quick way to get
a table of information about paragraphs -- font names, point sizes,
etc.  All responses were of the form "convert to MIF and write an
[awk, sed, ....] script".  Many added "...and when you have done that,
let me know!"

Well, here it is.  It only scans for paragraph formats, not for any
changes to the default paragraph formats actually in the text.

Not clean code, but gives output like this:

          font       var      weight   angle    size     lead    nexttag   
al0_in0   Helvetica  Regular  Regular  Regular  10.0_pt  2.0_pt  body_in1  
al0_in1   Helvetica  Regular  Regular  Regular  10.0_pt  2.0_pt  al0_in1   
bl_in0    Helvetica  Regular  Regular  Regular  10.0_pt  2.0_pt  body_in1  
bl_in1    Helvetica  Regular  Regular  Regular  10.0_pt  2.0_pt  body_in2  
Body      Times      Regular  Regular  Regular  9.0_pt   2.0_pt  none      
body_in0  Helvetica  Regular  Regular  Regular  10.0_pt  2.0_pt  body_in   
body_in1  Helvetica  Regular  Regular  Regular  10.0_pt  0.0_pt  body_in1  
body_in2  Helvetica  Regular  Regular  Regular  10.0_pt  2.0_pt  body_in2  
body_in3  Helvetica  Regular  Regular  Regular  10.0_pt  2.0_pt  body_in3  
Comment   Times      Regular  Regular  Regular  9.0_pt   2.0_pt  none      
Figure    Times      Regular  Regular  Regular  12.0_pt  2.0_pt  none      
h1        Times      Regular  Bold     Regular  12.0_pt  2.0_pt  body_in0  
h2        Times      Regular  Regular  Regular  12.0_pt  2.0_pt  body_in0  
h3        Times      Regular  Regular  Regular  12.0_pt  2.0_pt  body_in0  
h4        Times      Regular  Regular  Regular  12.0_pt  2.0_pt  body_in0  
vl0_in0   Helvetica  Regular  Regular  Regular  10.0_pt  2.0_pt  body_in1  
vl_in0    Helvetica  Regular  Regular  Regular  10.0_pt  2.0_pt  body_in1  
vl_in1    Helvetica  Regular  Regular  Regular  10.0_pt  0.0_pt  body_in2  
vl_in2    Helvetica  Regular  Regular  Regular  10.0_pt  2.0_pt  body_in3  

The code consists of three shell scripts (sorry non UNIX users!):
	-parasumm, the outer script
	-awkgen, which is a generic script I use to create awk scripts....
	-awkrep, another generic script I use to convert labled data to tables..

                  - Bruce Erickson
                     Hewlett Packard
                     bae@col.hp.com


# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by Bruce Erickson <bae@hplsdrn> on Fri Aug 28 13:47:04 1992
#
# This archive contains:
#	parasumm	awkgen		awkrep		
#

LANG=""; export LANG
PATH=/bin:/usr/bin:$PATH; export PATH

echo x - parasumm
cat >parasumm <<'@EOF'
#!/bin/ksh
#	ex:se ts=3 sw=3:
usage="usage: parasumm <MIF file>"
#
#

FMDIR=/site/frame/bin
#	Set up the PATH variable
PATH=/bin:/usr/bin:$FMDIR:.
SHELL=/bin/ksh


set -- `getopt "" "$@"`
if [ $? -ne 0 ]
then
	echo "$usage" >&2
	exit 1
fi

while [ $# -gt 0 ]
do
	case $1 in
		--)	shift; break;;
		-*)	echo "$usage" >&2; exit 1;;
	esac
done

if [ $# -ne 1 ]
then
	echo "$usage" >&2
	exit 1
fi

framefile=$1
tmpawk1=/usr/tmp/psawk_$$
tmpawk2=/usr/tmp/psawk2_$$

trap "rm -f $tmpawk1 $tmpawk2; trap '' 0 1 2 3 4; exit" 0 1 2 3 4

if [ ${framefile%.mif} = $framefile ]
then
	miffile=${framefile#.*}.mif
	# Must obtain .MIF file
	fmbatch <<-EOF
		Open $framefile
		SaveAs mif $framefile $miffile
		Quit
	EOF
else
	# Passed in the .mif file -- a timesaver!
	miffile=$framefile
fi

#	Read in PgfCatalog; create info based on PgfTag
#	When we get to a Paragraph which uses PgfTag xx, look for
#	overrides of font (etc).

# remember: any $, ', or ` to be passed in must be escaped so the shell doesn't intrepret it!
awkgen > $tmpawk1 <<-EOF
	<PgfTag
	tag
				/<PgfTag/ { s=index(\$0, "\`")+1; l=length(\$0)-s-1; tag = substr(\$0, s, l) }
	font
				/<FFamily/ { s=index(\$0, "\`")+1; l=length(\$0)-s-1; font = substr(\$0, s, l) } 
	var
				/<FVar/ { s=index(\$0, "\`")+1; l=length(\$0)-s-1; var = substr(\$0, s, l) }
	weight
				/<FWeight/ { s=index(\$0, "\`")+1; l=length(\$0)-s-1; weight = substr(\$0, s, l) }
	angle
				/<FAngle/ { s=index(\$0, "\`")+1; l=length(\$0)-s-1; angle = substr(\$0, s, l) }
	size
				/<FSize/ { t = \$2 "_" \$3; size = substr(t, 1, length(t) - 1)}
	lead
				/<PgfLeading/ { t = \$2 "_" \$3; lead = substr(t, 1, length(t) - 1)}
	InSeRt	
				/<PgfUseNextTag/	{ if (\$2 == "Yes") { nexttag = 1 } else { nexttag = 0 }}
	nexttag
				/<PgfNextTag/ { if (nexttag) {s=index(\$0, "\`")+1; l=length(\$0)-s-1; nexttag = substr(\$0, s, l)} else { nexttag = "none" }}
EOF
	#cat $tmpawk1

sed -e '1,/^<PgfCatalog/ d' -e '/^>/,$ d' < $miffile |
	awk -f $tmpawk1 > $tmpawk2

awkrep $tmpawk2
@EOF

chmod 775 parasumm

echo x - awkgen
cat >awkgen <<'@EOF'
#!/bin/ksh
#	ex:se ts=3 sw=3:
usage="usage: "
#
#	Generate an awk file which will:
#		create a file which is of the form 'aentry' 'elname' 'elvalue' ['elname' 'elvalue' ....]
#	this essentially can be used to create a series of arrays:
#		elname1[aentry] = elvalue1; elname2[aentry] = elvalue2.... or
#		array[aentry, elname1] = elvalue1; array[aentry, elname2] = elvalue2, .....
#
#	This reads stdin to create the awk file:
#		line  1 defines a pattern which is the start of 'aentry'.
#		line 2,3 defines a pattern and an action to define 'aentry' -- it must occur prior to any elements
#				aentryname '/<pattern>/ { aentryname = value }
#	
#	The rest of the lines define patterns and actions which define 'elname' and 'elvalue' as:
#			'elname /<pattern>/ { elname = value }'
#
#		if $1 is 'InSeRt', then the rest of the line s a string which will be inserted into the awk
#		script prior to any automatically generated statements.

#	This emits the awk file to stdout...

#	Set up the PATH variable
PATH=/bin:/usr/bin:
SHELL=/bin/ksh

# Cannot call getopt!

if [ $# -ne 0 ]
then
	echo "$usage" >&2
	exit 1
fi

	awk	'	
				NR == 1	{	startptn = $0 ; next }
				NR == 2	{	aentryname = $0; next }
				NR == 3	{	aentryawk = $0; next 
								printf "BEGIN  {  %s = \"\"; }\n", aentryname
							}

				/InSeRt/	{	getline
								print $0; next
							}

							{	numparts++
								partname[numparts] = $0
								getline
								partawk[numparts] = $0
								#printf "partname = @%s@, awk = @%s@\n", partname[numparts], partawk[numparts]
							}

				END		{	
								
								# Found start pattern -- emit previous information if any
								printf "/%s/	{ if (%s !~ /^$/)\n", startptn, aentryname
								printf "		{\n"
								printf "			printf \"%%s \", %s\n", aentryname
								for (p = 1; p <= numparts; p++)
								{
									printf "			printf \"%s %%s \", %s\n", partname[p], partname[p]
								}
								printf "			printf \"\\n\"\n		}\n"

								printf "	}\n"

								printf "%s\n", aentryawk

								for (p = 1; p <= numparts; p++)
								{
									printf "%s\n", partawk[p]
								}

								printf "\n"
								printf "END	{\n"
								printf "	{ if (%s !~ /^$/)\n", aentryname
								printf "		{\n"
								printf "			printf \"%%s \", %s\n", aentryname
								for (p = 1; p <= numparts; p++)
								{
									printf "			printf \"%s %%s \", %s\n", partname[p], partname[p]
								}
								printf "			printf \"\\n\"\n		}\n"
								printf "	}\n}"

							}
			'
exit
@EOF

chmod 775 awkgen

echo x - awkrep
cat >awkrep <<'@EOF'
#!/bin/ksh
#	ex:se ts=3 sw=3:
usage="usage: awkrep <file>"
#
#	<file> is of the form:
#	<tag> <label1> <value1> [<label2> <value2> ..]
#	Converts to a table of output...
#	
#

#	Set up the PATH variable
PATH=/bin:/usr/bin:
SHELL=/bin/ksh

set -- `getopt "" "$@"`
if [ $? -ne 0 ]
then
	echo "$usage" >&2
	exit 1
fi

while [ $# -gt 0 ]
do
	case $1 in
		--)	shift; break;;
		-*)	echo "$usage" >&2; exit 1;;
	esac
done

if [ $# -ne 1 ]
then
	echo "$usage" >&2
	exit 1
fi

infile=$1

(
	#	Pass 1: get list of all labels and their max width...
	#	This emits a line which is of the form:
	#	<label> <width> [<label> <width> ....
	awk '	BEGIN	{	numlabels = 1 }

			{	for (label = 2; label <= NF; label = label + 2)
				{
					if (labels[$label] == "" )
					{
						labels[$label] = $label
						# New label!
						labellist[numlabels] = $label
						# printf "label %s is %d\n", $label, numlabels
						numlabels++
						width = length($label)
						widths[$label] = width
					}
					
					value = label + 1
					width = length($value)
					if (widths[$label] < width)
						widths[$label] = width
				}

				if (length($1) > tagwidth)
					tagwidth = length($1)
			}

		END	{	printf "%d ", tagwidth
					for (l = 1; l < numlabels; l++)
					{
						printf "%s %d ", labellist[l], widths[labellist[l]]
					}
					printf "\n"

				}' < $infile
	cat $infile
) |
	awk '
		NR == 1	{	# list of labels & widths, in order
						tagwidth = $1
						numlabels = 0
						for (l = 2; l <= NF; l = l + 2)
						{
							numlabels = numlabels + 1
							label2order[$l] = numlabels
							labellist[numlabels] = $l
							m = l + 1
							width[numlabels] = $m
						}

						# Print heading
						printf "%-*s  ", tagwidth, ""
						for (l = 1; l <= numlabels; l++)
						{
							printf "%-*s  ", width[l], labellist[l]
						}
						printf "\n"
						next
					}

					{	# Input line!  
						leader = $1

						for (a = 1; a <= numlabels; a++)
							args[a] = ""
						
						for (b = 2; b <= NF; b++)
						{
							valn = b + 1
							value = $valn
							lnum = label2order[$b]	# Which label?
							args[lnum] = value
						}

						# Print out line
						printf "%-*s  ", tagwidth, $1
						for (l = 1; l <= numlabels; l++)
						{
							printf "%-*s  ", width[l], args[l]
						}
						printf "\n"
					}'

@EOF

chmod 775 awkrep

exit 0

Ivan Bach, ib@sgi.com