diff options
author | Karl Berry <karl@freefriends.org> | 2015-11-11 23:13:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-11-11 23:13:09 +0000 |
commit | 4b253de4e3a6e181da022e0ccd93d348dcfe894b (patch) | |
tree | 0c1f4c45bfbaa358dc4cb644e99e57192e3908fd | |
parent | 68684ca13f8f038010d042e35f61531772bbe206 (diff) |
iffont (11nov15)
git-svn-id: svn://tug.org/texlive/trunk@38823 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/iffont/README.md | 14 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/iffont/iffont.pdf | bin | 0 -> 28706 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/iffont/iffont.dtx | 316 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/iffont/iffont.ins | 30 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/iffont/iffont.sty | 77 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/iffont.tlpsrc | 0 |
8 files changed, 439 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/iffont/README.md b/Master/texmf-dist/doc/latex/iffont/README.md new file mode 100644 index 00000000000..05171f5b2a4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/iffont/README.md @@ -0,0 +1,14 @@ +# iffonts – Conditionally load fonts with fontspec + +This package provides a macro to select the first font XeLaTeX or LuaTeX can +find in a comma separated list and, additionally, a number of macro tests. + +Have a look at the documentation for more information and some examples. + +This work may be distributed and/or modified under the conditions of the LaTeX +Project Public License, either version 1.3 of this license or (at your option) +any later version. + +If you have any problems or suggestions please get in touch via Github: + + https://github.com/benjamin-weiss/iffont diff --git a/Master/texmf-dist/doc/latex/iffont/iffont.pdf b/Master/texmf-dist/doc/latex/iffont/iffont.pdf Binary files differnew file mode 100644 index 00000000000..6fca132ad24 --- /dev/null +++ b/Master/texmf-dist/doc/latex/iffont/iffont.pdf diff --git a/Master/texmf-dist/source/latex/iffont/iffont.dtx b/Master/texmf-dist/source/latex/iffont/iffont.dtx new file mode 100644 index 00000000000..b550caebea8 --- /dev/null +++ b/Master/texmf-dist/source/latex/iffont/iffont.dtx @@ -0,0 +1,316 @@ +% \iffalse meta-comment +% +% Copyright (C) 2015 by Benjamin Weiss <weissbenjamin@me.com> +% --------------------------------------------------------------------------- +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Benjamin Weiss. +% +% This work consists of the files iffont.dtx and iffont.ins and the derived +% file iffont.sty. +% +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{iffont.dtx} +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{iffont} +%<*package> + [2015/11/11 1.0.0 Iffont package] +%</package> +%<*driver> +\documentclass{ltxdoc} +%\EnableCrossrefs +%\CodelineIndex +%\DisableCrossrefs +%\RecordChanges +%\OnlyDescription +\usepackage[parfill]{parskip} +\usepackage{setspace} +\onehalfspacing + +\usepackage[no-math]{fontspec} +\setmainfont[BoldFont={Fira Sans}]{Fira Sans Light} +\setmonofont{Fira Mono} +\defaultfontfeatures{Ligatures=TeX} + +\usepackage{metalogo} + +\usepackage{enumitem} +\setlist[itemize]{noitemsep} +\setlist[enumerate]{noitemsep} + +\usepackage[showerrors,table,hyperref]{xcolor} +\usepackage{iffont} + +\definecolor{mDarkBrown}{HTML}{604c38} +\definecolor{mDarkTeal}{HTML}{23373b} +\definecolor{mLightBrown}{HTML}{EB811B} +\definecolor{mLightGreen}{HTML}{14B03D} +\definecolor{mBackground}{HTML}{FFFFFF} + +\usepackage{listings} +\lstset{% + gobble=2, + language=[LaTeX]{TeX}, + basicstyle=\ttfamily\small, + keywordstyle=\color{mLightBrown}\bfseries, + commentstyle=\color{mLightGreen}, + stringstyle=\color{mLightGreen}, + backgroundcolor=\color{mBackground}, + numbers=none, + numberstyle=\tiny\ttfamily, + stepnumber=2, + showspaces=false, + showstringspaces=false, + showtabs=false, + frame=none, + framerule=1pt, + tabsize=2, + rulesep=5em, + captionpos=b, + breaklines=true, + breakatwhitespace=false, + framexleftmargin=0em, + framexrightmargin=0em, + xleftmargin=0em, + xrightmargin=0em, + aboveskip=1em, + belowskip=1em, + morekeywords={settofirstfound, setmainfont, boldfont, mainfont, + FrutigerLight, newfontfamily, lightfont}, +} +\lstMakeShortInline| + +\usepackage[colorlinks=true, + linkcolor=mLightBrown, + menucolor=mLightBrown, + pagecolor=mLightBrown, + urlcolor=mLightBrown]{hyperref} + +\usepackage{tabu} +\usepackage{longtable} +\usepackage{xstring} + +\begin{document} +\DocInput{iffont.dtx} +\end{document} +%</driver> +% \fi +% +% \CheckSum{0} +% +% \GetFileInfo{iffont.sty} +% \title{The \textsc{iffont} package} +% \author{Benjamin Weiss\\ \url{weissbenjamin@me.com}} +% \date{Version \fileversion~from \filedate} +% +% \maketitle +% +% \section{Introduction} +% +% Using OpenType fonts within \XeLaTeX\ or \LuaTeX\ comes with a lot of +% benefits, but also the problem, that desired fonts may not be installed on +% the system, the user choses for the compilation. In case they are, there can +% still be different revisions of a font with variant names, such as +% \textit{Frutiger LT Std}, \textit{Frutiger Neue LT Pro} and \textit{Frutiger +% Next Pro}. +% +% Inspired by a question on \href{http://tex.stackexchange.com/q/53443/} +% {Stack Exchange} and a discussion on the +% \href{http://tug.org/pipermail/xetex/2010-August/017833.html}{\XeTeX\ +% Mailinglist}, this package addresses the problem with a set of easy to use +% macros: a macro to select the first font \XeLaTeX\ or \LuaTeX\ can find in a +% comma separated list and, additionally, a number of macro tests. +% +% \section{Select a Font from a List of Fonts} +% +% \DescribeMacro{\settofirstfound} This command defines a new macro with the +% first font found in the comma separated list. The list is provided as second +% argument. The macro can then be used to set the main font, set the sans +% font, define a new font family and so on. The following code shows how to +% set the main font as the Frutiger Font with the black font weight as bold +% font. +% \begin{lstlisting} +% \documentclass{article} +% \usepackage{fontspec} +% \usepackage{iffont} +% \settofirstfound{\mainfont}{Frutiger Next Pro, +% Frutiger Neue LT Pro, +% Frutiger LT Std} +% \settofirstfound{\boldfont}{Frutiger Next Pro Black, +% Frutiger Neue LT Pro Black, +% Frutiger LT Std 75 Black} +% \setmainfont[BoldFont=\boldfont]{\mainfont} +% \begin{document} +% \begin{itemize} +% \item \mainfont +% \item \textbf{\boldfont} +% \end{itemize} +% \end{document} +% \end{lstlisting} +% Defining a new font family works just the same. +% \begin{lstlisting} +% \documentclass{article} +% \usepackage{fontspec} +% \usepackage{iffont} +% \settofirstfound{\lightfont}{Frutiger Next Pro Light, +% Frutiger Neue LT Pro Light, +% Frutiger LT Std 45 Light} +% \newfontfamily\FrutigerLight{\lightfont} +% \begin{document} +% \begin{itemize} +% \item {\FrutigerLight \lightfont} +% \end{itemize} +% \end{document} +% \end{lstlisting} +% \StopEventually{} +% +% \section{Macro Tests} +% In most cases the \lstinline|\settofirstfound| command is sufficient, but +% for the more demanding user there is also a set of macro tests. They are +% useful, if one wants to set specific font features only if the first choice +% font cannot be found. The original \textit{Frutiger LT Std} font for example +% does not support small caps. So in the following example the +% \lstinline|\textsc|command is redefined as uppercase with increased letter +% spacing, but only if the \textit{Frutiger Next Pro} font cannot be found. +% \begin{lstlisting} +% \documentclass{article} +% \usepackage{fontspec} +% \usepackage{iffont} +% \settofirstfound{\mainfont}{Frutiger Next Pro, +% Frutiger LT Std} +% \setmainfont{\mainfont} +% \ifxfontexists{Frutiger Next Pro}{% +% \def\textsc#1{\addfontfeature{LetterSpace=5.0}% +% \MakeUppercase{#1}} +% }{} +% \begin{document} +% \begin{itemize} +% \item \mainfont +% \item \textsc{\mainfont} +% \end{itemize} +% \end{document} +% \end{lstlisting} +% \section{Implementation} +% +% \iffalse +%<*package> +% \fi +% +% +% +% \subsection{Required Packages} +% Load required packages. +% \begin{macrocode} +\RequirePackage{fontspec} +\RequirePackage{etoolbox} +% \end{macrocode} +% +% Init required variables. +% \begin{macrocode} +\newtoggle{@iffont@fontfound} +\newcommand{\@iffont@firstfont}{Fira Sans} +\newcounter{@iffont@fontsnotfound} +% \end{macrocode} +% +% \begin{macro}{\iffontsexist} +% If all fonts are found the commands in the second argument will be executed, +% otherwise the commands in the third argument. +% \begin{macrocode} +\newcommand{\iffontsexist}[3]{ + \setcounter{@iffont@fontsnotfound}{0} + \expandafter\forcsvlist\expandafter\@iffont@checkfont\expandafter{#1} + \ifnumequal{\value{@iffont@fontsnotfound}}{0}{% + #2 + }{% + #3 + } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifxfontsexist} +% Same as \lstinline|\iffontsexist|, but negated. +% \begin{macrocode} +\newcommand{\ifxfontsexist}[3]{ + \iffontsexist{#1}{#3}{#2} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\iffontexists} +% A simpler and therefore faster if clause, that only checks for a single font. +% \begin{macrocode} +\newcommand{\iffontexists}[3]{ + \suppressfontnotfounderror=1 + \font\x = "#1" at 10pt + \ifx\x\nullfont + #3 + \else + #2 + \fi + \suppressfontnotfounderror=0 +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifxfontexists} +% Same as \lstinline|\iffontexists|, but negated. +% \begin{macrocode} +\newcommand{\ifxfontexists}[3]{ + \iffontexists{#1}{#3}{#2} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\settofirstfound} +% Sets the macro in the first argument to the first font in the comma separated +% list of fonts in the second argument that is found. +% \begin{macrocode} +\newcommand{\settofirstfound}[2]{ + \togglefalse{@iffont@fontfound} + \expandafter\forcsvlist\expandafter\@iffont@checkfont\expandafter{#2} + \let#1\@iffont@firstfont +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@iffont@checkfont} +% Checks if a font is found and increases the \lstinline|@iffont@fontsnotfound| +% counter if not. The first font found will be saved in +% \lstinline|\@iffont@firstfont|. +% \begin{macrocode} +\newcommand{\@iffont@checkfont}[1]{ + \suppressfontnotfounderror=1 + \font\x = "#1" at 10pt + \ifx\x\nullfont + \stepcounter{@iffont@fontsnotfound} + \else + \nottoggle{@iffont@fontfound}{% + \renewcommand{\@iffont@firstfont}{#1} + \toggletrue{@iffont@fontfound} + }{} + \fi + \suppressfontnotfounderror=0 +} +% \end{macrocode} +% \end{macro} +% +% \iffalse +%</package> +% \fi +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/iffont/iffont.ins b/Master/texmf-dist/source/latex/iffont/iffont.ins new file mode 100644 index 00000000000..674ad640254 --- /dev/null +++ b/Master/texmf-dist/source/latex/iffont/iffont.ins @@ -0,0 +1,30 @@ +\input docstrip.tex +\keepsilent +\askforoverwritefalse + +\preamble +Copyright (C) 2015 by Benjamin Weiss <weissbenjamin@me.com> + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3 +of this license or (at your option) any later version. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is Benjamin Weiss. + +This work consists of the files iffont.dtx and iffont.ins and the +derived file iffont.sty. +\endpreamble + +\usedir{tex/latex/iffont} + +\generate{% + \file{iffont.sty}{\from{iffont.dtx}{package}}% +} + +\endbatchfile diff --git a/Master/texmf-dist/tex/latex/iffont/iffont.sty b/Master/texmf-dist/tex/latex/iffont/iffont.sty new file mode 100644 index 00000000000..97f20e8ffe6 --- /dev/null +++ b/Master/texmf-dist/tex/latex/iffont/iffont.sty @@ -0,0 +1,77 @@ +%% +%% This is file `iffont.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% iffont.dtx (with options: `package') +%% Copyright (C) 2015 by Benjamin Weiss <weissbenjamin@me.com> +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Benjamin Weiss. +%% +%% This work consists of the files iffont.dtx and iffont.ins and the +%% derived file iffont.sty. +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{iffont} + [2015/11/11 1.0.0 Iffont package] +\RequirePackage{fontspec} +\RequirePackage{etoolbox} +\newtoggle{@iffont@fontfound} +\newcommand{\@iffont@firstfont}{Fira Sans} +\newcounter{@iffont@fontsnotfound} +\newcommand{\iffontsexist}[3]{ + \setcounter{@iffont@fontsnotfound}{0} + \expandafter\forcsvlist\expandafter\@iffont@checkfont\expandafter{#1} + \ifnumequal{\value{@iffont@fontsnotfound}}{0}{% + #2 + }{% + #3 + } +} +\newcommand{\ifxfontsexist}[3]{ + \iffontsexist{#1}{#3}{#2} +} +\newcommand{\iffontexists}[3]{ + \suppressfontnotfounderror=1 + \font\x = "#1" at 10pt + \ifx\x\nullfont + #3 + \else + #2 + \fi + \suppressfontnotfounderror=0 +} +\newcommand{\ifxfontexists}[3]{ + \iffontexists{#1}{#3}{#2} +} +\newcommand{\settofirstfound}[2]{ + \togglefalse{@iffont@fontfound} + \expandafter\forcsvlist\expandafter\@iffont@checkfont\expandafter{#2} + \let#1\@iffont@firstfont +} +\newcommand{\@iffont@checkfont}[1]{ + \suppressfontnotfounderror=1 + \font\x = "#1" at 10pt + \ifx\x\nullfont + \stepcounter{@iffont@fontsnotfound} + \else + \nottoggle{@iffont@fontfound}{% + \renewcommand{\@iffont@firstfont}{#1} + \toggletrue{@iffont@fontfound} + }{} + \fi + \suppressfontnotfounderror=0 +} +\endinput +%% +%% End of file `iffont.sty'. diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index bedd8e52bda..51e4e67532b 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -289,7 +289,7 @@ my @TLP_working = qw( hypdvips hyper hypernat hyperref hyperxmp hyph-utf8 hyphen-base hyphenat hyphenex hyplain ibycus-babel ibygrk icsv idxcmds idxlayout ieeepes - ifetex ifmslide ifmtarg ifnextok ifoddpage ifplatform ifsym + ifetex iffont ifmslide ifmtarg ifnextok ifoddpage ifplatform ifsym iftex ifthenx ifxetex iitem ijmart ijqc imac image-gallery imakeidx impatient impatient-cn impatient-fr diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index 66d3a12e48e..12aa63702d3 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -482,6 +482,7 @@ depend hyperxmp depend hyphenat depend idxcmds depend idxlayout +depend iffont depend ifmslide depend ifmtarg depend ifnextok diff --git a/Master/tlpkg/tlpsrc/iffont.tlpsrc b/Master/tlpkg/tlpsrc/iffont.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/iffont.tlpsrc |