Re: use windows fonts and adobe distiller and lout

douglas mcallaster <[email protected]> Fri, 31 Jan 2020 17:06:33 -0500
Newsgroups gmane.comp.type-setting.lout
Message-ID <CANsn3kfZC1fXbK6HAY2Sez-HJegjceMyNagmRHYFj6JmxYe4Zg@mail.gmail.com>
--000000000000fb779d059d76c9b8
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Thanks, Guys;

The  TTF2AFM.exe created an afm file, which Lout used, and then distiller
rendered
Thus, perfect solution found, all on Windows, and no type 1 fonts needed.

Ttf2afm is by Han The Thanh, the author of pdfTex.
I got the exe from the MikTex distribution.
(I had used Tex and LaTex years ago but even the basic distro has 8K files;
it is a beast.
The full distro from Tex User Group has over 100K files!!)

The ttf2afm is described in a TUG boat 2009 article entitled 'A closer look
at TrueType fonts and pdfTex'
The only trick was applying an encoding option in its usage; else the afm
files had -1 index for the glyphs; and the afms provided with Lout had a
decimal code for the glyphs.
Not all the TT fonts I tried worked, though; the newer ones did not seem to
recode correctly. Thanh discusses some of this in his article but I did not
really follow it.

PS: I may still work on using Martin's shell script and investigate whether
distiller can use type1 fonts and examine the quality.
I do have a Linux Mint pc; and have used it for poking around.
I tried briefly last night but got an error message about no GS_fontpath
(as I recall) even though put the ttf font in a path GS searches.
but no time to work on this again for a week at least.

Lout is truly a wonderful gift. Many thanks to Professor Kingston for such
a robust program.

Doug

On Fri, Jan 31, 2020 at 1:31 AM William Bader <[email protected]>
wrote:

> I think that Lout needs only the AFM, so just to run Lout, you can
> probably get by without converting the fonts.
> An alternative to ttf2pt1 is converting the font file through a file
> conversion web site like http://www.freefontconverter.com/ (which
> probably runs ttf2pt1 underneath).
> Regards, William
>
> ------------------------------
> *From:* Lout-users <lout-users-bounces+williambader=3Dhotmail.com@nongnu.=
org>
> on behalf of Martin Michel <[email protected]>
> *Sent:* Thursday, January 30, 2020 3:44 PM
> *To:* douglas mcallaster <[email protected]>
> *Cc:* [email protected] <[email protected]>
> *Subject:* Re: use windows fonts and adobe distiller and lout
>
> Hey Doug,
>
> author of the script here. William and David already explained the idea
> of the script very well, I have not much to add. It is basically a
> wrapper around ttf2pt1 which automates the whole chain of preparation
> for using a TTF/OTF font within Lout. The Readme on GitHub [1] gives
> some more details, but you know it probably already.
>
> I used the script successful on MacOS and Linux but have no experience
> with it on Windows. To directly use it, you could try to install Cygwin
> [2] or MSYS2 [3], install the required programs and follow the steps
> from the Readme. The dependencies are a bunch of GNU Unix/Linux tools
> which should come out-of-the box in Cygwin (bash, sed, grep, tee, ...) an=
d
> the ttf2pt1 program [4]. Compilation requires specific development
> headers, e.g. Freetype 2 [5] and build essential tools like make and
> gcc.  Although all those resource should be accessible by Cygwin's
> package system, I have to admit, this is not an easy path if you are
> completely new to GNU/Linux/Unix. To cut a long story short, I cannot
> guarantee it will work this way but if you are ambitious and eager to
> learn something new, just give it a try. (Alternatively, you could
> install a Linux VM using Virtualbox [6] but this would make your task
> even bigger=E2=80=A6)
>
> If there is another, easier way (Windows or Linux), I would be also very
> happy to learn about it from the community.
>
> =E2=88=92Martin
>
> [1] https://github.com/smartmic/addfonts
> [2] https://www.cygwin.com/
> [3] https://www.msys2.org/
> [4] http://ttf2pt1.sourceforge.net/
> [5] https://www.freetype.org/
> [6] https://www.virtualbox.org/
>
>
> On Tue, Jan 28, 2020 at 05:33:49PM -0500, douglas mcallaster wrote:
> > Folks,
> >
> > Can lout use the truetype fonts which come with Windows 10?
> > (And I am using Adobe Distiller to make pdf from the lout generated
> postscript.)
> >
> > I found an explanation for using non standard fonts from 20 years ago
> (using PFA or PFB and AFM files),
> > but I assume truetype fonts would provide much higher quality.
> >
> > I discovered (on git hub) a script from Martin Michel from 2014 but it
> is for Linux and ghostscript.
> > Has someone made a Windows powershell script which could perform this
> magic for me?
> >
> > Or perhaps someone could explain the script (copied next under) so that
> I could try to its steps manually.
> >
> > As I understand it, I would have to set up lout to find the AFM file vi=
a
> a myfonts.ld file.
> >
> > If someone could reply with the requisite (I assume) AFM file (based on
> some Windows10 truetype font),
> > and a myfonts.ld file (with the correct matching @name, @family, @face,
> @tag, @metrics, @mapping info)
> > what would be really great. (An early success would keep me going, as I
> have a day job.)
> >
> > Also, if folks have done this and can suggest a nice Windows Monospace,
> Serif, and San Serif font, I welcome it.
> >
> > Finally, my thoughts go out to Dr Kingston, who enjoyed hiking in
> Australia,
> > as I wonder how much of his treasured woodlands are now destroyed.
> >
> > Thanks, Doug
> >
> > #!/bin/bash
> > #
> > # addfonts.sh
> > # Converts True Type or Open Type Fonts to Postscript Type1 Fonts and
> populates
> > # the Ghostscript Fontmap file and the Basser Lout FontDef databases fo=
r
> local
> > # users.
> > #
> > # Depends on non-standard commands: ttfpt1 (compiled against Freetype)
> > #
> > #
> > # Copyright 2014 Martin Michel
> > #
> > #   Licensed under the Apache License, Version 2.0 (the "License"); you
> may not
> > #   use this file except in compliance with the License.  You may obtai=
n
> a copy
> > #   of the License at
> > #
> > #     http://www.apache.org/licenses/LICENSE-2.0
> > #
> > #   Unless required by applicable law or agreed to in writing, software
> > #   distributed under the License is distributed on an "AS IS" BASIS,
> WITHOUT
> > #   WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> See the
> > #   License for the specific language governing permissions and
> limitations
> > #   under the License.
> >
> > shfile=3D$(sed 's/^.*\///' <<< $0)
> > logfile=3D$(sed -e 's/\.sh/\.log/; s/^.*\///' <<< $0)
> > #echo $0 $shfile $logfile
> >
> > usage=3D"Usage: ./$shfile
> > No arguments applicable. This script scans for new True Type or Open
> Type Font
> > files, converts them to Postscript Type1 Fonts and updates the Fontmap
> > (Ghostscript) and @FontDef (Lout) databases. The script and all
> associated input
> > and output files must be in the local user ghostscript font path."
> >
> > echo "*****************************************************************=
"\
> >    >>$logfile
> > echo "LOG ENTRY from '$shfile'">>$logfile
> > echo -e "Run by $USER on $HOSTNAME at $(date) \n ">>$logfile
> >
> > if [ $# -gt 0 ] ; then
> >     echo -e "TERMINATION: Wrong number of arguments. \n" |tee -a $logfi=
le
> >     echo -e "$usage\n"
> >     exit 1
> > fi
> >
> > if [[ "$GS_FONTPATH" !=3D "$(pwd)" ]] ; then
> >     echo -e "TERMINATION: Wrong working directory or GS_FONTPATH not
> set.\n" |tee -a $logfile
> >     echo -e "Current directory: $(pwd)" |tee -a $logfile
> >     echo -e "GS_FONTPATH: $GS_FONTPATH" |tee -a $logfile
> >     echo -e "$usage\n"
> >     exit 2
> > fi
> >
> > [ ! -f Fontmap ] && echo -e "INFO: Ghostscripts local 'Fontmap' file
> missing, will
> > be created.\n" |tee -a $logfile  && touch Fontmap
> >
> > ls *.[oOtT][tT][fF] 2>/dev/null 1>&2
> > if [ $? -ne 0 ] ; then
> >     echo -e "TERMINATION: No True or Open Type Font files (.ttf,.otf) i=
n
> directory." |tee -a $logfile
> >     echo -e "$usage\n"
> >     exit 3
> > fi
> >
> > availableTTF=3D( $(ls -1 *.[oOtT][tT][fF] | sed 's/\.otf\|\.ttf//i') )
> > installedPFB=3D( $(grep -e '^/' Fontmap | sed 's/^.*(\|\.pfb.*$//g') )
> >
> > typeset -i counter
> > typeset -i numTTF
> > typeset -i numInstalled
> > typeset -i numPFB
> > numTTF=3D${#availableTTF[*]}
> > numInstalled=3D${#installedPFB[*]}
> > counter=3D$numInstalled
> > numPT1=3D$(ls -1 *.[aApP][fF][bBmM] 2>/dev/null | wc -l )
> >
> > let z=3DnumPT1/2
> > let m=3DnumPT1%2
> >
> > if (( $numInstalled < z && m =3D=3D 0 )) ; then
> >     echo -e "WARNING: There are unregistered PS Type1 font files.\n"
> |tee -a $logfile
> > elif (( $numInstalled > z || m > 0 )) ; then
> >     echo -e "TERMINATION: There are missing PS Type1 font files. It is
> recommend to
> > syncronize all files and databases in this directory (delete Fontmap an=
d
> rerun
> > $0)\n" |tee -a $logfile
> >     exit 4
> > fi
> >
> > echo -e "STATUS: There are $numInstalled installed Postscript Type1
> Fonts out of $numTTF
> > available True Type or Open Type Fonts for user $USER. \n" >>$logfile
> >
> > if (( $numTTF !=3D $numInstalled ))
> > then
> >     for ii in ${availableTTF[*]}; do
> >         for jj in ${installedPFB[*]}; do
> >             if [[ "$ii" !=3D "$jj" ]]; then
> >                 counter=3D$counter-1
> >             fi
> >         done
> >         if (( $counter =3D=3D  0 )) ; then
> >             queueFonts=3D("${queueFonts[@]}" "$ii")
> >         fi
> >        counter=3D$numInstalled
> >     done
> > else
> >     echo "INFO: Font database is up-to-date if you have not fiddled wit=
h
> the
> > contents of this directory or the local Fontmap file manually after the
> > last run of this script. Consult the log file for history.
> >
> > Nothing to do. No new fonts installed." |tee -a $logfile
> >     exit 0
> > fi
> >
> > for ff in ${queueFonts[@]}; do
> >     echo
> "-----------------------------------------------------------------"\
> >        >>$logfile
> >     echo "START OF TTF2PT1 LOG ENTRY FOR '$ff'" >>$logfile
> >     echo $(date) >>$logfile
> >     echo
> "-----------------------------------------------------------------"\
> >        >>$logfile
> >
> >     ttf2pt1 -b $ff.[oOtT][tT][fF]  >>$logfile 2>&1
> >
> >     fontNames=3D("${fontNames[@]}" "$(grep FontName $ff.afm | cut -d' '
> -f2-)")
> >     familyNames=3D("${familyNames[@]}" \
> >         "$(grep FamilyName $ff.afm | cut -d' ' -f2- | sed 's/ /_/g')")
> >     faceNames=3D("${faceNames[@]}" \
> >         "$(grep Weight $ff.afm | cut -d' ' -f2- | \
> >         sed -e' s/^./\U&/g; s/ *//g; s/Regular/Base/i; s/Italic/Slope/i
> ')")
> >     tagNames=3D("${tagNames[@]}"
> "${familyNames[@]:(-1)}-${faceNames[@]:(-1)}")
> >
> >     echo "/${fontNames[@]:(-1)} ($ff.pfb);" >>Fontmap
> >
> >     if [[ -z `cat myfontdefs.ld | sed -n '/'"$ff"'.afm/p'` ]] ; then
> >         cat >>myfontdefs.ld<<LOUT_ENTRY
> > { @FontDef
> >       @Tag { ${tagNames[@]:(-1)} }
> >       @Family { ${familyNames[@]:(-1)} }
> >       @Face { ${faceNames[@]:(-1)} }
> >       @Name { ${fontNames[@]:(-1)} }
> >       @Metrics { $ff.afm }
> >       @Mapping { LtLatin1.LCM }
> > }
> >
> > LOUT_ENTRY
> >     fi
> >
> >     # Correct for whitespace error in afm files
> >     sed -i 's/.null/space/' $ff.afm
> >
> >     echo
> "*****************************************************************"\
> >         >>$logfile
> >     echo -e "Font: ${fontNames[@]:(-1)}; Tag: ${tagNames[@]:(-1)} (has
> been \
> > installed.)" |tee -a $logfile
> > done
>
>

--000000000000fb779d059d76c9b8
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thanks, Guys;<div><br></div><div>The=C2=A0 TTF2AFM.exe cre=
ated an afm file, which Lout used, and then distiller rendered</div><div>Th=
us, perfect solution found, all on Windows, and no type 1 fonts needed.</di=
v><div><br></div><div>Ttf2afm is by Han The Thanh, the author of pdfTex.=C2=
=A0</div><div>I got the exe from the MikTex distribution.</div><div>(I had =
used Tex and LaTex years ago but even the basic distro has 8K files; it is =
a beast.</div><div>The full distro from Tex User Group has over 100K files!=
!)<br></div><div><br></div><div>The ttf2afm is described in a TUG boat 2009=
 article entitled &#39;A closer look at TrueType fonts and pdfTex&#39;</div=
><div>The only trick was applying an encoding=C2=A0option in its usage; els=
e the afm files had -1 index for the glyphs; and the afms provided with Lou=
t had a decimal code for the glyphs.<br></div><div>Not all the TT fonts I t=
ried worked, though; the newer ones did not seem to recode correctly. Thanh=
 discusses some of this in his article but I did not really follow it.</div=
><div><br></div><div>PS: I may still work on using Martin&#39;s shell scrip=
t and investigate whether distiller can use type1 fonts and examine the qua=
lity.</div><div>I do have a Linux Mint pc; and have used it for poking arou=
nd.</div><div>I tried briefly last night=C2=A0but got an error message abou=
t no GS_fontpath (as I recall) even though put the ttf font in a path GS se=
arches.</div><div>but no time to work on this again for a week at least.=C2=
=A0</div><div><br></div><div>Lout is truly a wonderful gift. Many thanks to=
 Professor Kingston for such a robust program.</div><div><br></div><div>Dou=
g</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail=
_attr">On Fri, Jan 31, 2020 at 1:31 AM William Bader &lt;<a href=3D"mailto:=
[email protected]">[email protected]</a>&gt; wrote:<br></div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir=3D"ltr">
<div style=3D"font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color=
:rgb(0,0,0)">
I think that Lout needs only the AFM, so just to run Lout, you can probably=
 get by without converting the fonts.</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color=
:rgb(0,0,0)">
An alternative to ttf2pt1 is converting the font file through a file conver=
sion web site like=C2=A0<a href=3D"http://www.freefontconverter.com/" id=3D=
"gmail-m_113942388892256256LPNoLP469266" target=3D"_blank">http://www.freef=
ontconverter.com/</a>=C2=A0(which probably runs ttf2pt1 underneath).</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color=
:rgb(0,0,0)">
Regards, William</div>
<div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color=
:rgb(0,0,0)">
<br>
</div>
<hr style=3D"display:inline-block;width:98%">
<div id=3D"gmail-m_113942388892256256divRplyFwdMsg" dir=3D"ltr"><font face=
=3D"Calibri, sans-serif" color=3D"#000000" style=3D"font-size:11pt"><b>From=
:</b> Lout-users &lt;lout-users-bounces+williambader=3D<a href=3D"mailto:ho=
[email protected]" target=3D"_blank">[email protected]</a>&gt; on b=
ehalf of Martin Michel &lt;<a href=3D"mailto:[email protected]" target=3D"_bl=
ank">[email protected]</a>&gt;<br>
<b>Sent:</b> Thursday, January 30, 2020 3:44 PM<br>
<b>To:</b> douglas mcallaster &lt;<a href=3D"mailto:douglas.mcallaster@gmai=
l.com" target=3D"_blank">[email protected]</a>&gt;<br>
<b>Cc:</b> <a href=3D"mailto:[email protected]" target=3D"_blank">lout-=
[email protected]</a> &lt;<a href=3D"mailto:[email protected]" target=3D=
"_blank">[email protected]</a>&gt;<br>
<b>Subject:</b> Re: use windows fonts and adobe distiller and lout</font>
<div>=C2=A0</div>
</div>
<div><font size=3D"2"><span style=3D"font-size:11pt">
<div>Hey Doug,<br>
<br>
author of the script here. William and David already explained the idea<br>
of the script very well, I have not much to add. It is basically a<br>
wrapper around ttf2pt1 which automates the whole chain of preparation<br>
for using a TTF/OTF font within Lout. The Readme on GitHub [1] gives<br>
some more details, but you know it probably already.<br>
<br>
I used the script successful on MacOS and Linux but have no experience<br>
with it on Windows. To directly use it, you could try to install Cygwin<br>
[2] or MSYS2 [3], install the required programs and follow the steps<br>
from the Readme. The dependencies are a bunch of GNU Unix/Linux tools<br>
which should come out-of-the box in Cygwin (bash, sed, grep, tee, ...) and<=
br>
the ttf2pt1 program [4]. Compilation requires specific development<br>
headers, e.g. Freetype 2 [5] and build essential tools like make and<br>
gcc.=C2=A0 Although all those resource should be accessible by Cygwin&#39;s=
<br>
package system, I have to admit, this is not an easy path if you are<br>
completely new to GNU/Linux/Unix. To cut a long story short, I cannot<br>
guarantee it will work this way but if you are ambitious and eager to<br>
learn something new, just give it a try. (Alternatively, you could<br>
install a Linux VM using Virtualbox [6] but this would make your task<br>
even bigger=E2=80=A6)<br>
<br>
If there is another, easier way (Windows or Linux), I would be also very<br=
>
happy to learn about it from the community.<br>
<br>
=E2=88=92Martin<br>
<br>
[1] <a href=3D"https://github.com/smartmic/addfonts" target=3D"_blank">http=
s://github.com/smartmic/addfonts</a><br>
[2] <a href=3D"https://www.cygwin.com/" target=3D"_blank">https://www.cygwi=
n.com/</a><br>
[3] <a href=3D"https://www.msys2.org/" target=3D"_blank">https://www.msys2.=
org/</a><br>
[4] <a href=3D"http://ttf2pt1.sourceforge.net/" target=3D"_blank">http://tt=
f2pt1.sourceforge.net/</a><br>
[5] <a href=3D"https://www.freetype.org/" target=3D"_blank">https://www.fre=
etype.org/</a><br>
[6] <a href=3D"https://www.virtualbox.org/" target=3D"_blank">https://www.v=
irtualbox.org/</a><br>
<br>
<br>
On Tue, Jan 28, 2020 at 05:33:49PM -0500, douglas mcallaster wrote:<br>
&gt; Folks,<br>
&gt; <br>
&gt; Can lout use the truetype fonts which come with Windows 10?<br>
&gt; (And I am using Adobe Distiller to make pdf from the lout generated po=
stscript.)<br>
&gt; <br>
&gt; I found an explanation for using non standard fonts from 20 years ago =
(using PFA or PFB and AFM files),<br>
&gt; but I assume truetype fonts would provide much higher quality.<br>
&gt; <br>
&gt; I discovered (on git hub) a script from Martin Michel from 2014 but it=
 is for Linux and ghostscript.<br>
&gt; Has someone made a Windows powershell script which could perform this =
magic for me?<br>
&gt; <br>
&gt; Or perhaps someone could explain the script (copied next under) so tha=
t I could try to its steps manually.<br>
&gt; =C2=A0<br>
&gt; As I understand it, I would have to set up lout to find the AFM file v=
ia a myfonts.ld file.<br>
&gt; <br>
&gt; If someone could reply with the requisite (I assume) AFM file (based o=
n some Windows10 truetype font),<br>
&gt; and a myfonts.ld file (with the correct matching @name, @family, @face=
, @tag, @metrics, @mapping info)<br>
&gt; what would be really great. (An early success would keep me going, as =
I have a day job.)<br>
&gt; <br>
&gt; Also, if folks have done this and can suggest a nice Windows Monospace=
, Serif, and San Serif font, I welcome it.<br>
&gt; <br>
&gt; Finally, my thoughts go out to Dr Kingston, who enjoyed hiking in Aust=
ralia,<br>
&gt; as I wonder how much of his treasured woodlands are now destroyed.<br>
&gt; <br>
&gt; Thanks, Doug<br>
&gt; <br>
&gt; #!/bin/bash<br>
&gt; #<br>
&gt; # addfonts.sh<br>
&gt; # Converts True Type or Open Type Fonts to Postscript Type1 Fonts and =
populates<br>
&gt; # the Ghostscript Fontmap file and the Basser Lout FontDef databases f=
or local<br>
&gt; # users.<br>
&gt; #<br>
&gt; # Depends on non-standard commands: ttfpt1 (compiled against Freetype)=
<br>
&gt; #<br>
&gt; #<br>
&gt; # Copyright 2014 Martin Michel<br>
&gt; #<br>
&gt; # =C2=A0 Licensed under the Apache License, Version 2.0 (the &quot;Lic=
ense&quot;); you may not<br>
&gt; # =C2=A0 use this file except in compliance with the License.=C2=A0 Yo=
u may obtain a copy<br>
&gt; # =C2=A0 of the License at<br>
&gt; #<br>
&gt; # =C2=A0 =C2=A0 <a href=3D"http://www.apache.org/licenses/LICENSE-2.0"=
 target=3D"_blank">http://www.apache.org/licenses/LICENSE-2.0</a><br>
&gt; #<br>
&gt; # =C2=A0 Unless required by applicable law or agreed to in writing, so=
ftware<br>
&gt; # =C2=A0 distributed under the License is distributed on an &quot;AS I=
S&quot; BASIS, WITHOUT<br>
&gt; # =C2=A0 WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli=
ed.=C2=A0 See the<br>
&gt; # =C2=A0 License for the specific language governing permissions and l=
imitations<br>
&gt; # =C2=A0 under the License.<br>
&gt; =C2=A0 =C2=A0<br>
&gt; shfile=3D$(sed &#39;s/^.*\///&#39; &lt;&lt;&lt; $0)<br>
&gt; logfile=3D$(sed -e &#39;s/\.sh/\.log/; s/^.*\///&#39; &lt;&lt;&lt; $0)=
<br>
&gt; #echo $0 $shfile $logfile<br>
&gt; <br>
&gt; usage=3D&quot;Usage: ./$shfile<br>
&gt; No arguments applicable. This script scans for new True Type or Open T=
ype Font<br>
&gt; files, converts them to Postscript Type1 Fonts and updates the Fontmap=
<br>
&gt; (Ghostscript) and @FontDef (Lout) databases. The script and all associ=
ated input<br>
&gt; and output files must be in the local user ghostscript font path.&quot=
;<br>
&gt; <br>
&gt; echo &quot;***********************************************************=
******&quot;\<br>
&gt; =C2=A0 =C2=A0&gt;&gt;$logfile<br>
&gt; echo &quot;LOG ENTRY from &#39;$shfile&#39;&quot;&gt;&gt;$logfile<br>
&gt; echo -e &quot;Run by $USER on $HOSTNAME at $(date) \n &quot;&gt;&gt;$l=
ogfile<br>
&gt; <br>
&gt; if [ $# -gt 0 ] ; then<br>
&gt; =C2=A0 =C2=A0 echo -e &quot;TERMINATION: Wrong number of arguments. \n=
&quot; |tee -a $logfile<br>
&gt; =C2=A0 =C2=A0 echo -e &quot;$usage\n&quot;<br>
&gt; =C2=A0 =C2=A0 exit 1<br>
&gt; fi<br>
&gt; <br>
&gt; if [[ &quot;$GS_FONTPATH&quot; !=3D &quot;$(pwd)&quot; ]] ; then<br>
&gt; =C2=A0 =C2=A0 echo -e &quot;TERMINATION: Wrong working directory or GS=
_FONTPATH not set.\n&quot; |tee -a $logfile<br>
&gt; =C2=A0 =C2=A0 echo -e &quot;Current directory: $(pwd)&quot; |tee -a $l=
ogfile<br>
&gt; =C2=A0 =C2=A0 echo -e &quot;GS_FONTPATH: $GS_FONTPATH&quot; |tee -a $l=
ogfile<br>
&gt; =C2=A0 =C2=A0 echo -e &quot;$usage\n&quot;<br>
&gt; =C2=A0 =C2=A0 exit 2<br>
&gt; fi<br>
&gt; <br>
&gt; [ ! -f Fontmap ] &amp;&amp; echo -e &quot;INFO: Ghostscripts local &#3=
9;Fontmap&#39; file missing, will<br>
&gt; be created.\n&quot; |tee -a $logfile =C2=A0&amp;&amp; touch Fontmap<br=
>
&gt; <br>
&gt; ls *.[oOtT][tT][fF] 2&gt;/dev/null 1&gt;&amp;2<br>
&gt; if [ $? -ne 0 ] ; then<br>
&gt; =C2=A0 =C2=A0 echo -e &quot;TERMINATION: No True or Open Type Font fil=
es (.ttf,.otf) in directory.&quot; |tee -a $logfile<br>
&gt; =C2=A0 =C2=A0 echo -e &quot;$usage\n&quot;<br>
&gt; =C2=A0 =C2=A0 exit 3<br>
&gt; fi<br>
&gt; <br>
&gt; availableTTF=3D( $(ls -1 *.[oOtT][tT][fF] | sed &#39;s/\.otf\|\.ttf//i=
&#39;) )<br>
&gt; installedPFB=3D( $(grep -e &#39;^/&#39; Fontmap | sed &#39;s/^.*(\|\.p=
fb.*$//g&#39;) )<br>
&gt; <br>
&gt; typeset -i counter<br>
&gt; typeset -i numTTF<br>
&gt; typeset -i numInstalled<br>
&gt; typeset -i numPFB<br>
&gt; numTTF=3D${#availableTTF[*]}<br>
&gt; numInstalled=3D${#installedPFB[*]}<br>
&gt; counter=3D$numInstalled<br>
&gt; numPT1=3D$(ls -1 *.[aApP][fF][bBmM] 2&gt;/dev/null | wc -l )<br>
&gt; <br>
&gt; let z=3DnumPT1/2<br>
&gt; let m=3DnumPT1%2<br>
&gt; <br>
&gt; if (( $numInstalled &lt; z &amp;&amp; m =3D=3D 0 )) ; then<br>
&gt; =C2=A0 =C2=A0 echo -e &quot;WARNING: There are unregistered PS Type1 f=
ont files.\n&quot; |tee -a $logfile<br>
&gt; elif (( $numInstalled &gt; z || m &gt; 0 )) ; then<br>
&gt; =C2=A0 =C2=A0 echo -e &quot;TERMINATION: There are missing PS Type1 fo=
nt files. It is recommend to<br>
&gt; syncronize all files and databases in this directory (delete Fontmap a=
nd rerun<br>
&gt; $0)\n&quot; |tee -a $logfile<br>
&gt; =C2=A0 =C2=A0 exit 4<br>
&gt; fi<br>
&gt; <br>
&gt; echo -e &quot;STATUS: There are $numInstalled installed Postscript Typ=
e1 Fonts out of $numTTF<br>
&gt; available True Type or Open Type Fonts for user $USER. \n&quot; &gt;&g=
t;$logfile<br>
&gt; <br>
&gt; if (( $numTTF !=3D $numInstalled ))<br>
&gt; then<br>
&gt; =C2=A0 =C2=A0 for ii in ${availableTTF[*]}; do<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 for jj in ${installedPFB[*]}; do<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if [[ &quot;$ii&quot; !=3D &=
quot;$jj&quot; ]]; then<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 counter=3D$cou=
nter-1<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fi<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 done<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (( $counter =3D=3D =C2=A00 )) ; then<br=
>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 queueFonts=3D(&quot;${queueF=
onts[@]}&quot; &quot;$ii&quot;)<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 fi<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0counter=3D$numInstalled<br>
&gt; =C2=A0 =C2=A0 done<br>
&gt; else<br>
&gt; =C2=A0 =C2=A0 echo &quot;INFO: Font database is up-to-date if you have=
 not fiddled with the<br>
&gt; contents of this directory or the local Fontmap file manually after th=
e<br>
&gt; last run of this script. Consult the log file for history.<br>
&gt; =C2=A0 =C2=A0<br>
&gt; Nothing to do. No new fonts installed.&quot; |tee -a $logfile<br>
&gt; =C2=A0 =C2=A0 exit 0<br>
&gt; fi<br>
&gt; <br>
&gt; for ff in ${queueFonts[@]}; do<br>
&gt; =C2=A0 =C2=A0 echo &quot;---------------------------------------------=
--------------------&quot;\<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt;&gt;$logfile<br>
&gt; =C2=A0 =C2=A0 echo &quot;START OF TTF2PT1 LOG ENTRY FOR &#39;$ff&#39;&=
quot; &gt;&gt;$logfile<br>
&gt; =C2=A0 =C2=A0 echo $(date) &gt;&gt;$logfile<br>
&gt; =C2=A0 =C2=A0 echo &quot;---------------------------------------------=
--------------------&quot;\<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0&gt;&gt;$logfile<br>
&gt; <br>
&gt; =C2=A0 =C2=A0 ttf2pt1 -b $ff.[oOtT][tT][fF] =C2=A0&gt;&gt;$logfile 2&g=
t;&amp;1<br>
&gt; <br>
&gt; =C2=A0 =C2=A0 fontNames=3D(&quot;${fontNames[@]}&quot; &quot;$(grep Fo=
ntName $ff.afm | cut -d&#39; &#39; -f2-)&quot;)<br>
&gt; =C2=A0 =C2=A0 familyNames=3D(&quot;${familyNames[@]}&quot; \<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 &quot;$(grep FamilyName $ff.afm | cut -d&#=
39; &#39; -f2- | sed &#39;s/ /_/g&#39;)&quot;)<br>
&gt; =C2=A0 =C2=A0 faceNames=3D(&quot;${faceNames[@]}&quot; \<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 &quot;$(grep Weight $ff.afm | cut -d&#39; =
&#39; -f2- | \<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 sed -e&#39; s/^./\U&amp;/g; s/ *//g; s/Reg=
ular/Base/i; s/Italic/Slope/i &#39;)&quot;)<br>
&gt; =C2=A0 =C2=A0 tagNames=3D(&quot;${tagNames[@]}&quot; &quot;${familyNam=
es[@]:(-1)}-${faceNames[@]:(-1)}&quot;)<br>
&gt; <br>
&gt; =C2=A0 =C2=A0 echo &quot;/${fontNames[@]:(-1)} ($ff.pfb);&quot; &gt;&g=
t;Fontmap<br>
&gt; =C2=A0 =C2=A0<br>
&gt; =C2=A0 =C2=A0 if [[ -z `cat myfontdefs.ld | sed -n &#39;/&#39;&quot;$f=
f&quot;&#39;.afm/p&#39;` ]] ; then<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 cat &gt;&gt;myfontdefs.ld&lt;&lt;LOUT_ENTR=
Y<br>
&gt; { @FontDef<br>
&gt; =C2=A0 =C2=A0 =C2=A0 @Tag { ${tagNames[@]:(-1)} }<br>
&gt; =C2=A0 =C2=A0 =C2=A0 @Family { ${familyNames[@]:(-1)} }<br>
&gt; =C2=A0 =C2=A0 =C2=A0 @Face { ${faceNames[@]:(-1)} }<br>
&gt; =C2=A0 =C2=A0 =C2=A0 @Name { ${fontNames[@]:(-1)} }<br>
&gt; =C2=A0 =C2=A0 =C2=A0 @Metrics { $ff.afm }<br>
&gt; =C2=A0 =C2=A0 =C2=A0 @Mapping { LtLatin1.LCM }<br>
&gt; }<br>
&gt; <br>
&gt; LOUT_ENTRY<br>
&gt; =C2=A0 =C2=A0 fi<br>
&gt; =C2=A0 =C2=A0<br>
&gt; =C2=A0 =C2=A0 # Correct for whitespace error in afm files<br>
&gt; =C2=A0 =C2=A0 sed -i &#39;s/.null/space/&#39; $ff.afm<br>
&gt; <br>
&gt; =C2=A0 =C2=A0 echo &quot;*********************************************=
********************&quot;\<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 &gt;&gt;$logfile<br>
&gt; =C2=A0 =C2=A0 echo -e &quot;Font: ${fontNames[@]:(-1)}; Tag: ${tagName=
s[@]:(-1)} (has been \<br>
&gt; installed.)&quot; |tee -a $logfile<br>
&gt; done<br>
<br>
</div>
</span></font></div>
</div>
</div>

</blockquote></div>

--000000000000fb779d059d76c9b8--