summaryrefslogtreecommitdiff
path: root/fonts/droid/latex/droidsansmono.sty
blob: 0eed88f032ddaeaaee37f3af79c4d0931d4b7e06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
%% droidsansmono.sty
%% Copyright 2019 Mohamed El Morabity
%
% This work may be distributed and/or modified under the conditions of the LaTeX
% Project Public License, either version 1.3 of this license or (at your option)
% any later version. The latest version of this license is in
% http://www.latex-project.org/lppl.txt and version 1.3 or later is part of all
% distributions of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Mohamed El Morabity
%
% This work consists of all files listed in manifest.txt.


\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{droidsansmono}[2019/06/20 Style file for Droid Sans Mono.]

\RequirePackage{ifluatex}
\RequirePackage{ifxetex}
\RequirePackage{xkeyval}

\newif\ifdroidsansmono@otf
\ifxetex
  \droidsansmono@otftrue
\else
  \ifluatex
    \droidsansmono@otftrue
  \else
    \droidsansmono@otffalse
  \fi
\fi

\newif\ifdroidsansmono@defaultmono
\droidsansmono@defaultmonofalse

\newcommand*{\droidsansmono@scale}{1}
\DeclareOptionX{scale}{\renewcommand*{\droidsansmono@scale}{#1}}
\DeclareOptionX{scaled}{\renewcommand*{\droidsansmono@scale}{#1}}

\DeclareOptionX{defaultmono}{\droidsansmono@defaultmonotrue}
\DeclareOptionX{type1}{\droidsansmono@otffalse}

\ProcessOptionsX
\relax


\newcommand*{\droidsansmonofamily}{droidsansmono}

\ifdroidsansmono@otf
  \RequirePackage{fontspec}

  \ifxetex
    \XeTeXtracingfonts=1
  \fi

  \newcommand*{\droidsansmono@otf@slant}{0.213}
  \newcommand*{\droidsansmono@otf@features}{%
    Extension=.ttf,%
    Scale=\droidsansmono@scale,%
    UprightFont={*},%
    ItalicFont={*},%
    ItalicFeatures={FakeSlant=\droidsansmono@otf@slant},%
  }

  \newfontfamily{\droidsansmono}[%
    \droidsansmono@otf@features,%
    NFSSFamily=\droidsansmonofamily%
  ]{DroidSansMono}

  % Legacy compatibility
  \newfontfamily{\fdmfamily}[%
    \droidsansmono@otf@features,%
    NFSSFamily=fdm%
  ]{DroidSansMono}

  \ifdroidsansmono@defaultmono
    \setmonofont[%
      \droidsansmono@otf@features%
    ]{DroidSansMono}
  \fi
\else
  \newcommand*{\droidsansmono}{\fontfamily{\droidsansmonofamily}\selectfont}
  % Legacy compatibility
  \newcommand*{\fdmfamily}{\droidsansmono}

  \ifdroidsansmono@defaultmono
    \renewcommand*{\ttdefault}{\droidsansmonofamily}
  \fi
\fi

\endinput