% LaTeX-Package for libertine
%
% $Id: libertine.sty 40 2010-03-13 18:03:37Z michael $
%
% Michael Niedermair m.g.n@gmx.de
%
% (License GPL)
%
\def\libertineVersion{4.6.5a}%
\def\libertineVersionDate{2010/03/13}
%
\ProvidesPackage{libertine}[%
   \libertineVersionDate\space-\space\libertineVersion:
   Font libertine - (License GPL) Michael Niedermair]
%
\RequirePackage{keyval,ifxetex%,ifluatex
}
%
%\XeTeXtracingfonts=1
%
\def\fxl@scale{1}%      scale factor
\def\fxl@default{0}%    nf, osf, ss, osfss
%
\define@key{fxl}{scaled}[1]{\def\fxl@scale{#1}}
\define@key{fxl}{default}[0]{\def\fxl@default{0}}
\define@key{fxl}{osf}[true]{\def\fxl@default{1}}
\define@key{fxl}{ss}[true]{\def\fxl@default{2}}
\define@key{fxl}{osfss}[true]{\def\fxl@default{3}}
\define@key{fxl}{nf}[true]{\def\fxl@default{0}}

\def\ProcessOptionsWithKV#1{%
  \let\@tempc\relax
  \let\fxl@tempa\@empty
  \@for\CurrentOption:=\@classoptionslist\do{%
    \@ifundefined{KV@#1@\CurrentOption}%
    {}%
    {%
      \edef\fxl@tempa{\fxl@tempa,\CurrentOption,}%
      \@expandtwoargs\@removeelement\CurrentOption
        \@unusedoptionlist\@unusedoptionlist
    }%
  }%
  \edef\fxl@tempa{%
    \noexpand\setkeys{#1}{%
      \fxl@tempa\@ptionlist{\@currname.\@currext}%
    }%
  }%
  \fxl@tempa
  \let\CurrentOption\@empty
}
\ProcessOptionsWithKV{fxl}
\AtEndOfPackage{%
  \let\@unprocessedoptions\relax
}
%
\def\libertine@param{}
\def\biolinum@param{}
%
\ifxetex
  \RequirePackage{xltxtra}
  % Font
  \def\libertine@param{Mapping=tex-text,RawFeature=+liga}
  \def\biolinum@param{Mapping=tex-text,RawFeature=+liga}
  \ifcase\fxl@default% nf
    \def\libertine@param{Mapping=tex-text,RawFeature=+liga}
    \def\biolinum@param{Mapping=tex-text,RawFeature=+liga}
  \or% osf
    \def\libertine@param{Mapping=tex-text,RawFeature=+liga;+onum}
    \def\biolinum@param{Mapping=tex-text,RawFeature=+liga;+onum}
  \or% ss
    \def\libertine@param{Mapping=tex-text,RawFeature=+liga;+ss03}
    \def\biolinum@param{Mapping=tex-text,RawFeature=+liga;+ss03}
  \or% osfss
    \def\libertine@param{Mapping=tex-text,RawFeature=+liga;+onum;+ss03}
    \def\biolinum@param{Mapping=tex-text,RawFeature=+liga;+onum;+ss03}
  \fi
  \setromanfont[\libertine@param]{Linux Libertine O}
  \setsansfont[\biolinum@param]{Linux Biolinum O}
  \newfontfamily\biolinum[\biolinum@param]{Linux Biolinum O}
  \newfontfamily\libertine[\libertine@param]{Linux Libertine O}
  %
  \ProvideTextCommand{\glqq}{EU1}{\textormath{\quotedblbase}{\mbox{\quotedblbase}}}
  \ProvideTextCommand{\grqq}{EU1}{\textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
  %
  \DeclareRobustCommand*\libertineGlyph[1]{{%
    \libertine%
    \@tempcnta=\XeTeXglyphindex "#1"\relax%
    \ifnum\@tempcnta>0%
      \XeTeXglyph\@tempcnta%
    \fi
  }}
  \DeclareRobustCommand*\biolinumGlyph[1]{{%
    \biolinum%
    \@tempcnta=\XeTeXglyphindex "#1"\relax%
    \ifnum\@tempcnta>0%
      \XeTeXglyph\@tempcnta%
    \fi
  }}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55
\else
%  \ifluatex
%       \RequirePackage{luaotfload}
%       % Font
%       \ifcase\fxl@default% nf
%         \def\libertine@param{+liga}
%         \def\biolinum@param{+liga}
%       \or% osf
%         \def\libertine@param{+liga:+onum}
%         \def\biolinum@param{+liga:+onum}
%       \or% ss
%         \def\libertine@param{+liga:+ss03}
%         \def\biolinum@param{+liga:+ss03}
%       \or% osfss
%         \def\libertine@param{+liga:+onum:+ss03}
%         \def\biolinum@param{+liga:+onum:+ss03}
%       \fi
%
%       \DeclareFontFamily{T1}{libertine}{}
%       \DeclareFontShape{T1}{libertine}{m}{n}{<-> "fxlr:\libertine@param"}{}
%       \DeclareFontShape{T1}{libertine}{m}{it}{<-> "fxlri:\libertine@param"}{}
%       \DeclareFontShape{T1}{libertine}{m}{sl}{<-> "fxlro:\libertine@param"}{}
%       \DeclareFontShape{T1}{libertine}{b}{n}{<-> "fxlb:\libertine@param"}{}
%       \DeclareFontShape{T1}{libertine}{b}{it}{<-> "fxlbi:\libertine@param"}{}
%       \DeclareFontShape{T1}{libertine}{b}{sl}{<-> "fxlbo:\libertine@param"}{}
%       \DeclareFontShape{T1}{libertine}{m}{sc}{<-> "fxlr:\libertine@param:+smcp"}{}
%       \DeclareFontShape{T1}{libertine}{b}{sc}{<-> "fxlb:\libertine@param:+smcp"}{}
%       \DeclareFontShape{T1}{libertine}{m}{ic}{<-> "fxlric:\libertine@param:+smcp"}{}
%       \DeclareFontShape{T1}{libertine}{b}{ic}{<-> "fxlbic:\libertine@param:+smcp"}{}
%       \DeclareFontShape{T1}{libertine}{bx}{n}{<->ssub * libertine/b/n}{}
%       \DeclareFontShape{T1}{libertine}{bx}{it}{<->ssub * libertine/b/it}{}
%       \DeclareFontShape{T1}{libertine}{bx}{sl}{<->ssub * libertine/b/sl}{}
%       \DeclareFontShape{T1}{libertine}{bx}{sc}{<->ssub * libertine/b/sc}{}
%       \DeclareFontShape{T1}{libertine}{bx}{ic}{<->ssub * libertine/b/ic}{}
%       \def\libertine{\fontfamily{libertine}\selectfont}
%       \renewcommand\rmdefault{libertine}%
%
%       \DeclareFontFamily{T1}{biolinum}{}
%       \DeclareFontShape{T1}{biolinum}{m}{n}{<-> "fxbr:\biolinum@param"}{}
%       \DeclareFontShape{T1}{biolinum}{m}{it}{<-> "fxbri:\biolinum@param"}{}
%       \DeclareFontShape{T1}{biolinum}{m}{sl}{<-> "fxbro:\biolinum@param"}{}
%       \DeclareFontShape{T1}{biolinum}{b}{n}{<-> "fxbb:\biolinum@param"}{}
%       \DeclareFontShape{T1}{biolinum}{b}{sl}{<-> "fxbbo:\biolinum@param"}{}
%       \DeclareFontShape{T1}{biolinum}{m}{sc}{<-> "fxbr:\biolinum@param:+smcp"}{}
%       \DeclareFontShape{T1}{biolinum}{b}{sc}{<-> "fxbb:\biolinum@param:+smcp"}{}
%       \DeclareFontShape{T1}{biolinum}{m}{ic}{<-> "fxbric:\biolinum@param:+smcp"}{}
%       \DeclareFontShape{T1}{biolinum}{bx}{n}{<->ssub * biolinum/b/n}{}
%       \DeclareFontShape{T1}{biolinum}{bx}{it}{<->ssub * biolinum/b/it}{}
%       \DeclareFontShape{T1}{biolinum}{bx}{sc}{<->ssub * biolinum/b/sc}{}
%       \def\biolinum{\fontfamily{biolinum}\selectfont}
%       \renewcommand\sfdefault{biolinum}%
%
%  \else
      % latex
      %
      \def\libertine@param{}
      \def\biolinum@param{}
      % ------------------------------------------------
      % default
      \ifcase\fxl@default% nf
        \def\libertine@param{fxl}
        \def\biolinum@param{fxb}
      \or% osf
        \def\libertine@param{fxlj}
        \def\biolinum@param{fxbj}
      \or% ss
        \def\libertine@param{fxlo}
        \def\biolinum@param{fxbo}
      \or% osfss
        \def\libertine@param{fxljo}
        \def\biolinum@param{fxbjo}
      \fi
      \renewcommand\rmdefault{\libertine@param}%
      \renewcommand\sfdefault{\biolinum@param}%
      %
      % ---------------------------------------------------------
      \newcommand*\DeclareTextGlyphX[5]{%
        % \DeclareTextGlyphX{fxl}{U}{fxla7}{uniA7F1}{241}
        % #1=basefont #2=encoding #3=fontfamily #4=glyphname, #5=position
        \@namedef{#1@#4}{\fontfamily{#3}\fontencoding{#2}\selectfont\char#5}}
      \DeclareRobustCommand*\libertineGlyph[1]{\@nameuse{fxl@#1}}
      \DeclareRobustCommand*\biolinumGlyph[1]{\@nameuse{fxb@#1}}
      %
      \input{fxl.inc}
      \input{fxb.inc}
      %
      \def\libertine{\fontfamily{\libertine@param}\selectfont}
      \def\biolinum{\fontfamily{\biolinum@param}\selectfont}
      %
  \fi
%\fi
%
\DeclareTextCommandDefault{\texteuro}{{\libertineGlyph{Euro}}}
%
\endinput
