From 242c74ad703470c5751400b98f510bf1bbbcbf59 Mon Sep 17 00:00:00 2001 From: Will Robertson Date: Sun, 5 Nov 2017 14:40:46 +1030 Subject: [PATCH] fixup doc & allow doc parts to be compiled separately --- fontspec-doc-api.tex | 6 ++++++ fontspec-doc-enc.tex | 4 ++-- fontspec-doc-featset.tex | 6 ++++++ fontspec-doc-fontsel.tex | 7 ++++++- fontspec-doc-intro.tex | 6 ++++++ fontspec-doc-luatex.tex | 8 ++++++-- fontspec-doc-opentype.tex | 20 +++++++++++++------- fontspec-doc-style.sty | 18 +++++++++++++----- fontspec-doc-xetex.tex | 6 ++++++ fontspec-lua.dtx | 2 +- fontspec.dtx | 9 ++++++--- fontspec.ltx | 4 ++-- 12 files changed, 73 insertions(+), 23 deletions(-) diff --git a/fontspec-doc-api.tex b/fontspec-doc-api.tex index ef36f36d..ffbe56d6 100644 --- a/fontspec-doc-api.tex +++ b/fontspec-doc-api.tex @@ -1,5 +1,10 @@ %%^^A%% fontspec-doc-api.tex -- part of 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 @@ -306,6 +311,7 @@ \subsubsection{Currently selected features} OpenType language tag |#1|. \end{macro} +\end{document} % /© diff --git a/fontspec-doc-enc.tex b/fontspec-doc-enc.tex index 96e2e054..61126c22 100644 --- a/fontspec-doc-enc.tex +++ b/fontspec-doc-enc.tex @@ -1,8 +1,8 @@ %%^^A%% fontspec-doc-enc.tex -- part of FONTSPEC -\documentclass[a4paper]{ltxdoc} +\documentclass[a4paper]{l3doc} \usepackage{fontspec-doc-style} - +\showexamplesfalse \begin{document} \part{Commands for accents and symbols (`encodings')} diff --git a/fontspec-doc-featset.tex b/fontspec-doc-featset.tex index 4c5e0e40..f37f982c 100644 --- a/fontspec-doc-featset.tex +++ b/fontspec-doc-featset.tex @@ -1,5 +1,10 @@ %%^^A%% fontspec-doc-featset.tex -- part of FONTSPEC +\documentclass[a4paper]{l3doc} +\usepackage{fontspec-doc-style} +\showexamplesfalse +\begin{document} + \part{Selecting font features} \label{sec:selectingfeature} @@ -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} % /© % ------------------------------------------------ diff --git a/fontspec-doc-fontsel.tex b/fontspec-doc-fontsel.tex index e0ce30f8..7f374337 100644 --- a/fontspec-doc-fontsel.tex +++ b/fontspec-doc-fontsel.tex @@ -1,5 +1,10 @@ %%^^A%% fontspec-doc-fontsel.tex -- part of 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 @@ -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} % /© % ------------------------------------------------ diff --git a/fontspec-doc-intro.tex b/fontspec-doc-intro.tex index 8210bfec..6bc3fc8b 100644 --- a/fontspec-doc-intro.tex +++ b/fontspec-doc-intro.tex @@ -1,5 +1,10 @@ %%^^A%% fontspec-doc-intro.tex -- part of FONTSPEC +\documentclass[a4paper]{l3doc} +\usepackage{fontspec-doc-style} +\showexamplesfalse +\begin{document} + \part{Getting started} \section{History} @@ -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} % /© % ------------------------------------------------ diff --git a/fontspec-doc-luatex.tex b/fontspec-doc-luatex.tex index df2a6609..140e4d9a 100644 --- a/fontspec-doc-luatex.tex +++ b/fontspec-doc-luatex.tex @@ -1,5 +1,10 @@ %%^^A%% fontspec-doc-luatex.tex -- part of FONTSPEC +\documentclass[a4paper]{l3doc} +\usepackage{fontspec-doc-style} +\showexamplesfalse +\begin{document} + \part{\LuaTeX-only font features} \label{sec:luatex-features} @@ -35,8 +40,7 @@ \section{Custom font features} \hrule \end{figure} - - +\end{document} % /© % ------------------------------------------------ diff --git a/fontspec-doc-opentype.tex b/fontspec-doc-opentype.tex index edee8676..76af34f2 100644 --- a/fontspec-doc-opentype.tex +++ b/fontspec-doc-opentype.tex @@ -1,5 +1,11 @@ %%^^A%% fontspec-doc-opentype.tex -- part of FONTSPEC + +\documentclass[a4paper]{l3doc} +\usepackage{fontspec-doc-style} +\showexamplesfalse +\begin{document} + \part{OpenType} \label{sec:opentype-features} @@ -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 @@ -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. @@ -1434,7 +1440,7 @@ \subsubsection{\feat{Script} and \feat{Language} examples} \end{minipage} \end{table} - +\end{document} % /© % ------------------------------------------------ diff --git a/fontspec-doc-style.sty b/fontspec-doc-style.sty index 52321287..f5030a2b 100644 --- a/fontspec-doc-style.sty +++ b/fontspec-doc-style.sty @@ -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} @@ -110,6 +111,9 @@ %% EXAMPLES +\newif\ifshowexamples +\showexamplestrue + \newsavebox\X \newsavebox\Y @@ -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 @@ -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}% diff --git a/fontspec-doc-xetex.tex b/fontspec-doc-xetex.tex index 80336dc6..dfa484b9 100644 --- a/fontspec-doc-xetex.tex +++ b/fontspec-doc-xetex.tex @@ -1,5 +1,10 @@ %%^^A%% fontspec-doc-xetex.tex -- part of FONTSPEC +\documentclass[a4paper]{l3doc} +\usepackage{fontspec-doc-style} +\showexamplesfalse +\begin{document} + \part{Fonts and features with \XeTeX} \label{sec:xetex-features} @@ -347,6 +352,7 @@ \subsection{Annotation} \opt{Parenthesis}, \opt{Period}, \opt{RomanNumerals}, \opt{Diamond}, \opt{BlackSquare}, \opt{BlackRoundSquare}, and \opt{DoubleCircle}. +\end{document} % /© % ------------------------------------------------ diff --git a/fontspec-lua.dtx b/fontspec-lua.dtx index bf9d67d3..162c0a4a 100644 --- a/fontspec-lua.dtx +++ b/fontspec-lua.dtx @@ -1,5 +1,5 @@ %%^^A%% fontspec-lua.dtx -- part of FONTSPEC - +% % \section{Lua module} % % \begin{macrocode} diff --git a/fontspec.dtx b/fontspec.dtx index c096d571..3b5fe747 100644 --- a/fontspec.dtx +++ b/fontspec.dtx @@ -30,12 +30,15 @@ %<*driver> \def\tmpa{plain} \ifx\tmpa\fmtname\expandafter\endinput\fi -\RequirePackage{xparse} -\ProvidesExplFile{fontspec.dtx} % -%\ProvidesExplPackage{fontspec}% +%\RequirePackage{xparse} +%\ProvidesExplPackage{fontspec}% %\ProvidesExplPackage{fontspec-xetex}% %\ProvidesExplPackage{fontspec-luatex}% +%<*driver> +\RequirePackage{xparse} +\ProvidesExplFile{fontspec.dtx} +% %<*fontspec> {2017/09/22}{2.6e}{Font selection for XeLaTeX and LuaLaTeX} % diff --git a/fontspec.ltx b/fontspec.ltx index 9afad90e..c1eeeecd 100644 --- a/fontspec.ltx +++ b/fontspec.ltx @@ -1,10 +1,10 @@ %%^^A%% fontspec.ltx -- part of 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}