%% $Id: spark-otf.sty 556 2017-09-18 06:22:29Z herbert $
%%
%% This file is distributed under the terms of the LaTeX Project Public
%% License from CTAN archives in directory  macros/latex/base/lppl.txt.
%% Either version 1.3 or, at your option, any later version.
%%
% Copyright 2017 Herbert Voss hvoss@tug.org
%%
\ProvidesPackage{spark-otf}[%
  2017/09/19 v. 0.01 (Herbert Voss) Supports spark OpenType for lualatex/xelatex.] 
%
\RequirePackage{ifxetex,ifluatex,xkeyval,fontspec,xparse}
%
\newif\ifspark@usefilenames \spark@usefilenamesfalse
\DeclareOptionX{usefilenames}[true]{\@nameuse{spark@usefilenames#1}}
%
\providecommand\spark@DefaultFeatures{}
\DeclareOptionX{DefaultFeatures}{\def\spark@DefaultFeatures{#1}}

\ProcessOptionsX\relax

\ifspark@usefilenames
\typeout {Using file names for the spark font}%
%-----------------------------------------  file names ----------------------------

\else
  \typeout {Using symbolic names for the spark font}%
%-----------------------------------------  symbolic names ----------------------------
  \newfontfamily\sparkBarMedium{SparkBar-Medium}[RawFeature=+calt,\spark@DefaultFeatures]
  \newfontfamily\sparkBarNarrow{SparkBar-Narrow}[RawFeature=+calt,\spark@DefaultFeatures]
  \newfontfamily\sparkBarThin{SparkBar-Thin}[RawFeature=+calt,\spark@DefaultFeatures]
%
  \newfontfamily\sparkDotLine{Spark-Dot-lineMedium}[RawFeature=+calt,\spark@DefaultFeatures]
%
  \newfontfamily\sparkDotMedium{Spark-DotMedium}[RawFeature=+calt,\spark@DefaultFeatures]
  \newfontfamily\sparkDotSmall{Spark-DotSmall}[RawFeature=+calt,\spark@DefaultFeatures]
\fi
%
\NewDocumentCommand\sparkBar{oO{}mO{}}{{%
  \IfValueTF{#1}{\@nameuse{sparkBar#1}}{\sparkBarMedium}#2\string{#3\string}#4%
}}
\NewDocumentCommand\sparkDot{oO{}mO{}}{{%
  \IfValueTF{#1}{\@nameuse{sparkDot#1}}{\sparkDotMedium}#2\string{#3\string}#4%
}}

\endinput
