Skip to content

Commit

Permalink
fixup doc & allow doc parts to be compiled separately
Browse files Browse the repository at this point in the history
  • Loading branch information
wspr committed Nov 5, 2017
1 parent 978aa8c commit 242c74a
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 23 deletions.
6 changes: 6 additions & 0 deletions fontspec-doc-api.tex
@@ -1,5 +1,10 @@
%%^^A%% fontspec-doc-api.tex -- part of FONTSPEC <wspr.io/fontspec>

\documentclass[a4paper]{l3doc}
\usepackage{fontspec-doc-style}
\showexamplesfalse
\begin{document}

\part{Customisation and programming interface}

This is the beginning of some work to provide some hooks that use
Expand Down Expand Up @@ -306,6 +311,7 @@ \subsubsection{Currently selected features}
OpenType language tag |#1|.
\end{macro}

\end{document}


%
Expand Down
4 changes: 2 additions & 2 deletions fontspec-doc-enc.tex
@@ -1,8 +1,8 @@
%%^^A%% fontspec-doc-enc.tex -- part of FONTSPEC <wspr.io/fontspec>

\documentclass[a4paper]{ltxdoc}
\documentclass[a4paper]{l3doc}
\usepackage{fontspec-doc-style}

\showexamplesfalse
\begin{document}

\part{Commands for accents and symbols (`encodings')}
Expand Down
6 changes: 6 additions & 0 deletions fontspec-doc-featset.tex
@@ -1,5 +1,10 @@
%%^^A%% fontspec-doc-featset.tex -- part of FONTSPEC <wspr.io/fontspec>

\documentclass[a4paper]{l3doc}
\usepackage{fontspec-doc-style}
\showexamplesfalse
\begin{document}

\part{Selecting font features}
\label{sec:selectingfeature}

Expand Down Expand Up @@ -593,6 +598,7 @@ \subsection{Letter spacing}
In particular, small amounts of letter spacing can be very useful, when setting small caps or all caps titles.
Also see the OpenType \opt{Uppercase} option of the \feat{Letters} feature (\vref*{sec:letters}).

\end{document}

%
% ------------------------------------------------
Expand Down
7 changes: 6 additions & 1 deletion fontspec-doc-fontsel.tex
@@ -1,5 +1,10 @@
%%^^A%% fontspec-doc-fontsel.tex -- part of FONTSPEC <wspr.io/fontspec>

\documentclass[a4paper]{l3doc}
\usepackage{fontspec-doc-style}
\showexamplesfalse
\begin{document}

\part{General font selection}

This section concerns the variety of commands that can be used to select
Expand Down Expand Up @@ -558,7 +563,7 @@ \section{Miscellaneous font selecting details}
if it were a `naked' control sequence; \eg, `|M. \fontspec{...} N|' and
`|M. \fontspec{...}N|' are the same.


\end{document}

%
% ------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions fontspec-doc-intro.tex
@@ -1,5 +1,10 @@
%%^^A%% fontspec-doc-intro.tex -- part of FONTSPEC <wspr.io/fontspec>

\documentclass[a4paper]{l3doc}
\usepackage{fontspec-doc-style}
\showexamplesfalse
\begin{document}

\part{Getting started}

\section{History}
Expand Down Expand Up @@ -229,6 +234,7 @@ \subsection{Strong emphasis}

An example for setting up a font family for use with \cs{strong} is discussed in \vref{sec:strong-example}.

\end{document}

%
% ------------------------------------------------
Expand Down
8 changes: 6 additions & 2 deletions fontspec-doc-luatex.tex
@@ -1,5 +1,10 @@
%%^^A%% fontspec-doc-luatex.tex -- part of FONTSPEC <wspr.io/fontspec>

\documentclass[a4paper]{l3doc}
\usepackage{fontspec-doc-style}
\showexamplesfalse
\begin{document}

\part{\LuaTeX-only font features}
\label{sec:luatex-features}

Expand Down Expand Up @@ -35,8 +40,7 @@ \section{Custom font features}
\hrule
\end{figure}



\end{document}

%
% ------------------------------------------------
Expand Down
20 changes: 13 additions & 7 deletions fontspec-doc-opentype.tex
@@ -1,5 +1,11 @@
%%^^A%% fontspec-doc-opentype.tex -- part of FONTSPEC <wspr.io/fontspec>


\documentclass[a4paper]{l3doc}
\usepackage{fontspec-doc-style}
\showexamplesfalse
\begin{document}

\part{OpenType}
\label{sec:opentype-features}

Expand Down Expand Up @@ -52,11 +58,11 @@ \subsection{How do I know what font features are supported by my fonts?}
Then open it in your regular \TeX\ editor and change the font name to the font you'd like to query; after running through plain \XeTeX, the output \textsc{pdf} will look something like this:

\begin{framed}
\def\myfontname{[Asana-Math.otf]}
%
%%% OpenType-info.tex %%%

\font\testfont="\myfontname/ICU" at 12pt
%%% From OpenType-info.tex %%%
\DeleteShortVerb\"
\def\myfontname{[Asana-Math.otf]}
\font\testfont="\myfontname/OT" at 10pt\relax

\rightskip=0pt plus 1fil

Expand Down Expand Up @@ -129,8 +135,8 @@ \subsection{How do I know what font features are supported by my fonts?}
\repeat
\end{framed}

\noindent I intentionally picked a font that by design needs few font features; `regular' text fonts such as Latin Modern Roman contain many more, and I didn't want to clutter up the document too much.
You'll then need to cross-check the OpenType feature tags with the `logical' names used by \pkg{fontspec}.
\noindent I intentionally picked a font above that by design contains few font features; `regular' text fonts such as Latin Modern Roman contain many more, and I didn't want to clutter up the document too much.
After finding the scripts, languages, and features contained within the font, you'll then need to cross-check the OpenType tags with the `logical' names used by \pkg{fontspec}.

\paragraph{otfinfo}
Alternatively, and more simply, you can use the command line tool |otfinfo|, which is distributed with \TeX{}Live.
Expand Down Expand Up @@ -1434,7 +1440,7 @@ \subsubsection{\feat{Script} and \feat{Language} examples}
\end{minipage}
\end{table}


\end{document}

%
% ------------------------------------------------
Expand Down
18 changes: 13 additions & 5 deletions fontspec-doc-style.sty
Expand Up @@ -3,6 +3,7 @@
\ProvidesPackage{fontspec-doc-style}

\input{fontspec.dtx}
\ExplSyntaxOff

\usepackage{fontspec,booktabs,calc,caption,color,enumitem,flafter,fancyvrb,hologo,graphicx,
ifthen,url,varioref,varwidth,microtype,tocloft,framed,xparse,docmute}
Expand Down Expand Up @@ -110,6 +111,9 @@

%% EXAMPLES

\newif\ifshowexamples
\showexamplestrue

\newsavebox\X
\newsavebox\Y

Expand All @@ -134,9 +138,11 @@
\def\prefix{#4}
\refstepcounter{example}%
\label{ex:\filename}%
\IfFileExists{zzz-\theexample-\prefix-\filename.tex}{}{%
\immediate\write18{rm -f zzz-\theexample-* ;}%
}%
\ifshowexamples
\IfFileExists{zzz-\theexample-\prefix-\filename.tex}{}{%
\immediate\write18{rm -f zzz-\theexample-* ;}%
}%
\fi
\VerbatimEnvironment
\begin{VerbatimOut}{zzz-\theexample-\prefix-\filename.tex}}
% text in the environment
Expand Down Expand Up @@ -169,12 +175,14 @@
\csname prog@\prefix\endcsname "\unexpanded\expandafter{\XXcmd}";
printf '\@percentchar s' '\unexpanded\expandafter{\XXcmd}' > zzz-\theexample-\prefix-\filename-test.tex;
}%
\immediate\write18{\unexpanded\expandafter{\1}}%
\ifshowexamples
\immediate\write18{\unexpanded\expandafter{\1}}%
\fi
}%
\savebox\Y{%
\IfFileExists{zzz-\theexample-\prefix-\filename.pdf}
{\includegraphics{zzz-\theexample-\prefix-\filename.pdf}}
{\color{red}\itshape ---Graphic not generated---}%
{\color{red}\itshape ---Example graphic not generated---}%
}
% TYPESETTING
\rule[0.5\baselineskip]{\columnwidth}{1pt}%
Expand Down
6 changes: 6 additions & 0 deletions fontspec-doc-xetex.tex
@@ -1,5 +1,10 @@
%%^^A%% fontspec-doc-xetex.tex -- part of FONTSPEC <wspr.io/fontspec>

\documentclass[a4paper]{l3doc}
\usepackage{fontspec-doc-style}
\showexamplesfalse
\begin{document}

\part{Fonts and features with \XeTeX}
\label{sec:xetex-features}

Expand Down Expand Up @@ -347,6 +352,7 @@ \subsection{Annotation}
\opt{Parenthesis}, \opt{Period}, \opt{RomanNumerals}, \opt{Diamond},
\opt{BlackSquare}, \opt{BlackRoundSquare}, and \opt{DoubleCircle}.

\end{document}

%
% ------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion fontspec-lua.dtx
@@ -1,5 +1,5 @@
%%^^A%% fontspec-lua.dtx -- part of FONTSPEC <wspr.io/fontspec>

%
% \section{Lua module}
%
% \begin{macrocode}
Expand Down
9 changes: 6 additions & 3 deletions fontspec.dtx
Expand Up @@ -30,12 +30,15 @@
%<*driver>
\def\tmpa{plain}
\ifx\tmpa\fmtname\expandafter\endinput\fi
\RequirePackage{xparse}
\ProvidesExplFile{fontspec.dtx}
%</driver>
%<fontspec&!xetexx&!luatex>\ProvidesExplPackage{fontspec}%
%<fontspec>\RequirePackage{xparse}
%<fontspec&load>\ProvidesExplPackage{fontspec}%
%<fontspec&xetexx>\ProvidesExplPackage{fontspec-xetex}%
%<fontspec&luatex>\ProvidesExplPackage{fontspec-luatex}%
%<*driver>
\RequirePackage{xparse}
\ProvidesExplFile{fontspec.dtx}
%</driver>
%<*fontspec>
{2017/09/22}{2.6e}{Font selection for XeLaTeX and LuaLaTeX}
%</fontspec>
Expand Down
4 changes: 2 additions & 2 deletions fontspec.ltx
@@ -1,10 +1,10 @@
%%^^A%% fontspec.ltx -- part of FONTSPEC <wspr.io/fontspec>

\ifdefined \XeTeXOTcountscripts \else \makeatletter
\@latex@error{^^J*** The fontspec documentation can only be typeset with XeTeX at present! ***\@gobble}\@ehc
\@latex@error{^^J*** The fontspec documentation can only be typeset with `xelatex` ***\@gobble}\@ehc
\fi

\documentclass[a4paper]{ltxdoc}
\documentclass[a4paper]{l3doc}
\usepackage{fontspec-doc-style}
\begin{document}

Expand Down

0 comments on commit 242c74a

Please sign in to comment.