[XeTeX] The XeTeX reference guide

Will Robertson wspr81 at gmail.com
Mon Jun 12 16:43:20 CEST 2006


Dear all,

Please find attached the beginnings of a document that I spent a  
little while on this evening. It's incomplete (no doubt!) and terse  
(somewhat intended), but I think you'll get the point. Volunteers and  
comments are welcome!

Will

-------------

%!TEX TS-program = xelatex

\documentclass[12pt]{article}

\usepackage{fontspec,xltxtra,xunicode}
\usepackage{enumitem,fancyvrb,geometry}
\setlist{nolistsep}
%\geometry{screen,margin=3cm}

\defaultfontfeatures{Mapping=tex-text}
\setromanfont{Palatino}

\title{The \XeTeX\ reference guide}
\author{Will Robertson}

\newcommand\cmd{%
   \vspace{2ex plus 5pt minus 5pt}
   \noindent
   \SaveVerb[%
     aftersave={%
       \begin{minipage}{\linewidth}
         \UseVerb{CMD}}]{CMD}}
\DefineShortVerb{\|}
\newcommand\xarg[1]{‹\textit{#1}›}
\newcommand\desc[1]{\par#1}
\def\endcmd{\end{minipage}}

\newsavebox\verbatimbox
\edef\examplefilename{\jobname.example}

\newenvironment{example}[1][]
   {\def\xxt at ex@options{#1}
    \VerbatimEnvironment
    \begingroup
    \begin{VerbatimOut}[gobble=4]{\examplefilename}}
   {\end{VerbatimOut}
    \defaultfontfeatures{Mapping=tex-text,Colour=228833}%
    \typesetexample
    \endgroup}

\newcommand\typesetexample{%
    \begin{lrbox}{\verbatimbox}%
      \BVerbatimInput[fontsize=\small,\xxt at ex@options] 
{\examplefilename}\relax
    \end{lrbox}
    \begin{list}{}{\setlength\itemindent{0pt}
                   \setlength\leftmargin\exoutdent
                   \setlength\rightmargin{0pt}}\item
    \begin{minipage}{\linewidth}
      \centering\input\examplefilename\relax
    \end{minipage}
    \fbox{\begin{minipage}{\linewidth}
      \usebox\verbatimbox
    \end{minipage}}
    \end{list}}


\raggedbottom
\begin{document}
\maketitle
\tableofcontents

\section{Introduction}
This document serves to summarise \XeTeX's additional features  
without being so much as a `users' guide'.

\section{Misc.}

\cmd|\XeTeXversion|
\desc{A number corresponding to the \XeTeX\ version.}
\endcmd

\cmd|\XeTeXrevision|
\desc{A string corresponding to the \XeTeX\ revision number.}
\endcmd

\section{Font commands}

\cmd|\XeTeXuseglyphmetrics|
\xarg{Integer}
\desc{Boolean to specify if the height and depth of characters are  
taken into account. (Slower, gives better output; on, 1, by default.)}
\endcmd

\cmd|\XeTeXglyph|
\xarg{Glyph slot}
\desc{Inserts the glyph in \xarg{slot} of the current font.}
\endcmd

\cmd|\XeTeXglyphindex|
\xarg{Glyph name}
\desc{Returns the \xarg{glyph slot} corresponding to the \xarg{glyph  
name} in the currently selected font.}
\endcmd

\cmd|\XeTeXcharglyph|
\xarg{Char code}
\desc{Returns the default glyph number of character \xarg{Char code}  
in the current font, or 0 if the character is not available in the  
font.}
\endcmd

\cmd|\XeTeXfonttype|
\xarg{font}
\desc{
   Returns what type of font the \xarg{font} is:
   \begin{description}
     \item [0] for a TFM-based font;
     \item [1] for an AAT font;
     \item [2] for an OpenType font.
   \end{description}
}
\endcmd

\subsection{OpenType fonts}

\cmd|\XeTeXOTcountscripts|
\xarg{Font}
\desc{Returns the number of scripts in a font.}
\endcmd

\cmd|\XeTeXOTscripttag|
\xarg{Font}
\xarg{Integer, $n$}
\desc{Returns the $n$-th script tag of a font.}
\endcmd

\cmd|\XeTeXOTcountlanguages|
\xarg{Font}
\xarg{Script tag}
\desc{Returns the number of languages in the script of a font.}
\endcmd

\cmd|\XeTeXOTlanguagetag|
\xarg{Font}
\xarg{Script tag}
\xarg{Integer, $n$}
\desc{Returns the $n$-th language tag in the script of a font.}
\endcmd

\cmd|\XeTeXOTcountfeatures|
\xarg{Font}
\xarg{Script tag}
\xarg{Language tag}
\desc{Returns the number of features in the language of a script of a  
font.}
\endcmd

\cmd|\XeTeXOTfeaturetag|
\xarg{Font}
\xarg{Script tag}
\xarg{Language tag}
\xarg{Integer, $n$}
\desc{Returns the $n$-th feature tag in the language of a script of a  
font.}
\endcmd


\subsection{AAT fonts}

\subsubsection{Features}

\cmd|\XeTeXcountfeatures|
\xarg{font}
\desc{Returns the number of features in the \xarg{font}.}
\endcmd

\cmd|\XeTeXfeaturecode|
\xarg{font}
\xarg{integer, $n$}
\desc{Returns the feature code for the $n$-th feature in the \xarg 
{font}.}
\endcmd

\cmd|\XeTeXfeaturename|
\xarg{font}
\xarg{feature code}
\desc{Returns the name corresponding to the \xarg{feature code} in  
the \xarg{font}.}
\endcmd

\cmd|\XeTeXisexclusivefeature|
\xarg{font}
\xarg{feature code}
\desc{Returns greater than zero if the feature of a font is exclusive  
(can only take a single selector).}
\endcmd

\subsubsection{Feature selectors}

\cmd|\XeTeXcountselectors|
\xarg{font}
\xarg{feature}
\desc{Returns the number of selectors in a \xarg{feature} of a \xarg 
{font}.}
\endcmd

\cmd|\XeTeXselectorcode|
\xarg{font}
\xarg{feature code}
\xarg{integer, $n$}
\desc{Returns the selector code for the $n$-th selector in a \xarg 
{feature} of a \xarg{font}.}
\endcmd

\cmd|\XeTeXselectorname|
\xarg{font}
\xarg{feature code}
\xarg{selector code}
\desc{Returns the name corresponding to the \xarg{selector code} of a  
feature of a \xarg{font}.}
\endcmd

\cmd|\XeTeXisdefaultselector|
\xarg{font}
\xarg{feature code}
\xarg{selector code}
\desc{Returns greater than zero if the selector of a feature of a  
font is on by default.}
\endcmd

\subsubsection{Variation axes}

\cmd|\XeTeXcountvariations|
\xarg{font}
\desc{Returns the number of variation axes in the \xarg{font}.}
\endcmd

\cmd|\XeTeXvariation|
\xarg{font}
\xarg{integer, $n$}
\desc{Returns the variation code for the $n$-th feature in the \xarg 
{font}.}
\endcmd

\cmd|\XeTeXvariationname|
\xarg{font}
\xarg{variation code}
\desc{Returns the name corresponding to the \xarg{feature code} in  
the \xarg{font}.}
\endcmd

\cmd|\XeTeXvariationmin|
\xarg{font}
\xarg{variation code}
\desc{Returns the minimum value of the variation corresponding to the  
\xarg{variation code} in the \xarg{font}.}
\endcmd

\cmd|\XeTeXvariationmax|
\xarg{font}
\xarg{variation code}
\desc{Returns the maximum value of the variation corresponding to the  
\xarg{variation code} in the \xarg{font}.}
\endcmd

\cmd|\XeTeXvariationdefault|
\xarg{font}
\xarg{variation code}
\desc{Returns the default value of the variation corresponding to the  
\xarg{variation code} in the \xarg{font}.}
\endcmd

\section{Encodings}

\cmd|\XeTeXinputencoding|
\xarg{Charset name}
\desc{Defines the input encoding of the following text.}
\endcmd

\cmd|\XeTeXdefaultencoding|
\xarg{Charset name}
\desc{Defines the input encoding of subsequent files to be read.}
\endcmd

\section{Line breaking}

\cmd|\XeTeXdashbreakstate|
\xarg{Integer}
\desc{Specify whether line breaks after en- and em-dashes are  
allowed. On, 1, by default.}
\endcmd

\cmd|\XeTeXlinebreaklocale|
\xarg{Locale ID}
\desc{Defines how to break lines for multilingual text.}
\endcmd

\cmd|\XeTeXlinebreakskip|
\xarg{Glue}
\desc{Inter-character linebreak stretch}
\endcmd

\cmd|\XeTeXlinebreakpenalty|
\xarg{Integer}
\desc{Inter-character linebreak penalty}
\endcmd

\cmd|\XeTeXupwardsmode|
\xarg{Integer}
\desc{If positive, successive lines of text (and rules, boxes, etc.)  
will be stacked upwards instead of downwards.}
\endcmd

\section{Graphics}

\cmd|\XeTeXpicfile|
\xarg{filename}
\xarg{optional options}
\desc{Insert an image.}
\endcmd

\cmd|\XeTeXpdffile|
\xarg{filename}
\xarg{optional options}
\desc{Insert (pages of) a PDF.}
\endcmd

\cmd|\pdfpageheight|
\xarg{Number}
\desc{The height of the PDF page}
\endcmd

\cmd|\pdfpagewidth|
\xarg{Number}
\desc{The width of the PDF page}
\endcmd

\cmd|\pdfsavepos|
\desc{Saves the current location of the page in the typesetting stream.}
\endcmd

\cmd|\pdflastxpos|
\desc{Retrieves the horizontal position saved by the above.}
\endcmd

\cmd|\pdflastypos|
\desc{Retrieves the vertical position saved by the above.}
\endcmd

\end{document}


More information about the XeTeX mailing list