Skip to content

Commit

Permalink
Fixed \faBatteryX and \faHourGlassX (fixes #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
xdanaux committed May 16, 2016
1 parent a27c2fb commit 5e9ef18
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 10 deletions.
16 changes: 15 additions & 1 deletion generate_tex_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,19 @@
"lessequal" : ".notdef", #f500 (blank)
}

# tex command replacements, as tex macro names cannot include numerals (see the "fix for FontAwesome icon names containing numerals" section in fontawesome.sty)
tex_macro_names_replace = {
"Hourglass1" : "Hourglass[1]",
"Hourglass2" : "Hourglass[2]",
"Hourglass3" : "Hourglass[3]",
"Battery0" : "Battery[0]",
"Battery1" : "Battery[1]",
"Battery2" : "Battery[2]",
"Battery3" : "Battery[3]",
"Battery4" : "Battery[4]",
};



# command line arguments handling
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -705,7 +718,8 @@ def recurse_dictionary (dictionary, key):
for line in template:
if line == "% <showcaseicon commands go here>\n":
for glyph, tag in all_glyphs:
doc.write(" \\showcaseicon{{{}}}{{fa{}}}{{{}}}\n".format(glyph, glyph.replace('-',' ').title().replace(' ',''), tag));
glyph_macro_name = glyph.replace('-',' ').title().replace(' ','');
doc.write(" \\showcaseicon{{{}}}{{fa{}}}{{{}}}\n".format(glyph, tex_macro_names_replace.get(glyph_macro_name, glyph_macro_name), tag));
else:
doc.write(line);
template.close();
Expand Down
10 changes: 9 additions & 1 deletion templates/fontawesome.sty.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
% identification
%-------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fontawesome}[2016/05/15 v4.6.3 font awesome icons]
\ProvidesPackage{fontawesome}[2016/05/15 v4.6.3.1 font awesome icons]


%-------------------------------------------------------------------------------
Expand Down Expand Up @@ -59,6 +59,14 @@

\fi

%-------------------------------------------------------------------------------
% fix for FontAwesome icon names containing numerals
%-------------------------------------------------------------------------------
\renewcommand{\faHourglass}[1][]{%
\faicon{hourglass\if\relax\detokenize{#1}\relax\else-#1\fi}}
\renewcommand{\faBattery}[1][4]{%
\faicon{battery-#1}}


\endinput

Expand Down
27 changes: 19 additions & 8 deletions templates/fontawesome.tex.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

\documentclass{ltxdoc}
%\GetFileInfo{\jobname.sty}
\def\fileversion{4.6.3}
\def\fileversion{4.6.3.1}
\def\filedate{May 15, 2016}
\usepackage{lmodern}
\usepackage[numbered]{hypdoc}
Expand Down Expand Up @@ -42,6 +42,22 @@ The \textsf{\jobname} package grants access to 634 web-related icons provided by
This package works both with \hologo{Xe}\hologo{(La)TeX} and Lua\hologo{(La)TeX} (using \textsf{fontspec} to load the included original \textsf{otf} font), as well as (pdf)\hologo{(La)TeX} (using an included \textsf{type1} conversion and character mapping of the font).
\end{abstract}

% changelog
\makeatletter
\let\PrintMacroName@original\PrintMacroName
%\let\PrintDescribeMacro\@gobble
%\let\PrintDescribeEnv\@gobble
\let\PrintMacroName\@gobble
%\let\PrintEnvName\@gobble
\begin{macro}{\faHourglass}
\changes{v4.6.3.1}{2016/05/15}{Fixed definition.}
\end{macro}
\begin{macro}{\faHourglassX}
\changes{v4.6.3.1}{2016/05/15}{Changed direct command name to \cs{faHourglass[X]}.}
\end{macro}
\begin{macro}{\faBatteryX}
\changes{v4.6.3.1}{2016/05/15}{Changed direct command name \cs{faBattery[X]}.}
\end{macro}
\changes{v4.6.3} {2016/05/15}{Update to match Font Awesome version 4.6.3, with a total of 634 icons.}
\changes{v4.4.0} {2015/07/30}{Update to match Font Awesome version 4.4.0, with a total of 585 icons.}
\changes{v4.3.0-2}{2015/07/30}{Corrected the (pdf)\hologo{(La)TeX} font definitions to enable scaling, and enabled dvi/ps support.}
Expand All @@ -50,12 +66,6 @@ This package works both with \hologo{Xe}\hologo{(La)TeX} and Lua\hologo{(La)TeX}
\changes{v3.1.1} {2013/05/10}{Update to match Font Awesome version 3.1.1, with 53 new icons.}
\changes{v3.0.2-1}{2013/03/23}{Corrected the swap of the \cs{text-height} and \cs{text-width} icons.}
\changes{v3.0.2} {2013/03/21}{First public release (version number set to match the included FontAwesome.otf font version), requiring \hologo{Xe}- or Lua\hologo{(La)TeX}.}
\makeatletter
\let\PrintMacroName@original\PrintMacroName
%\let\PrintDescribeMacro\@gobble
%\let\PrintDescribeEnv\@gobble
\let\PrintMacroName\@gobble
%\let\PrintEnvName\@gobble
\begin{macro}{\faTextHeight}
\changes{v3.0.2-1}{2013/03/23}{Corrected binding.}
\end{macro}
Expand Down Expand Up @@ -135,7 +145,8 @@ Once the \textsf{\jobname} package loaded, icons can be accessed through the gen
\textcolor{black!50}{(alias)}}{}%
}}

\subsection{Web application icons\label{section:web_application}}
\section{List of icons}
%\subsection{Web application icons\label{section:web_application}}
\begin{showcase}
% <showcaseicon commands go here>
\end{showcase}
Expand Down

0 comments on commit 5e9ef18

Please sign in to comment.