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

Re: Installing an X fonts package to a new FontPath.



On Fri, Sep 10, 1999 at 04:08:02PM +0900, Changwoo Ryu wrote:
> Is there a Debian standard of an X fonts package?
> 
> xfntbig5p-cmex24m installs its fonts into a new path,
> `/usr/X11R6/lib/X11/fonts/chinese'.  And the postinst adds a "FontPath
> ..." line into /etc/X11/XF86Config.  But I think it is not a clean
> solution; /etc/X11/XF86Config can be easily overwritten by xf86config.
> 
> Is there any better way?

Well, this is probably as good a time as any to start talking about the "X
font policy proposal" I'm going to be making one of these days.

Yes, there is a better way, and it became available with the release of
xbase-clients 3.3.3.1-5.

This is not yet policy, but I'd like people's feedback on the following:

*) BDF fonts should be converted to PCF fonts with the bdftopcf utility,
   gzipped, and placed in a directory that corresponds to their resolution:

   100dpi fonts should go in /usr/X11R6/lib/X11/fonts/100dpi.

   75dpi fonts should go in /usr/X11R6/lib/X11/fonts/75dpi.

   character-cell fonts, cursor fonts, and other low-resolution fonts should
   go in /usr/X11R6/lib/X11/fonts/misc.

*) Speedo fonts should go in /usr/X11R6/lib/X11/fonts/Speedo.
   (I know of no freely-licensed Speedo fonts other than those that ship
   with X itself.)

*) Type 1 fonts should go in /usr/X11R6/lib/X11/fonts/Type1.

*) The creation and usage of other font directories under
   /usr/X11R6/lib/X11/fonts is discouraged.  (The PEX and cyrillic
   directories are "grandfathered" in because they are part of the X
   distribution.)

*) Font packages should not contain both 75dpi and 100pi versions of a
   font.  If both are available from the upstream source, they should be
   provided in separate binary packages with "-75dpi" or "-100dpi" appended
   to the package name.

*) Under no circumstances should font packages provide fonts.dir,
   fonts.alias, or fonts.scale files in a font directory.  The fonts.dir
   file should not be provided at all (it is auto-generated by the
   mkfontdir program).

   fonts.alias and fonts.scale files, if needed, should be provided in the
   directory /etc/X11/fonts/FONTDIR/PACKAGE.EXTENSION where:
     FONTDIR is the name of the subdirectory of /usr/X11R6/lib/X11/fonts
     where the fonts are stored (e.g., 75dpi, misc, and so forth);
     PACKAGE is the name of the package that provides these fonts; and
     EXTENSION is either scale or alias, whichever corresponds to the file
     contents.

   [I'd appreciate feedback on the usage of /etc vs. /var for the
   fonts.scale and fonts.alias files; I don't see why anyone could or
   should modify *.scale files, but it could well be desirable for the
   sophisticated user to modify *.alias files.]

*) Font packages must declare a dependency on xbase-clients and invoke
   mkfontdir on each directory into which they installed fonts in the
   post-installation and post-removal scripts.

*) Font packages that provide a fonts.scale file as described above must
   declare a dependency on xbase-clients (>= 3.3.3.1-5) and invoke
   update-fonts-scale on each directory into which they installed fonts
   BEFORE invoking mkfontdir on that directory.  (See the mkfontdir manual
   page for why.)  This invocation must occur in both the post-installation
   and post-removal scripts.

*) Font packages that provide a fonts.alias file as described above must
   declare a dependency on xbase-clients (>= 3.3.3.1-5) and invoke
   update-fonts-alias on each directory into which they installed fonts in
   the post-installation and post-removal scripts.  (It does not matter
   when update-fonts-alias is called in relation to mkfontdir or
   update-fonts-scale.)

*) Font packages should not provide alias names for their fonts that
   collide with alias names already in use by another package without
   discussing this with the package maintainer of the package in question.
   Such a collision should also be documented in the README.Debian file of
   the font package.  [This point needs some more work.]

*) Font packages must not provide fonts with the same XLFD registry name as
   another font already packaged.

Sample post-installation and post-removal scripts are attached.  I
encourage maintainers of font packages to follow these examples as closely
as possible, but any implementation that follows the policy guidelines
above is acceptable.  It would also be worthwhile to read the manual pages
for mkfontdir, update-fonts-alias, and update-fonts-scale.

Comments?

-- 
G. Branden Robinson              |   Q: How does a Unix guru have sex?
Debian GNU/Linux                 |   A: unzip;strip;touch;finger;mount;fsck;
branden@ecn.purdue.edu           |      more;yes;fsck;fsck;fsck;umount;sleep
cartoon.ecn.purdue.edu/~branden/ |
#!/bin/sh
# Debian xfonts-base package post-installation script
# Copyright 1998, 1999 Branden Robinson.  Licensed under the GNU GPL.
# Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava.

set -e

trap "echo ;\
      echo 'Received signal.  Aborting configuration of xfonts-base package.' ;\
      echo ;\
      exit 1" 1 2 3 15

case "$1" in
  configure) ;;
  abort-upgrade|abort-remove|abort-deconfigure)
    exit 0 ;;
  *)
    echo "ERROR: xfonts-base postinst called with unknown argument \"$1\"."
    echo "Aborting configuration of xfonts-base package."
    exit 1 ;;
esac

fontdirs="misc"
updatecmds="/usr/bin/X11/mkfontdir /usr/sbin/update-fonts-alias"

for currentdir in $fontdirs; do
  longdir=/usr/lib/X11/fonts/$currentdir
  if [ -e $longdir ]; then
    if [ -d $longdir ]; then
      for currentcmd in $updatecmds; do
        if [ -e $currentcmd ]; then
          if [ -x $currentcmd ]; then
            shortcmd=$(basename $currentcmd)
            echo -n "Running $shortcmd in $currentdir font directory..."
            $currentcmd $longdir
            echo "done."
          else
            echo "Warning: $currentcmd not executable."
          fi
        else
          echo "Warning: $currentcmd not found."
        fi
      done
    else
      echo "Error: $longdir is not a directory!"
      exit 1
    fi
  else
    echo "Error: $longdir does not exist!"
    exit 1
  fi
done

exit
#!/bin/sh
# Debian xfonts-base package post-removal script
# Copyright 1998, 1999 Branden Robinson.  Licensed under the GNU GPL.
# Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava.

set -e

trap "echo ;\
      echo 'Received signal.  Aborting removal of xfonts-base package.' ;\
      echo ;\
      exit 1" 1 2 3 15

case "$1" in
  remove) ;;
  purge) ;;
  upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) exit 0 ;;
  *) 
    echo "ERROR: xfonts-base postrm called with unknown argument \"$1\"."
    echo "Aborting removal of xfonts-base package."
    exit 1 ;;
esac

fontdirs="misc"
updatecmds="/usr/bin/X11/mkfontdir /usr/sbin/update-fonts-alias"

for currentdir in $fontdirs; do
  longdir=/usr/lib/X11/fonts/$currentdir
  if [ -d $longdir ]; then
    for file in fonts.dir fonts.alias; do
      if [ -e $file ]; then
        rm $file
      fi
    done
    if [ $(find | wc -l) -eq 1 ]; then
      echo "$currentdir font directory is empty.  Removing."
      rmdir $longdir
    else
      for currentcmd in $updatecmds; do
        if [ -e $currentcmd ]; then
          if [ -x $currentcmd ]; then
            shortcmd=$(basename $currentcmd)
            echo -n "Running $shortcmd in $currentdir font directory..."
            $currentcmd $longdir
            echo "done."
          else
            echo "Warning: $currentcmd not executable."
          fi
        else
          echo "Warning: $currentcmd not found."
        fi
      done
    fi
  fi
done

exit
#!/bin/sh
# Debian xfonts-scalable package post-installation script
# Copyright 1998, 1999 Branden Robinson.  Licensed under the GNU GPL.
# Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava.

set -e

trap "echo ;\
      echo 'Received signal.  Aborting configuration of xfonts-scalable package.' ;\
      echo ;\
      exit 1" 1 2 3 15

case "$1" in
  configure) ;;
  abort-upgrade|abort-remove|abort-deconfigure)
    exit 0 ;;
  *)
    echo "ERROR: xfonts-scalable postinst called with unknown argument \"$1\"."
    echo "Aborting configuration of xfonts-scalable package."
    exit 1 ;;
esac

fontdirs="Speedo Type1"
updatecmds="/usr/sbin/update-fonts-scale /usr/bin/X11/mkfontdir"

for currentdir in $fontdirs; do
  longdir=/usr/lib/X11/fonts/$currentdir
  if [ -e $longdir ]; then
    if [ -d $longdir ]; then
      for currentcmd in $updatecmds; do
        if [ -e $currentcmd ]; then
          if [ -x $currentcmd ]; then
            shortcmd=$(basename $currentcmd)
            echo -n "Running $shortcmd in $currentdir font directory..."
            $currentcmd $longdir
            echo "done."
          else
            echo "Warning: $currentcmd not executable."
          fi
        else
          echo "Warning: $currentcmd not found."
        fi
      done
    else
      echo "Error: $longdir is not a directory!"
      exit 1
    fi
  else
    echo "Error: $longdir does not exist!"
    exit 1
  fi
done

exit
#!/bin/sh
# Debian xfonts-scalable package post-removal script
# Copyright 1998, 1999 Branden Robinson.  Licensed under the GNU GPL.
# Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava.

set -e

trap "echo ;\
      echo 'Received signal.  Aborting removal of xfonts-scalable package.' ;\
      echo ;\
      exit 1" 1 2 3 15

case "$1" in
  remove) ;;
  purge) ;;
  upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) exit 0 ;;
  *) 
    echo "ERROR: xfonts-scalable postrm called with unknown argument \"$1\"."
    echo "Aborting removal of xfonts-scalable package."
    exit 1 ;;
esac

fontdirs="Speedo Type1"
updatecmds="/usr/sbin/update-fonts-scale /usr/bin/X11/mkfontdir"

for currentdir in $fontdirs; do
  longdir=/usr/lib/X11/fonts/$currentdir
  if [ -d $longdir ]; then
    for file in fonts.dir fonts.alias; do
      if [ -e $file ]; then
        rm $file
      fi
    done
    if [ $(find | wc -l) -eq 1 ]; then
      echo "$currentdir font directory is empty.  Removing."
      rmdir $longdir
    else
      for currentcmd in $updatecmds; do
        if [ -e $currentcmd ]; then
          if [ -x $currentcmd ]; then
            shortcmd=$(basename $currentcmd)
            echo -n "Running $shortcmd in $currentdir font directory..."
            $currentcmd $longdir
            echo "done."
          else
            echo "Warning: $currentcmd not executable."
          fi
        else
          echo "Warning: $currentcmd not found."
        fi
      done
    fi
  fi
done

exit

Attachment: pgpzDZ4V13bh3.pgp
Description: PGP signature


Reply to: