% \iffalse
%% File: l3font.dtx Copyright (C) 1990-2011 LaTeX3 project
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
%% license or (at your option) any later version.  The latest version
%% of this license is in the file
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% This file is part of the ``expl3 bundle'' (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%%
%% The released version of this bundle is available from CTAN.
%%
%% -----------------------------------------------------------------------
%%
%% The development version of the bundle can be found at
%%
%%    http://www.latex-project.org/svnroot/experimental/trunk/
%%
%% for those people who are interested.
%%
%%%%%%%%%%%
%% NOTE: %%
%%%%%%%%%%%
%%
%%   Snapshots taken from the repository represent work in progress and may
%%   not work or may contain conflicting material!  We therefore ask
%%   people _not_ to put them into distributions, archives, etc. without
%%   prior consultation with the LaTeX Project Team.
%%
%% -----------------------------------------------------------------------
%
%<*driver|package>
\RequirePackage{l3names}
%</driver|package>
%\fi
\GetIdInfo$Id: l3font.dtx 2175 2011-03-03 12:16:46Z will $
          {L3 Experimental Font Loading}
%\iffalse
%<*driver>
%\fi
\ProvidesFile{\filename.\filenameext}
  [\filedate\space v\fileversion\space\filedescription]
%\iffalse
\documentclass[full,checktest]{l3doc}
\begin{document}
\DocInput{l3font.dtx}
\end{document}
%</driver>
% \fi
%
%
% \title{The \textsf{l3font} package\thanks{This file
%         has version number \fileversion, last
%         revised \filedate.}\\
% ``Fonts''}
% \author{\Team}
% \date{\filedate}
% \maketitle
%
% \begin{documentation}
%
% This module covers basic font loading commands.
% Functions are provided to load font faces and extract various
% properties from them.
%
% Some features within are specific \XeTeX\ and \LuaTeX; such functions
% will be explicitly noted.
%
% This module is currently a work in progress as we incorporate \LaTeXe's
% font loading into \pkg{expl3}. The successor to the NFSS will provide
% (backwards compatible) user-level functions for font selection.
%
%
% \section{Functions}
%
%
% \begin{function}{\font_set:Nnn,\font_gset:Nnn,
%                  \font_set:cnn,\font_gset:cnn}
% \begin{syntax}
% "\font_set:Nnn" <font cs> \Arg{font name} \Arg{font size}
% \end{syntax}
% Defines <cs> as a command to select the font defined by <font name>
% at the <font size>. If the <font size> is empty, the font will be loaded
% at its design size, which is usually specified by the font designer.
% For fonts without a typical design size, this will usually be 10\,pt.
% \end{function}
%
% \begin{function}{\font_set_eq:NN,\font_gset_eq:NN}
% \begin{syntax}
% "\font_set_eq:NN" <font cs1> <font cs2>
% \end{syntax}
% Copies <font cs2> into <font cs1>.
% \end{function}
%
% \begin{function}{\font_set_to_current:N,\font_gset_to_current:N}
% \begin{syntax}
% "\font_set_to_current:N" <font cs>
% \end{syntax}
% Sets <font cs> to the font that is currently selected.
% \end{function}
%
% \begin{function}{\font_if_null_p:N /(EXP) | \font_if_null:N / (TF)(EXP)}
% \begin{syntax}
% "\font_if_null:NTF" <font cs> \Arg{true} \Arg{false}
% \end{syntax}
% Conditional to switch whether the control sequence is the `null font'.
% \end{function}
%
% \begin{function}{\font_suppress_not_found_error:,\font_enable_not_found_error:}
% \begin{syntax}
% "\font_suppress_not_found_error:"
% "\font_enable_not_found_error:"
% \end{syntax}
% \emph{Not available in pdf\TeX.}
% In LuaTeX or XeTeX, the error when a font is selected but does not exist
% can be toggled with these two commands. The non-existance of a font can
% then be tested with the "\font_if_null_p:N" conditional.
% \end{function}
%
%
%
%
% \end{documentation}
%
% \begin{implementation}
%
% \section{\pkg{l3font} implementation}
%
%    \begin{macrocode}
%<*package>
\ProvidesExplPackage
  {\filename}{\filedate}{\fileversion}{\filedescription}
\package_check_loaded_expl:
%</package>
%<*initex|package>
%    \end{macrocode}
%
%
% \begin{macro}{\font_set:Nnn,\font_gset:Nnn,\font_set:cnn,\font_gset:cnn}
% \begin{arguments}
% \item csname \item fontname \item size (dimension)
% \end{arguments}
% Note that the fontname needs to be escaped appropriately in "xetex"
% or "luatex".
% \testfile{m3font001.lvt}
%    \begin{macrocode}
\cs_new_protected:Npn \font_set:Nnn #1#2#3 { \tex_font:D #1 = #2 ~at~ #3 \scan_stop: }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_protected:Npn \font_gset:Nnn #1#2#3 {
  \tex_global:D \tex_font:D #1 = #2 ~at~ #3 \scan_stop:
}
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_generate_variant:Nn \font_set:Nnn {c}
\cs_generate_variant:Nn \font_gset:Nnn {c}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\font_set_eq:NN}
% \testfile*
%    \begin{macrocode}
\cs_set_eq:NN \font_set_eq:NN \tex_let:D
\cs_set_protected:Npn \font_gset_eq:NN { \tex_global:D \tex_let:D }
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\font_set_to_current:N,\font_gset_to_current:N}
% \testfile*
%    \begin{macrocode}
\cs_set:Npn \font_set_to_current:N #1 {
  \exp_after:wN \font_set_eq:NN \exp_after:wN #1 \tex_the:D \tex_font:D
}
\cs_set:Npn \font_gset_to_current:N #1 {
  \tex_global:D \exp_after:wN \font_set_eq:NN \exp_after:wN #1 \tex_the:D \tex_font:D
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\font_suppress_not_found_error:,\font_enable_not_found_error:}
% \testfile* ^^A THIS IS A BIG LIE! NOT TESTED, BUT OH WELL
%    \begin{macrocode}
\luatex_if_engine:TF
{
  \cs_new:Npn \font_suppress_not_found_error:
    {\luatexsuppressfontnotfounderror=\c_one}
  \cs_new:Npn \font_enable_not_found_error:
    {\luatexsuppressfontnotfounderror=\c_zero}
}
{
  \xetex_if_engine:TF
  {
    \cs_new:Npn \font_suppress_not_found_error:
      {\suppressfontnotfounderror=\c_one}
    \cs_new:Npn \font_enable_not_found_error:
      {\suppressfontnotfounderror=\c_zero}
  }
  {
    \cs_new:Npn \font_suppress_not_found_error:
    {
      \msg_kernel_warning:nnx {l3font} {cmd-pdftex-unavail}
      {\font_suppress_not_found_error:}
    }
  }
}
\msg_kernel_new:nnn {l3font} {cmd-pdftex-unavail} {
  The~ command~ `\exp_not:n{#1}'~ is~ not~ available~ for~ the~ pdfTeX~ format.
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\font_if_null_p:N}
% \testfile*
% \begin{macro}[TF]{\font_if_null:N}
% \testfile*
%    \begin{macrocode}
\prg_new_conditional:Nnn \font_if_null:N {p,TF,T,F} {
  \if_meaning:w #1 \tex_nullfont:D
    \prg_return_true:
  \else:
    \prg_return_false:
  \fi:
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
%</initex|package>
%    \end{macrocode}
%
%    Show token usage:
%    \begin{macrocode}
%<*showmemory>
\showMemUsage
%</showmemory>
%    \end{macrocode}
%
% \end{implementation}
% \PrintIndex
%
% \endinput
