From 4b253de4e3a6e181da022e0ccd93d348dcfe894b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 11 Nov 2015 23:13:09 +0000 Subject: iffont (11nov15) git-svn-id: svn://tug.org/texlive/trunk@38823 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/iffont/iffont.sty | 77 +++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/iffont/iffont.sty (limited to 'Master/texmf-dist/tex/latex/iffont') 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 +%% +%% 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'. -- cgit v1.2.3