% ----------------------------------------------------------------------- %
% File:    abdofonts.sty      Font settings                               %
% Author:  Abdó Roig-Maranges <abdo.roig@gmail.com>                  2013 %
% ----------------------------------------------------------------------- %

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{abdofonts}

\RequirePackage{iftex}            % Do conditionals on tex engine
\RequirePackage{amsfonts}         % AMS fonts


\newcommand{\abdo@otfonts}{
  % Text fonts
  \setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
  \setsansfont[Ligatures=TeX]{TeX Gyre Heros}
  \setmonofont{Ubuntu Mono}

  % Math fonts
  \setmathfont[math-style=TeX]{TeX Gyre Pagella Math}
  \setmathfont[math-style=TeX,range={\mathcal,\mathbfcal}]{Latin Modern Math}
  \setmathfont[math-style=TeX,range={\mathscr,\mathbfscr}]{Asana Math}
  % \setmathfont[math-style=TeX]{Asana Math}
  % \setmathfont[math-style=TeX]{XITS Math}
  % \setmathfont[math-style=TeX]{Latin Modern Math}
}


\newcommand{\abdo@mffonts}{
  \RequirePackage{palatino}
  \RequirePackage{mathpazo}
  \RequirePackage{mathrsfs}         % Ralph Smith Formal Script font.
}


\ifLuaTeX
  \RequirePackage{fontspec}
  \RequirePackage{unicode-math}
  \RequirePackage{lualatex-math}  % temporary kludge to fix some lualatex math issues.

  \abdo@otfonts

\else
  \RequirePackage[utf8]{inputenc}
  \RequirePackage[T1]{fontenc}

  \abdo@mffonts
\fi
