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

Re: Map or MixedMap?



Norbert Preining wrote:

What is your ultimate target???

Thank you for asking this important question.

I have installed fonts like the frutiger, berling, bera, urw-garamond, etc., for which there is support (available from CTAN) for making them LaTeX-recognizable. I will also be later installing fonts from the Font Site 500 CD for which also there is help for making them LaTeX-recognizable.

I have made up a little aide memoire to help me do this. It is attached as the file InstallingURWGaramondFontsForLaTeX.txt which covers the specific case of URW-Garamond. I want to automate steps 9 to 13 in this file to take care of all the fonts that I install.

It is easy to do these steps manually but each time I upgrade my OS from Kubuntu Dapper to Edgy to now, Feisty, I have to do it by hand. I have therefore written a Perl script to try to do this automatically, and I need to see if the decision for choosing Map or MixedMap is easily automated or not worth the effort, and must therefore rely on some other hand-edited file. I have attached the unfinished Perl script (which is in its very early stages).

Perhaps there is a Debian tool to do this already. Otherwise, I am happy to plod on and pass you my Perl script (for what it is worth) as my little contribution to the marvellous work that you are doing.

Many thanks.

Chandra
19 May 07
P.S. I am using XeTeX for other work and am looking forward to the texlive-2007 packages becoming stable so that I can install it.
Installing URW Garamond Fonts For LaTeX on Kubuntu
==================================================
1. Make a local directory tree so:

mkdir -p /usr/local/share/texmf/fonts/type1/urw/garamond

mkdir -p /usr/local/share/texmf/fonts/afm/urw/garamond

2. cd /usr/local/share/texmf/fonts/type1/urw/garamond

sudo wget ftp://ctan.tug.org/tex-archive/fonts/urw/garamond/*.pfb

3. cd /usr/local/share/texmf/fonts/afm/urw/garamond

sudo wget ftp://ctan.tug.org/tex-archive/fonts/urw/garamond/*.afm

4. Download the following package:

http://ctan.tug.org/tex-archive/fonts/urw/garamond/ugm.zip

to

/usr/local/share/texmf/

and unpack it there.

5. All the files should unpack and be installed in a TDS-compliant directory
tree.

6. Remove the zip file ugm.zip

7. sudo mktexlsr

or sudo texhash

8. Because Kubuntu is Debian-based, we need to do the following song and dance:

cd /etc/texmf/updmap.d

9. kdesu kate 10ugm.cfg

and insert the single line:

Map ugm.map

[MixedMap <font.map> if both outline and bitmapped fonts are available.]

Alternatively, do

sudo sh -c "echo Map\ ugm.map > /etc/texmf/updmap.d/10ugm.cfg"

or aletrnatively,

sudo makemap ugm 

(except for "MnSymbol" where we need to use MixedMap instead of Map and for
Latin Modern)

<--10. cd /etc/texmf/dvips

sudo ln -s /usr/local/share/texmf/dvips/config/ugm.map .
-->

11. sudo update-updmap

12. less /var/lib/texmf/web2c/updmap.cfg

to confirm that lines like

### From file: /etc/texmf/updmap.d/10ugm.cfg
Map ugm.map### End of file: /etc/texmf/updmap.d/10ugm.cfg

have been appended to the end of the file.

Alternatively, do

less /var/lib/texmf/web2c/updmap.cfg | grep ugm.cfg


13. sudo updmap-sys

Remove any superfluous identical copies of the file ugm.map as listed in the log
file.

14. To generate a package urw-garamond.sty one needs to create a file like so:

\ProvidesPackage{urw-garamond}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\renewcommand{\rmdefault}{ugm}
\endinput

and save it as

/usr/local/share/texmf/tex/latex/urw-garamond/urw-garamond.sty
15. sudo mktexlsr

RCS
18 May 06
19 May 07
#!/usr/bin/perl -w
use strict;
use diagnostics;

# TeXFontMapFiles
# Perl script to allow user-installed fonts to be recognized on a 
# Debian-based texlive installation.
#
# ############# NOTE##############
# 
# This script should be executed as root using sudo so:
#
# sudo /home/chandra/bin/TeXFontMapFiles
#
# 
# R (Chandra) Chandrasekhar
# chandra@ee.uwa.edu.au
# Chyavana@gmail.com
# First written: 16 May 07
# Last revised : 18 May 07
# Last revised : 19 May 07
#

#
# Generate files of the form 
# 60<fontname>.cfg
# in the directory /etc/texmf/updmap.d
# in a Debian-based K/Ubuntu TeX system
# to allow LaTeX to recognize and use those fonts.
# Almost all the work is automated and the .cfg files
# regenrated after each upgrade.
# Assumes the following:
# 
# 1. All user-installed fonts reside at /usr/local/share/texmf/fonts/map/dvips
# which is the value assigned to the variable $TeXLocalFonts.
#
# 2. The format of the .cfg files are as follows:
#
# Map <fontname.map> ###### QUERY: Can it be MixedMap for all cases? ########
# where <fontname.map> is the name of one or more files residing either in
# $TeXLocalMaps or in a subdirectory of $TeXLocalMaps.
#
#

my $TeXLocalMaps = "/usr/local/share/texmf/fonts/map/dvips";
my $prefix = "60";
my $cfg = ".cfg";
my $map = ".map";
my $map_directory = "/home/chandra/RootTest"; # for testing
my ($file, $dir, $ext, $subdir, $cfgfile, $fontmap);

# my $map_directory = "/etc/texmf/updmap.d"; # for production

use File::Basename;

opendir(FONTS, $TeXLocalMaps) or die "Could not open $TeXLocalMaps: $!\n";

    while (defined($subdir = readdir(FONTS)))
    {
    next if ($subdir =~ /^\.\.?$/); # skip . and ..; PC p 319
    if (-d "$TeXLocalMaps/$subdir")
        {# Ignore directories . and ..
        # Extract dirname
        $file = $subdir;
        print "Found directory $subdir\n";
        }
    if (-f _) # special variable: refers to last used filename in -X filetest
        {
        print "Found regular file $subdir\n";
        write_single_cfgfile($subdir, $cfgfile, $fontmap);
        }
    }

closedir(FONTS);

sub write_single_cfgfile
    {
    my($subdir, $cfgfile, $fontmap) = @_; # parameters
    my($file, $dir, $ext, $localtime);
    # Extract basename of file assuming extension is .map
    ($file, $dir, $ext) = fileparse($subdir, '\..*'); # PC p 329
    print "subdir is $subdir\n";
    print "Directory is $dir\n";
    print "File is $file\n";
    print "Extension is $ext\n";
    if ($ext ne ".map")
        {
        print "Warning: File $subdir does not have .map extension\n";
        }
    print "$subdir is a file\n";
    $fontmap = "Map ".$file.$map;
    print "$fontmap\n";
    $cfgfile = $prefix.$file.$cfg;
    $localtime = localtime();
    print "echo $fontmap > $map_directory/$cfgfile\n";
    open(MAPFILE, ">$map_directory/$cfgfile");
    printf(MAPFILE "%s", "# $cfgfile\n");
    printf(MAPFILE "%s", "# Added using script $0\n");
    printf(MAPFILE "%s", "# by Chandra on $localtime\n");
    printf(MAPFILE "%s", "#\n");
    printf(MAPFILE "%s", $fontmap);
    close(MAPFILE);
    }

sub count_sub_dirs
    {
    my($parent) = @_; # parameters
    }
# ^
# |
# Good to use use File::Find; as in Perl Cookbook (PC) p 322

# while (<FONTNAMES>)
#     {
#     $fontmap = "Map ".$_.$map;
#     #print $fontmap;
#     $cfgfile = $prefix.$_.$cfg;
#     print "echo $fontmap > $map_directory/$cfgfile\n";
#     open(MAPFILE, ">$map_directory/$cfgfile");
#     printf(MAPFILE "%s", $fontmap);
#     close(MAPFILE);
#     }
#     
# Special case
# MnSymbol has a MixedMap

Reply to: