summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-09-22 22:54:18 +0000
committerKarl Berry <karl@freefriends.org>2017-09-22 22:54:18 +0000
commitd51add942fa9edcf2de40adbb7ce915bcba38768 (patch)
tree3bde82167b1510ffd8fa01ba5b030161e15fbc44 /Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx
parent95a2badc031cd53b7456fbda90afd45806639e62 (diff)
fontspec (22sep17)
git-svn-id: svn://tug.org/texlive/trunk@45381 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx')
-rw-r--r--Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx266
1 files changed, 63 insertions, 203 deletions
diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx
index 6ba11f53a0d..8ab76d375ed 100644
--- a/Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx
+++ b/Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx
@@ -1,9 +1,5 @@
-% \section{User commands}\label{sec:codeuser}
-%
-% This section contains the definitions of the commands detailed in
-% the user documentation. Only the `top level' definitions of the
-% commands are contained herein; they all use or define macros which
-% are defined or used later on in \vref{sec:codeinternal}.
+% \section{User command internals}
+% \label{sec:codeinternal}
%
% \iffalse
% \begin{macrocode}
@@ -11,23 +7,17 @@
% \end{macrocode}
% \fi
%
-% \subsubsection{Font selection}
+%
+% \subsection{Font selection}
% \begin{macro}{\fontspec}
% This is the main command of the package that
% selects fonts with various features. It takes two arguments: the
% font name and the optional requested features of that
% font. Then this new font family is selected.
% \begin{macrocode}
-\NewDocumentCommand \fontspec { O{} m O{} }
- {
- \@@_main_fontspec:nnn {#1} {#2} {#3}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_set:Nn \@@_main_fontspec:nnn
+\cs_set:Nn \@@_main_fontspec:nn
{
- \fontspec_set_family:Nnn \f@family {#1,#3} {#2}
+ \fontspec_set_family:Nnn \f@family {#1} {#2}
\fontencoding { \l_@@_nfss_enc_tl }
\selectfont
\ignorespaces
@@ -42,16 +32,9 @@
% (monospaced). I end them with |\normalfont| so that if they're
% used in the document, the change registers immediately.
% \begin{macrocode}
-\DeclareDocumentCommand \setmainfont { O{} m O{} }
- {
- \@@_main_setmainfont:nnn {#1} {#2} {#3}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_set:Nn \@@_main_setmainfont:nnn
+\cs_set:Nn \@@_main_setmainfont:nn
{
- \fontspec_set_family:Nnn \g_@@_rmfamily_family {#1,#3} {#2}
+ \fontspec_set_family:Nnn \g_@@_rmfamily_family {#1} {#2}
\tl_set_eq:NN \rmdefault \g_@@_rmfamily_family
\use:x { \exp_not:n { \DeclareRobustCommand \rmfamily }
{
@@ -62,6 +45,7 @@
}
\str_if_eq_x:nnT {\familydefault} {\rmdefault}
{ \tl_set_eq:NN \encodingdefault \l_@@_nfss_enc_tl }
+ \@@_setmainfont_hook:nn {#1} {#2}
\normalfont
\ignorespaces
}
@@ -70,16 +54,9 @@
%
% \begin{macro}{\setsansfont}
% \begin{macrocode}
-\DeclareDocumentCommand \setsansfont { O{} m O{} }
- {
- \@@_main_setsansfont:nnn {#1} {#2} {#3}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_set:Nn \@@_main_setsansfont:nnn
+\cs_set:Nn \@@_main_setsansfont:nn
{
- \fontspec_set_family:Nnn \g_@@_sffamily_family {#1,#3} {#2}
+ \fontspec_set_family:Nnn \g_@@_sffamily_family {#1} {#2}
\tl_set_eq:NN \sfdefault \g_@@_sffamily_family
\use:x { \exp_not:n { \DeclareRobustCommand \sffamily }
{
@@ -90,6 +67,7 @@
}
\str_if_eq_x:nnT {\familydefault} {\sfdefault}
{ \tl_set_eq:NN \encodingdefault \l_@@_nfss_enc_tl }
+ \@@_setsansfont_hook:nn {#1} {#2}
\normalfont
\ignorespaces
}
@@ -98,16 +76,9 @@
%
% \begin{macro}{\setmonofont}
% \begin{macrocode}
-\DeclareDocumentCommand \setmonofont { O{} m O{} }
- {
- \@@_main_setmonofont:nnn {#1} {#2} {#3}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_set:Nn \@@_main_setmonofont:nnn
+\cs_set:Nn \@@_main_setmonofont:nn
{
- \fontspec_set_family:Nnn \g_@@_ttfamily_family {#1,#3} {#2}
+ \fontspec_set_family:Nnn \g_@@_ttfamily_family {#1} {#2}
\tl_set_eq:NN \ttdefault \g_@@_ttfamily_family
\use:x { \exp_not:n { \DeclareRobustCommand \ttfamily }
{
@@ -118,6 +89,7 @@
}
\str_if_eq_x:nnT {\familydefault} {\ttdefault}
{ \tl_set_eq:NN \encodingdefault \l_@@_nfss_enc_tl }
+ \@@_setmonofont_hook:nn {#1} {#2}
\normalfont
\ignorespaces
}
@@ -125,89 +97,76 @@
% \end{macro}
%
%
-% \begin{macro}{\setromanfont}
-% This is the old name for \cs{setmainfont}, retained \emph{ad infinitum}
-% for backwards compatibility. It was deprecated in 2010.
-% \begin{macrocode}
-\DeclareDocumentCommand \setromanfont { O{} m O{} }
- {
- \@@_main_setmainfont:nnn {#1} {#2} {#3}
- }
-% \end{macrocode}
-% \end{macro}
%
%
% \begin{macro}{\setmathrm}
-% \begin{macro}{\setmathsf}
-% \begin{macro}{\setboldmathrm}
-% \begin{macro}{\setmathtt}
% These commands are analogous to \cmd\setmainfont\ and others,
% but for selecting the font used for \cmd\mathrm, \etc. They
% can only be used in the preamble of the
% document. \cmd\setboldmathrm\ is used for specifying which
% fonts should be used in \cmd\boldmath.
% \begin{macrocode}
-\DeclareDocumentCommand \setmathrm { O{} m O{} }
+\cs_set:Nn \@@_main_setmathrm:nn
{
- \@@_main_setmathrm:nnn {#1} {#2} {#3}
+%<XE> \fontspec_set_family:Nnn \g_@@_mathrm_tl {#1} {#2}
+%<LU> \fontspec_set_family:Nnn \g_@@_mathrm_tl {Renderer=Basic,#1} {#2}
+ \@@_setmathrm_hook:nn {#1} {#2}
}
% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{\setboldmathrm}
% \begin{macrocode}
-\cs_set:Nn \@@_main_setmathrm:nnn
- {
- \fontspec_set_family:Nnn \g_@@_mathrm_tl {#1} {#2}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\DeclareDocumentCommand \setboldmathrm { O{} m O{} }
+\cs_set:Nn \@@_main_setboldmathrm:nn
{
- \@@_main_setboldmathrm:nnn {#1} {#2} {#3}
+%<XE> \fontspec_set_family:Nnn \g_@@_bfmathrm_tl {#1} {#2}
+%<LU> \fontspec_set_family:Nnn \g_@@_bfmathrm_tl {Renderer=Basic,#1} {#2}
+ \@@_setboldmathrm_hook:nn {#1} {#2}
}
% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{\setmathsf}
% \begin{macrocode}
-\cs_set:Nn \@@_main_setboldmathrm:nnn
- {
- \fontspec_set_family:Nnn \g_@@_bfmathrm_tl {#1} {#2}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\DeclareDocumentCommand \setmathsf { O{} m O{} }
+\cs_set:Nn \@@_main_setmathsf:nn
{
- \@@_main_setmathsf:nnn {#1} {#2} {#3}
+%<XE> \fontspec_set_family:Nnn \g_@@_mathsf_tl {#1} {#2}
+%<LU> \fontspec_set_family:Nnn \g_@@_mathsf_tl {Renderer=Basic,#1} {#2}
+ \@@_setmathsf_hook:nn {#1} {#2}
}
% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{\setmathtt}
% \begin{macrocode}
-\cs_set:Nn \@@_main_setmathsf:nnn
- {
- \fontspec_set_family:Nnn \g_@@_mathsf_tl {#1} {#2}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\DeclareDocumentCommand \setmathtt { O{} m O{} }
+\cs_set:Nn \@@_main_setmathtt:nn
{
- \@@_main_setmathtt:nnn {#1} {#2} {#3}
+%<XE> \fontspec_set_family:Nnn \g_@@_mathtt_tl {#1} {#2}
+%<LU> \fontspec_set_family:Nnn \g_@@_mathtt_tl {Renderer=Basic,#1} {#2}
+ \@@_setmathtt_hook:nn {#1} {#2}
}
% \end{macrocode}
+% \end{macro}
%
+% Hooks:
% \begin{macrocode}
-\cs_set:Nn \@@_main_setmathtt:nnn
- {
- \fontspec_set_family:Nnn \g_@@_mathtt_tl {#1} {#2}
- }
+\cs_set_eq:NN \@@_setmainfont_hook:nn \use_none:nn
+\cs_set_eq:NN \@@_setsansfont_hook:nn \use_none:nn
+\cs_set_eq:NN \@@_setmonofont_hook:nn \use_none:nn
+\cs_set_eq:NN \@@_setmathrm_hook:nn \use_none:nn
+\cs_set_eq:NN \@@_setmathsf_hook:nn \use_none:nn
+\cs_set_eq:NN \@@_setmathtt_hook:nn \use_none:nn
+\cs_set_eq:NN \@@_setboldmathrm_hook:nn \use_none:nn
% \end{macrocode}
%
+% Hmm, this isn't necessary with \pkg{unicode-math}; oh well:
% \begin{macrocode}
\@onlypreamble\setmathrm
\@onlypreamble\setboldmathrm
\@onlypreamble\setmathsf
\@onlypreamble\setmathtt
% \end{macrocode}
+%
% If the commands above are not executed, then \cmd\rmdefault\ (\etc)
% will be used.
% \begin{macrocode}
@@ -215,8 +174,6 @@
\tl_set:Nn \g_@@_mathsf_tl {\sfdefault}
\tl_set:Nn \g_@@_mathtt_tl {\ttdefault}
% \end{macrocode}
-% \end{macro} \end{macro} \end{macro}
-% \end{macro}
%
% \begin{macro}{\newfontfamily}
% This macro takes the arguments of \cs{fontspec} with a prepended
@@ -230,16 +187,9 @@
% \cs{l_fontspec_family_tl}. This family is then used in a typical NFSS \cmd\fontfamily\
% declaration, saved in the macro name specified.
% \begin{macrocode}
-\DeclareDocumentCommand \newfontfamily { m O{} m O{} }
- {
- \@@_main_newfontfamily:nnnn {#1} {#2} {#3} {#4}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_set:Nn \@@_main_newfontfamily:nnnn
+\cs_set:Nn \@@_main_newfontfamily:nnn
{
- \fontspec_set_family:cnn { g_@@_ \cs_to_str:N #1 _family } {#2,#4} {#3}
+ \fontspec_set_family:cnn { g_@@_ \cs_to_str:N #1 _family } {#2} {#3}
\use:x
{
\exp_not:N \DeclareRobustCommand \exp_not:N #1
@@ -256,21 +206,14 @@
% \begin{macro}{\newfontface}
% \cmd\newfontface\ uses the fact that if the argument to \feat{BoldFont}, etc., is empty (\ie, |BoldFont={}|), then no bold font is searched for.
% \begin{macrocode}
-\DeclareDocumentCommand \newfontface { m O{} m O{} }
- {
- \@@_main_newfontface:nnnn {#1} {#2} {#3} {#4}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_set:Nn \@@_main_newfontface:nnnn
+\cs_set:Nn \@@_main_newfontface:nnn
{
- \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3}
+ \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3}
}
% \end{macrocode}
% \end{macro}
%
-% \subsubsection{Font feature selection}
+% \subsection{Font feature selection}
%
% \begin{macro}{\defaultfontfeatures}
% This macro takes one argument that consists of all of feature
@@ -279,15 +222,17 @@
% \cs{g_fontspec_default_fontopts_tl} (initialised empty), which is
% concatenated with the individual macro choices in the
% [...] macro.
-%
% \begin{macrocode}
-\DeclareDocumentCommand \defaultfontfeatures { t+ o m }
+\cs_set:Nn \@@_main_defaultfontfeatures:nnn
{
\IfNoValueTF {#2}
{ \@@_set_default_features:nn {#1} {#3} }
{ \@@_set_font_default_features:nnn {#1} {#2} {#3} }
\ignorespaces
}
+% \end{macrocode}
+%
+% \begin{macrocode}
\cs_new:Nn \@@_set_default_features:nn
{
\IfBooleanTF {#1} \clist_put_right:Nn \clist_set:Nn
@@ -345,13 +290,6 @@
% \cs{addfontfeature} is defined as an alias, as I found that I
% often typed this instead when adding only a single font feature.
% \begin{macrocode}
-\DeclareDocumentCommand \addfontfeatures {m}
- {
- \@@_main_addfontfeatures:n {#1}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
\cs_set:Nn \@@_main_addfontfeatures:n
{
%<debug> \typeout{^^J::::::::::::::::::::::::::::::::::^^J: addfontfeatures}
@@ -376,24 +314,16 @@
}
\ignorespaces
}
-\cs_set_eq:NN \addfontfeature \addfontfeatures
% \end{macrocode}
% \end{macro}
%
-% \subsubsection{Defining new font features}
+% \subsection{Defining new font features}
%
% \begin{macro}{\newfontfeature}
% \cs{newfontfeature} takes two arguments: the name of the feature
% tag by which to reference it, and the string that is used to
% select the font feature.
% \begin{macrocode}
-\DeclareDocumentCommand \newfontfeature {mm}
- {
- \@@_main_newfontfeature:nn {#1} {#2}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
\cs_set:Nn \@@_main_newfontfeature:nn
{
\keys_define:nn { fontspec }
@@ -413,13 +343,6 @@
% Better than \cmd\newfontfeature\ because it checks if the feature exists in the
% font it's being used for.
% \begin{macrocode}
-\DeclareDocumentCommand \newAATfeature {mmmm}
- {
- \@@_main_newAATfeature:nnnn {#1} {#2} {#3} {#4}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
\cs_set:Nn \@@_main_newAATfeature:nnnn
{
\keys_if_exist:nnF { fontspec } {#1}
@@ -438,13 +361,6 @@
% Better than \cmd\newfontfeature\ because it checks if the feature exists in the
% font it's being used for.
% \begin{macrocode}
-\DeclareDocumentCommand \newopentypefeature {mmm}
- {
- \@@_main_newopentypefeature:nnn {#1} {#2} {#3}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
\cs_set:Nn \@@_main_newopentypefeature:nnn
{
\keys_if_exist:nnF { fontspec / options } {#1}
@@ -467,27 +383,11 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\newICUfeature}
-% Deprecated.
-% \begin{macrocode}
-\DeclareDocumentCommand \newICUfeature {mmm}
- {
- \@@_main_newopentypefeature:nnn {#1} {#2} {#3}
- }
-% \end{macrocode}
-% \end{macro}
%
%
% \begin{macro}{\aliasfontfeature}
% User commands for renaming font features and font feature options.
% \begin{macrocode}
-\DeclareDocumentCommand \aliasfontfeature {mm}
- {
- \@@_main_aliasfontfeature:nn {#1} {#2}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
\cs_set:Nn \@@_main_aliasfontfeature:nn
{
%<debug> \typeout{::::::::::::::::::::^^J:: aliasfontfeature{#1}{#2}}
@@ -512,13 +412,6 @@
%
% \begin{macro}{\aliasfontfeatureoption}
% \begin{macrocode}
-\DeclareDocumentCommand \aliasfontfeatureoption {mmm}
- {
- \@@_main_aliasfontfeatureoption:nnn {#1} {#2} {#3}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
\cs_set:Nn \@@_main_aliasfontfeatureoption:nnn
{
\bool_set_false:N \l_@@_alias_bool
@@ -554,57 +447,24 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\newfontscript}
-% Mostly used internally, but also possibly useful for users, to define new OpenType
-% `scripts', mapping logical names to OpenType script tags.
-% \begin{macrocode}
-\DeclareDocumentCommand \newfontscript {mm}
- {
- \fontspec_new_script:nn {#1} {#2}
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\newfontlanguage}
-% Mostly used internally, but also possibly useful for users, to define new OpenType
-% `languages', mapping logical names to OpenType language tags.
-% \begin{macrocode}
-\DeclareDocumentCommand \newfontlanguage {mm}
- {
- \fontspec_new_lang:nn {#1} {#2}
- }
-% \end{macrocode}
-% \end{macro}
-%
%
% \begin{macro}{\DeclareFontsExtensions}
% \texttt{dfont} would never be uppercase, right?
% \begin{macrocode}
-\DeclareDocumentCommand \DeclareFontsExtensions {m}
- {
- \@@_main_DeclareFontsExtensions:n {#1}
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
\cs_set:Nn \@@_main_DeclareFontsExtensions:n
{
\clist_set:Nn \l_@@_extensions_clist { #1 }
\tl_remove_all:Nn \l_@@_extensions_clist {~}
}
-\DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont}
% \end{macrocode}
-% \end{macro}
-
-
-% \begin{macro}{\IfFontFeatureActiveTF}
+%
% \begin{macrocode}
-\DeclareDocumentCommand \IfFontFeatureActiveTF {mmm}
- {
- \@@_main_IfFontFeatureActiveTF:nnn {#1} {#2} {#3}
- }
+\DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont}
% \end{macrocode}
+% \end{macro}
%
+%
+% \begin{macro}{\IfFontFeatureActiveTF}
% \begin{macrocode}
\cs_set:Nn \@@_main_IfFontFeatureActiveTF:nnn
{