% Copyright 1993, 1994, 1995, 1996 Alan Jeffrey,
% hacked and maintained 1997, 1998 Sebastian Rahtz,
% copyright 1998, 1999 the fontinst maintenance team and any individual
% authors listed elsewhere in this file.  All rights reserved.
%
% This file is part of the fontinst system version 1.9.
% -----------------------------------------------------
%
% It may be distributed under the terms of the LaTeX Project Public
% License, as described in lppl.txt in the base LaTeX distribution.
% Either version 1.0 or, at your option, any later version.
%
%%% ====================================================================
%%%  @TeX-font-metrics-file{
%%%     author          = "Alan Jeffrey and Ulrik Vieth",
%%%     version         = "1.915",
%%%     date            = "2003-03-29",
%%%     time            = "16:07:18 +01:00",
%%%     filename        = "ltcmds.mtx",
%%%     email           = "fontinst@cogs.susx.ac.uk",
%%%     URL             = "http://www.tug.org/applications/fontinst/",
%%%     checksum        = "",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "metrics, TeX, PostScript",
%%%     supported       = "yes",
%%%     abstract        = "This is a font metrics file, for use with the
%%%                        fontinst utility. It provides the defaults
%%%                        used to install the Latin glyphs.",
%%%     package         = "fontinst",
%%%     dependencies    = "fontinst.sty, fontdoc.sty",
%%%  }
%%% ====================================================================

\relax

\documentclass[twocolumn]{article}
\usepackage{fontdoc}[1999/11/04]

\title{The file \texttt{ltcmds.mtx}}
\author{Alan Jeffrey\and Ulrik Vieth\and Lars Hellstr\"om}
\date{20 October 2000\\Version 1.915}

\showbranches

\begin{document}
\maketitle

\metrics

\needsfontinstversion{1.917}
\ProvidesMtxPackage{ltcmds}

\begincomment
\section{Some commands for making latin glyphs}

\endcomment

% \unfakable is a glyph which can't be faked.
\setcommand\unfakable#1{
   \setglyph{#1}
      \glyphrule{\int{xheight}}{\int{xheight}}
      \glyphwarning{missing glyph `#1'}
   \endsetglyph
}
\begincomment\medskip
An \textbf{Unfakable} is a glyph which can't be faked. An 
``\textbf{Unfakable `\#1'}\,'' is equivalent to
\begin{quotation}\unfakable{\macroparameter{1}}\end{quotation}

\resetcommand\unfakable#1{%
   \Aheading{Unfakable `\TypesetStringExpression{#1}'}%
}
\endcomment


\setcommand\topaccent#1#2#3{
   \push
      \moveup{\max{0}{\sub{\height{#1}}{\int{xheight}}}}
      \movert{\add{\sub{\scale{\width{#1}}{#3}}{\half{\width{#2}}}}
         {\scale{\sub{\height{#1}}{\int{xheight}}}{\int{italicslant}}}}
      \glyph{#2}{1000}
   \pop
   \glyph{#1}{1000}
}
\begincomment\medskip
A \textbf{Top accent} is built by placing the center of the accent at 
the given position along the width of the letter, raised up by the 
difference between the height of the letter and the xheight. This is 
the algorithm used by the \TeX\ \verb|\accent| primitive. 
A ``\textbf{Top accent} `\#1' with `\#2' at \#3'' is equivalent to
\begin{quotation}
  \topaccent{\macroparameter{1}}{\macroparameter{2}}{\macroparameter{3}}
\end{quotation}
\resetcommand\topaccent#1#2#3{%
   \Bheading{Top accent} `\TypesetStringExpression{#1}' with 
   `\TypesetStringExpression{#2}' at $\TypesetIntegerExpression{#3}$%
}
\endcomment


\setcommand\topaccentas#1#2#3#4{
   \push
      \moveup{\sub{\height{#4}}{\height{#2}}}
      \movert{\add{
         \sub{\scale{\width{#1}}{#3}}{\half{\width{#2}}}
      }{
         \scale{\sub{\height{#4}}{\height{#2}}}{\int{italicslant}}
      }}
      \glyph{#2}{1000}
   \pop
   \glyph{#1}{1000}
}
\begincomment\medskip
A \textbf{Top accent \dots\ as} is built by placing the center of the 
accent at the given position along the width of the letter, raised up 
by the difference between the height of the accent and the height of 
the model glyph. A ``\textbf{Top accent} `\#1' with `\#2' at \#3 as 
\#4'' is equivalent to
\begin{quotation}
  \topaccentas{\macroparameter{1}}{\macroparameter{2}}
    {\macroparameter{3}}{\macroparameter{4}}
\end{quotation}
\resetcommand\topaccentas#1#2#3#4{%
   \Bheading{Top accent} `\TypesetStringExpression{#1}' with 
   `\TypesetStringExpression{#2}' at $\TypesetIntegerExpression{#3}$ 
   as `\TypesetStringExpression{#4}'%
}
\endcomment


\setcommand\botaccent#1#2#3{
   \push
      \movert{\sub{\scale{\width{#1}}{#3}}{\half{\width{#2}}}}
      \glyph{#2}{1000}
   \pop
   \glyph{#1}{1000}
}
\begincomment\medskip
A \textbf{Bottom accent} is built by placing the center of the accent at 
the given position along the width of the letter. A ``\textbf{Bottom 
accent} `\#1' with `\#2' at \#3'' is equivalent to
\begin{quotation}
   \botaccent{\macroparameter{1}}{\macroparameter{2}}{\macroparameter{3}}
\end{quotation}
\resetcommand\botaccent#1#2#3{%
   \Bheading{Bottom accent} `\TypesetStringExpression{#1}' with 
   `\TypesetStringExpression{#2}' at $\TypesetIntegerExpression{#3}$%
}
\endcomment


\setcommand\unfakabletopaccent#1{
   \setglyph{#1}
      \moveup{\add{\int{xheight}}{50}}
      \glyphrule{\half{\int{xheight}}}{\half{\int{xheight}}}
      \glyphwarning{missing glyph `#1'}
      \moveup{\neg{\add{\int{xheight}}{50}}}
   \endsetglyph
}
\begincomment\medskip
An \textbf{Unfakable top accent} is the same as an 
\textbf{Unfakable}, except that the rule is smaller and has a more 
accent-like position. An ``\textbf{Unfakable top accent `\#1'}\,'' 
is equivalent to
\begin{quotation}\unfakabletopaccent{\macroparameter{1}}\end{quotation}

\resetcommand\unfakabletopaccent#1{%
   \Aheading{Unfakable top accent `\TypesetStringExpression{#1}'}%
}
\endcomment



% A c&sc top accent glyph is placed using the small glyphs if
% available, and otherwise by shrinking the equivalent capital.

\setcommand\csctopaccent#1#2#3{
%    \ifareglyphs{#1small,#2small}\then
%       \topaccent{#1small}{#2small}{#3}
%    \Else
      \cscglyph{#1#2}
%    \Fi
}

% A c&sc bot accent glyph is placed using the small glyphs if
% available, and otherwise by shrinking the equivalent capital.

\setcommand\cscbotaccent#1#2#3{
%    \ifisglyph{#1small}\then
%       \botaccent{#1small}{#2small}{#3}
%    \Else
      \cscglyph{#1#2}
%    \Fi
}

% A c&sc accent is created by moving a shrunk accent up by the
% difference between a scaled x and a scaled X.

\setcommand\cscaccent#1{
   \moveup{\scale{\int{xheight}}{\sub{1000}{\int{smallcapsscale}}}}
   \cscglyph{#1}
   \moveup{\scale{\int{xheight}}{\sub{\int{smallcapsscale}}{1000}}}
}


\begincomment
\section{Default values}
\endcomment

\setint{italicslant}{0}

\ifisglyph{x}\then
   \setint{xheight}{\height{x}}
\Else
   \setint{xheight}{500}
\Fi

\ifisglyph{A}\then
   \setint{capheight}{\height{A}}
   \comment{\texttt{t1.etx} has traditionally measured the capheight 
     on \texttt{X}, whereas \texttt{latin.mtx} measured it on 
     \texttt{A}. There is probably no good reason for this 
     difference.}
\Else\ifisglyph{X}\then
   \setint{capheight}{\height{X}}
\Else
   \setint{capheight}{750}
\Fi\Fi

\ifisglyph{d}\then
   \setint{ascender}{\height{d}}
\Else
   \setint{ascender}{\int{capheight}}
\Fi

\ifisint{descender_neg}\then
   \setint{descender}{\neg{\int{descender_neg}}}
\Else\ifisglyph{g}\then
   \setint{descender}{\depth{g}}
   \comment{Similarly, \texttt{t1.etx} has traditionally measured 
     the descender depth on \texttt{p}, whereas \texttt{latin.mtx} 
     measured it on \texttt{g}.}
\Else\ifisglyph{p}\then
   \setint{descender}{\depth{p}}
\Else
   \setint{descender}{250}
\Fi\Fi\Fi

\setint{underlinethickness}{40}
\setint{visiblespacedepth}{200}
\setint{visiblespacewidth}{400}
\setint{visiblespacesurround}{50}


\ifisglyph{parenleft}\then
   \setint{vaxis}{\half{\sub{\height{parenleft}}{\depth{parenleft}}}}
\Else
   \setint{vaxis}{\half{\int{xheight}}}
\Fi


\endmetrics





\section{Changes}

1999/10/25: Added \verb|\setglyphs| for \texttt{Macronsmall} and
\texttt{macronsmall}. (LH)

1999/10/25: Simplified definition of \verb|\unfakable|. (UV\&LH)
Rationale: It is thoroughly confusing if the size of the black box
created by \verb|\unfakable| depends on the metrics of an unencoded
glyph that isn't accessible and therefore unavailable for all pratical
purposes.

2000/10/20--2003/03/15: File split off from \texttt{latin.mtx} and 
reorganised into a separate package. (LH) (It took until the last of 
these dates before all the useless code had been removed.) Also made 
special typeset definitions of many commands and modernized the 
conditionals.

2003/03/15: Made the \verb|\unfakable| a square with side 
$\TypesetIntegerExpression{\int{xheight}}$ and added the 
\verb|\unfakabletopaccent| command. (LH) Rationale: That the glyph is 
unavailable doesn't mean the rule replacing it has to look bad. This 
should make them blend in better with any glyphs that are actually 
available.

2003/03/15: Added \verb|\topaccentas|. (LH) It is based on a command 
|\idotaccent| defined by Walter Schmidt.

2003/03/15: Added calculation of a vertical symmetry axis position 
$\TypesetIntegerExpression{\int{vaxis}}$. (LH) It is based on some 
code by Walter Schmidt.

2004/08/07: Fixed typo in vertical symmetry axis code. (LH)

2005/05/21: Moved default for 
$\TypesetIntegerExpression{\int{capspacing}}$ to \texttt{lubuild.mtx}, 
which is where it is used. (LH)

\end{document}