diff options
author | Jan-Hendrik Dolling <JanHendrikDolling@users.noreply.github.com> | 2018-01-04 13:11:04 +0100 |
---|---|---|
committer | Jan-Hendrik Dolling <JanHendrikDolling@users.noreply.github.com> | 2018-01-04 13:11:04 +0100 |
commit | c92a4d682704d575af9b026da329211648dcba5c (patch) | |
tree | b50988898612ecee285d1c45437076059edd0d88 | |
parent | 257f98d24000f6e65c4a4aba5edd60c0488189a3 (diff) |
works also if only free or only pro fonts available
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | create_sty.py | 15 | ||||
-rw-r--r-- | fontawesome5.sty | 15 |
3 files changed, 19 insertions, 12 deletions
@@ -1,5 +1,6 @@ fonts/*.otf +fontawesome/** ## Core latex/pdflatex auxiliary files: *.aux diff --git a/create_sty.py b/create_sty.py index ad8a52c..22a2cfe 100644 --- a/create_sty.py +++ b/create_sty.py @@ -14,14 +14,9 @@ OUTPUT_HEADER = r''' % Configure a directory location for fonts(default: 'fonts/') \newcommand*{\fontdir}[1][fonts/]{\def\@fontdir{#1}} \fontdir -% Define shortcut to load the Font Awesome font. -\newfontfamily\FA[ - Path=\@fontdir, - UprightFont=*-Regular-400, - BoldFont=*-Solid-900, -]{Font Awesome 5 Free} % Define pro option \DeclareOption{pro}{ + % Define shortcut to load the Font Awesome pro font. \newfontfamily\FA[ Path=\@fontdir, UprightFont=*-Regular-400, @@ -32,6 +27,14 @@ OUTPUT_HEADER = r''' \ProcessOptions\relax % Define shortcut to load the Font Awesome font for brands. \newfontfamily{\FAbrands}[Path=\@fontdir]{Font Awesome 5 Brands-Regular-400} +% Define shortcut to load the Font Awesome font. +\@ifundefined{FA}{% +\newfontfamily\FA[ + Path=\@fontdir, + UprightFont=*-Regular-400, + BoldFont=*-Solid-900, +]{Font Awesome 5 Free} +}{} % Generic command displaying an icon by its name. \newcommand*{\faicon}[1]{{ \csname faicon@#1\endcsname diff --git a/fontawesome5.sty b/fontawesome5.sty index 2ebcce5..ad37b21 100644 --- a/fontawesome5.sty +++ b/fontawesome5.sty @@ -7,14 +7,9 @@ % Configure a directory location for fonts(default: 'fonts/') \newcommand*{\fontdir}[1][fonts/]{\def\@fontdir{#1}} \fontdir -% Define shortcut to load the Font Awesome font. -\newfontfamily\FA[ - Path=\@fontdir, - UprightFont=*-Regular-400, - BoldFont=*-Solid-900, -]{Font Awesome 5 Free} % Define pro option \DeclareOption{pro}{ + % Define shortcut to load the Font Awesome pro font. \newfontfamily\FA[ Path=\@fontdir, UprightFont=*-Regular-400, @@ -25,6 +20,14 @@ \ProcessOptions\relax % Define shortcut to load the Font Awesome font for brands. \newfontfamily{\FAbrands}[Path=\@fontdir]{Font Awesome 5 Brands-Regular-400} +% Define shortcut to load the Font Awesome font. +\@ifundefined{FA}{% +\newfontfamily\FA[ + Path=\@fontdir, + UprightFont=*-Regular-400, + BoldFont=*-Solid-900, +]{Font Awesome 5 Free} +}{} % Generic command displaying an icon by its name. \newcommand*{\faicon}[1]{{ \csname faicon@#1\endcsname |