[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Debian] TrueType-2-Type1-2-TexFonts



* Roman BEIGELBECK <debian@aon.at> [10 03 01 00:34]:

>Wenn Du keinen passenden Webspace findest, dann stelle ich Dir natürlich
>gerne einen zur Verfügung. Die TeX-Gemeinde wird Dir sicherlich dankbar
>sein... :-)

Anbei das Script: Wenn Du es auf einer Seite zum runterladen anbieten
kannst, wäre das toll. 
Ich nehme mal an, dass Du einfach einen Link auf das Script machst und es
als *.txt speicherst



-- 
--//--\\--
Eckhard Hoeffner
ehoeffner@gmx.de
--//--\\--
#!/bin/bash

printf " \n \n \n
Please read the comments carefully.
This is alpha and will perhaps stay alpha.  

Some preparations have to be done: 
     
Put all ttf-files of one Supplier and one Type-Family in 
a new directory copy this file in the same directory, make the file
executable and then run it.
     
The programms ttf2pt1, type1inst, dvips must be installed.

Make shure only the *.ttf-files and this file is in created directory.
    
Check the names of the *.ttf Files according to the fontname sheme.
This can not be done by this script! 
Type Enter to continue \n \n"
read Enter

printf "To avoid problems, once again (Maybe this script has
to many warnings, but I made mistakes, so I want to prevent, that
you are making the same mistakes: 

1.
Do not store especially *.afm and *.pfb Files in the directory. 
They will be deleted. If you have some Postscript Fonts in a variant, that
you do not have as ttf-Fonts, you get the possibility, to transform
this fonts with this script, if you copy them in the same directory after
the ttf fonts are transformed. 

2.  
Please check while processing if fonts of the same foundry and
family are already installed (you wiill get a notice at the apropiate
place).  If yes, this may cause problems. You may see the new fonts
with xdvi, but perhaps you cannot print them! I can not give you a
solution for this problem - maybe someone else knows it better.

Perhaps you unistall the already installed fonts, not all of,
course, only the same fonts and than try the new fonts 
(save the fonts somewhere else than in your Postscript X-Fonts  
directory, update fontsdir an the fontmap map for ghostscript).

3. 
Uncomment the marked lines in the script, to get it to work."
#########################################################
# uncomment the following line to get this script to work.
exit 0
# uncomment the  line above to get this script to work.
#########################################################   
printf " ******************************************************************
    Naming the fonts is complicated, if you never did it before. Some Hints:
    All fonnames are combinations of abreviations for some Fontinformation:
    1. Letter: Supplier like b for bitstream, p for adobe, m for monotype.
    2. an 3. Letter: familiname like gs for Gill Sans or pl for Palatino.
    4. Letter: wheight like r for Regular or Roman, d for Demi, l for light,
       h for heavyface.
    5. Letter: This is  complicated, because it can be the encoding sheme
       (which is in general Adobe Standard) and it can be the variant. If the 
       font is for example italic, you use an \"i\", if it is the normal upright
       face, you use nothing, but start with the encoding (8a for Adobe Standard 
       in general).\n"
echo "Type Enter to continue"
read Enter

printf " ******************************************************************
Maybe you start with something easy for the first time and take a
font where you have the normal font in regular an bold an the variants
normal and italic. Supplier = Adobe (p)  Font = Antique Olive (ao).
Then you get the
 
     TeX-Familyname: pao
     paor8a.ttf for the regular 
     paori8a.ttf for the regular italic
     paob8a.ttf for the bold and
     apobi8a.ttf for the bold italic font.\n

If you have the normal TeX documentation installed, the fontname sheme
should open now, so please have a look in it.
For the most common fonts you will find also the original filename of the  
supplier. If you have fonts named 

    op______.ttf, 
    op_____.ttf, 
    opi_____.ttf and
    opbi____.ttf 

from adobe, it is likely, that you have some Optima fonts. \n"   
echo "Type Enter to continue"
read Enter

for X in *.ttf 
	do ttf2pt1 -b $X ${X%%.ttf} 
	done

for X in *.TTF 
	do ttf2pt1 -b $X ${X%%.TTF} 
	done


printf " \n 
 ******************************************************************
I can give you only a little help. I found the following 
Information:\n"

printf " *********************** Fontnames ***************************\n"

cat *.afm | grep FontName

printf " *********************** Supplier ****************************\n"

cat *.afm | grep Copyright

printf " *************************************************************\n"

# I have tested this only fore some fonts. With each font I found
# FontEncoding FontSpecific, therfore I am not shure if this works
# with afm-files generated by ttf2pt1. Maybe someone got a solution.  
#
# echo "Take also a look at the encoding, if it is Adobe Standard"
# echo "or font specific, then please use the 8x encoding for the fonts"
# echo "and quit this program, because it can not handle  font specific"
# echo "encodings :-( "
# printf " ******************* Encoding ********************************\n"

# cat *.afm | grep EncodingScheme 

rm -f *.afm
rm -f *.pfb

printf " ******************************************************************
 
Do you want to look at the fontname documentation?
I assume you have the TeX documentation installed.
Please answer: yes or no \n"
read fontnamedoc
case "$fontnamedoc" in 
    yes | Yes |  YES ) 
	echo "OK" 
	texdoc fontname	
	;; 
    *) 
	echo "Wrong fontnames will not work with proper TeX." 
    ;;
esac 
echo "Please check, if the fonts are already avaible for X."
xfontsel
echo " ******************************************************************"
echo "Do you think, your fontnames are alright? please answer yes or no:" 

read Start 

case "$Start" in 
    yes | Yes |  YES ) 
	echo "Ok, we will continue" 
	;; 
    *) 
	echo "Nothing done and exiting now" 
	exit 0 
    ;;
esac

TexTree=" "    
    echo " ******************************************************************"  
    echo "Where is your texmf tree, maybe" 
    echo "/usr/share/texmf or /usr/local/texmf "
    echo " "
printf "Maybe you just want to try this script then create a directory 
with the following subdirecories:

         my-test-texmf/dvips/config
         my-test-texmf/tex/latex/psnfss \n

         In the later case, you may restart the program after the test, 
         because if your fonts are not in the TeX directory, you will not 
         be able to use them. \n"
    echo "Your (test?)texmf tree is:"
read TexTree    

    if [ -d $TexTree ]; then
	echo "OK, we will continue"
    else
	echo "I can not find your TeX tree"
	echo "I will exit now"
	exit 0
    fi
echo " ******************************************************************"
echo "Where do you store the Type1-Fonts for your X-Server"
echo "/usr/X11R6/lib/X11/fonts/Type1?"
XFonts=" "
read XFonts
    if [ -d $XFonts ]; then
	echo "OK, we will continue."
    else
	echo "I can not find your directory for the Type1-Fonts. I will exit now"
	exit 0
    fi

echo " ******************************************************************"
printf  "Tell me font family name, for example: bgo for Bitstream Goudy Oldstyle. 
Please have in mind, that wrong fontnames in general will not work 
with TeX or LaTeX. If you are not sure exit with:  Ctrl C
otherwise enter the TeX font family name:  "
 
read FONTFAMILY
# Does not work - maybe someone knows bash better than me 
# can correct this 

#    if [ -f $TexTree/tex/latex/*"$FONTFAMILY".fd ]; then
# printf "Something wicked happend, because I found files which may be 
# font definition files for $FAMILYNAME - please make sure, that
# this font family is not already installed. Look in the $TexTree/tex/latex/.  
#
# Maybe you want to rename the existing files for the $FONTFAMILY 
# files and start the programm again I will stop now."
#	    exit 0
#	else
#	echo "------------------------------------------"
	    echo "All font files will start with $FONTFAMILY"
#	    echo "------------------------------------------"
#	    echo "------------------------------------------"
#	    sleep 1
#    fi 
    
echo " ******************************************************************"
echo "Tell me the name of the supplier, for example:"
echo "adobe bitstream monotype"
echo "Due to DOS limitations in TEX the directories and filenames are limited"
echo "to 8 charakters, so perhaps you want to take a look in your texmf/fonts/tree"
echo "if the foundry allready has its directory. In any case,please provide the foundry"
echo "as it should appear in your TeX system or perhaps you just enter my-ttf"
echo "and you can find the new fonts under"
printf "\n"
    echo "     $TexTree/fonts/tfm/my-ttf"
    echo "     $TexTree/fonts/vf/my-ttf"
    echo "     $TexTree/fonts/afm/my-ttf"
    echo "     $TexTree/fonts/type1/my-ttf"
    echo " "
    echo "If you are not sure exit with: Ctrl C and take a look at the fontname.dvi.gz"
    echo "provided with your teTex Distribution Supplier is ? "

read FOUNDRY

echo " ******************************************************************"
echo "You told me $FOUNDRY"    
echo "Later I will create the directories in your texmf-treee for"
echo "this suplier, if does not exist."

############### Postscript Fonts ########################
echo "Now we are creating the postscript fonts. In general you will see a lot of warnings"
echo "while font generation - this is normal. Type Enter to continue."
read Enter 
 
for X in *.ttf 
	do ttf2pt1 -b $X ${X%%.ttf} 
	done

sleep 2

echo " ******************************************************************"
    echo "Enter the general font family name for example garamond or futura"
    echo "This is not the TeX font familiy name however, you may use this name," 
    echo "if this is alright for you"
    echo "In any case:"
    echo "Do not use spaces, umlaute etc in the font name!"
    echo "GoudyOldStyle is ok, but Goudy Old Style will cause problems."
    printf "Perhaps you take one of the following names without any
wheigts and variants: \n"

cat *.afm | grep FontName
read FontName
if [ -d $TexTree/fonts/tfm/$FOUNDRY/$FontName ]; then

echo " ******************************************************************" 
echo "I think you already have installed some fonts with the same fontname: $FontName"
echo "I will exit now, because I do not want to delete existing fonts."
echo "If you want me to continue, please type \"go-on\" " 
echo "and I will create the font files you can stop this programm, before I will"
echo "start moving the fonts in your TeX tree."
echo "Please answer   \"go-on\"    -- or Enter to exit"
    read weiter
	if [ $weiter = "go-on" ]; then 
	    echo "- - - - - - - - - - - - - - - - - - - - -"
	    echo "Have in mind, that this programm may overwrite existing files"
	    echo " "
	    sleep 3
	else
	    exit 0
	fi 
else 
    echo "OK"  
fi

####### fontinst dvips files ####################

echo "\input fontinst.sty \latinfamily{$FONTFAMILY}{} \bye" > fontinst.tex
echo "I just created the fontinst texfile, we will"
echo "use this file for generating the tex fonts."
echo "Type Enter to continue"
read Enter
echo " ******************************************************************"
echo "p +$FONTFAMILY.map" > config.$FONTFAMILY
echo "created  config.$FONTFAMILY"
echo "we will move this to $TexTree/dvips/config"
echo "Type Enter to continue"
read Enter
echo " ******************************************************************"
echo "$FONTFAMILY b8r $FontName -Bold 	\"TeXBase1Encoding ReEncodeFont \"  <8r.enc <$FONTFAMILY b8a.pfb" > $FONTFAMILY.map
echo "$FONTFAMILY bi8r  $FontName -BoldItalic \"TeXBase1Encoding ReEncodeFont \" 	<8r.enc <$FONTFAMILY bi8a.pfb" >> $FONTFAMILY.map
echo "$FONTFAMILY bo8r  $FontName -Bold  \"0.167 SlantFont TeXBase1Encoding ReEncodeFont \" <8r.enc <$FONTFAMILY b8a.pfb" >> $FONTFAMILY.map
echo "$FONTFAMILY r8r  $FontName -Regular  \"TeXBase1Encoding ReEncodeFont \" <8r.enc <$FONTFAMILY r8a.pfb" >> $FONTFAMILY.map
echo "$FONTFAMILY ro8r  $FontName -Regular \"0.167 SlantFont TeXBase1Encoding ReEncodeFont \" <8r.enc <$FONTFAMILY r8a.pfb" >> $FONTFAMILY.map
echo "$FONTFAMILY ri8r  $FontName -Italic \"TeXBase1Encoding ReEncodeFont \" <8r.enc <$FONTFAMILY ri8a.pfb" >> $FONTFAMILY.map
echo "$FONTFAMILY l8r   $FontName \"TeXBase1Encoding ReEncodeFont \" <8r.enc <$FONTFAMILY l8a.pfb" >> $FONTFAMILY.map
echo "$FONTFAMILY lo8r  $FontName \"0.167 SlantFont TeXBase1Encoding ReEncodeFont \" <8r.enc <$FONTFAMILY l8a.pfb" >> $FONTFAMILY.map

echo "I created $FONTFAMILY.map used by dvips"
echo "Maybe this file is totally useless for you and you must edit everything new in this file!!"
echo "$FONTFAMILY.map will stay in $PWD. Please edite this file after the programm has"
echo "done its work. Then move the file to  $TexTree/dvips/config"
echo "and edit updmap and config.ps also"


echo " ******************************************************************"
############## TeX Fonts ########################################

echo "Now we start with the Tex fonts"
echo "If you havge some Type1 Fonts of the same supplier and"
echo "the same Fontfamily, you can copy these Fonts, (afm and pfb files)"
echo "in $PWD and continue. Type Enter to continue"
read Enter


latex fontinst.tex

 for file in *.vpl ;
 do  basefile=`basename $file .vpl`;
 vptovf $basefile.vpl $basefile.vf $basefile.tfm;
 done

 for file in *.pl ;
 do  basefile=`basename $file .pl`;
 pltotf $basefile.pl $basefile.tfm;
 done

echo " "
echo "Now we are removing some files, we do not any more"
echo " "
sleep 1
# do not remove the config.ppl (Palatino) 
rm -f *.pl
rm -f *.vpl
# A Fontfamily "tx" is not mentioned in fontname
# so rm -f *.*tx should be alright
rm -f *.mtx
rm -f *.etx

echo "I have created the fonts and can start copying the files to the"
echo "final places - however perhaps you want to check, if everything is alright!"
echo "  " 

echo "******************************************************"
echo "******************************************************"
echo "Please take a look at the generated *.afm-files in $PWD"
echo "If there are no Kern Datas and no Kern Pairs in it"
echo "Then you got some poor fonts, that should not be used with TeX and ghostview"
echo "You may try to use them whith X, Kword, StarOffice or something else"
echo "******************************************************"
echo "******************************************************"

echo "  "
echo "Then we will start moving the files in the directories"
echo "Enter to continue"
read Enter

echo " ******************************************************************"
echo "I will copy the generated files as follows:"
echo "  "
echo "The *.tfm files will go to $TexTree/fonts/tfm/$FOUNDRY/$FontName"
echo "  "
echo "The *.vf files will go to  $TexTree/fonts/vf/$FOUNDRY/$FontName"
echo "  "
echo "The *.afm files will go to $TexTree/fonts/tfm/$FOUNDRY/$FontName"
echo "          and              $XFonts"
echo "  "
echo "The *.pfb files will go to $TexTree/fonts/tfm/$FOUNDRY/$FontName"
echo "          and              $XFonts"
echo "  "
echo "The *.fd files will go to $TexTree/tex/latex/psnfss"
echo "  "
echo "The config.$FONTFAMILY file to  $TexTree/dvips/config"
echo " "
echo "The $FONTFAMILY.map file will stay in $PWD,"
echo "because you have to edit this file manually."

echo "Enter to continue"
read Enter

echo "******************************************************************"
echo "I will also leave the *.afm Files in this directory"
echo "To adjust the $FONTFAMILY.map file take a look at each"
echo "afm file: You will find the FontName in the afm file"
echo "(this is not the FullName and not the FamilyName)"
echo "You need this name for the $FONTFAMILY.map"
echo "All other questions regarding the  $FONTFAMILY.map"
echo "should be done according to the dvips manual."
echo " ******************************************************************"
echo "You must be root, to copy the files, of course."
printf "Is this alright? Please answer yes or no (last possibility to exit!)\n" 

read StartKopie

case "$StartKopie" in
    yes | Yes | YES ) 
	echo "OK" ;;  
    * )	
	echo "Nothing done and exiting now"
        exit 0 
	;;
    esac  

# tfm directory test supplier

if [ -d $TexTree/fonts/tfm/$FOUNDRY ]; then 
	echo "----------------------------------------"  
	echo "I think you already have installed some"
	echo "fonts of the foundry  $FOUNDRY"  
	echo "$TexTree/fonts/tfm/$FOUNDRY exists"
	echo "Nothing done"    
	echo "----------------------------------------"
else  
	mkdirhier $TexTree/fonts/tfm/$FOUNDRY
	echo "created  $TexTree/fonts/tfm/$FOUNDRY!"
fi

# afm directory test supplier

if [ -d $TexTree/fonts/afm/$FOUNDRY ]; then 
    echo "----------------------------------------"
    echo "$TexTree/fonts/afm/$FOUNDRY exists"
    echo "Nothing done"    
    echo "----------------------------------------"
else  
    mkdirhier $TexTree/fonts/afm/$FOUNDRY
    echo "created $TexTree/fonts/afm/$FOUNDRY!"
fi

# vf directory test supplier

if [ -d $TexTree/fonts/vf/$FOUNDRY ]; then 
    echo "----------------------------------------"
    echo "$TexTree/fonts/vf/$FOUNDRY exists"
    echo "Nothing done"
    echo "----------------------------------------"
else  
    mkdirhier $TexTree/fonts/vf/$FOUNDRY
    echo "created $TexTree/fonts/vf/$FOUNDRY!"
fi

#type1 directory test  supplier

if [ -d $TexTree/fonts/type1/$FOUNDRY ]; then 
    echo "----------------------------------------"
    echo "$TexTree/fonts/type1/$FOUNDRY exists"
    echo "Nothing done"    
    echo "----------------------------------------"
else  
    mkdirhier $TexTree/fonts/type1/$FOUNDRY
    echo "created $TexTree/fonts/type1/$FOUNDRY!"
fi

# tfm directory test fontname

if [ -d $TexTree/fonts/tfm/$FOUNDRY/$FontName ];    then 
    echo "$TexTree/fonts/tfm/$FOUNDRY/$FontName exists"
    echo "Nothing done"    
else 
    mkdirhier $TexTree/fonts/tfm/$FOUNDRY/$FontName
    echo "created $TexTree/fonts/tfm/$FOUNDRY/$FontName"
fi

# afm directory test fontname

if [ -d $TexTree/fonts/afm/$FOUNDRY/$FontName ];    then 
    echo "$TexTree/fonts/afm/$FOUNDRY/$FontName exists"
    echo "Nothing done"    
else 
    mkdirhier $TexTree/fonts/afm/$FOUNDRY/$FontName
    echo "created $TexTree/fonts/afm/$FOUNDRY/$FontName"
fi 

# vf directory test fontname

if [ -d $TexTree/fonts/vf/$FOUNDRY/$FontName ]; then 
    echo "$TexTree/fonts/vf/$FOUNDRY/$FontName exists"
    echo "Nothing done"     
else  
    mkdirhier $TexTree/fonts/vf/$FOUNDRY/$FontName
    echo "created $TexTree/fonts/vf/$FOUNDRY/$FontName"
fi

#type1 directory test fontname

if [ -d $TexTree/fonts/type1/$FOUNDRY/$FontName ]; then 
    echo "$TexTree/fonts/type1/$FOUNDRY/$FontName exists"
    echo "Nothing done"     
else  
    mkdirhier $TexTree/fonts/type1/$FOUNDRY/$FontName
    echo "created $TexTree/fonts/type1/$FOUNDRY/$FontName "
fi

########### Copy Files ##############

	mv *.tfm   $TexTree/fonts/tfm/$FOUNDRY/$FontName/
	mv *.vf    $TexTree/fonts/vf/$FOUNDRY/$FontName/
	cp *.afm   $TexTree/fonts/afm/$FOUNDRY/$FontName/
	cp *.pfb   $TexTree/fonts/type1/$FOUNDRY/$FontName/
	mv *.fd    $TexTree/tex/latex/psnfss/
	mv *.pfb   $XFonts
	cp *.afm   $XFonts
	mv config.* $TexTree/dvips/config/
############ updating TeX, fontsdir ################
        mktexlsr  
	texdoc dvips

echo "******************************************************************"
echo "To finish the installation do the following steps:" 
echo " "
echo "adjust the $FONTFAMILY.map file in $PWD, use the dvips manual."
echo "This is tricky, so please do this carefully"
echo "It should look something like this:"
echo " " 
echo "familyname_weight_variant_8r FontName_afm_file \"TeXBase1Encoding ReEncodeFont\"  <8r.enc <familyname_weigth_variant_8a.pfb"
echo "familyname_weight_variant_8r FontName_afm_file \"0.167 SlantFont TeXBase1Encoding ReEncodeFont\"  <8r.enc <familyname_weigth_8a.pfb"
echo " "
echo "In any case look at the existing map-files and have in mind"
echo "that the template will not work - it is just a reminder and"
echo "only for the most common case, where you have the"
echo "regular, regular-italic, bold and bold-italic Fonts."
echo "In this case, maybe you just have to delete the spaces between the"
echo "$FONTFAMILY and the weight/variant information."
echo "If you have other wheights, like - light -  or - demi -"
echo "or other variants like - oblique - there is even more work"
echo "to be done by you."
echo "Type \"Enter\" to continue"
read Enter

echo "******************************************************************"
# Maybe someone can tell me, how this is done automatically
echo "edit the $TexTree/dvips/config/config.ps file and add"
echo "\"p +$FONTFAMILY.map\" at the appropiate place"
echo " "
echo "edit  the $TexTree/dvips/config/updmap file and add"
echo "$FONTFAMILY.map as extra_modules"
echo " "
echo "edit the $TexTree/pdftex/config/pdftex.cfg file and add"
echo "map +$FONTFAMILY.map"
echo " "
# As long as the $FONTFAMILY.map is not correct, this can not be done 
# automatically :-(
echo "After having edited the previous mentioned files, run"
echo "updmap in  $TexTree/dvips/config/"
echo "and then you may try your new fonts, hopefully!"
echo "use \\renewcommand{\\rmdefault}{$FONTFAMILY} to test the Fonts, bye"  
echo " "
echo "Mail bugs, improvements, corrections, comments to ehoeffner@gmx.de."
echo "To finish, type Enter"
read Enter
printf "  
Use the following names for your $FONTFAMILY.map.
small caps and oblique fonts are special" 
cat *.afm | grep FontName
cd $XFonts ; type1inst
exit 0 
 


Reply to: