summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/fontbook/fontbook.sty
blob: 2baf3681e948dd0fb560fa9f39bf6b69f8ff1210 (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
%%
%% This is file `fontbook.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fontbook.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2011 by Raphaël Pinson <raphink@gmail.com>
%% --------------------------------------------------------------------------
%% 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.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{fontbook}
    [2011/08/17 0.2 Generate a font book]
\ProvidesPackage{fontbook}
\RequirePackage{fontspec}
\RequirePackage{xunicode}
\RequirePackage{kvoptions}
\RequirePackage{etoolbox}
\SetupKeyvalOptions{
   family=fontbook,
   prefix=fontbook@,
}
%% Options
\def\fontbook@allsizes{%
 huge, LARGE, Large, large, normalsize,
 small, footnotesize, scriptsize, tiny}
\expandafter\DeclareStringOption\expandafter[\fontbook@allsizes]{sizes}
\def\fontbook@allfeatures{%
 scshape, itshape, bfseries}
\expandafter\DeclareStringOption\expandafter[\fontbook@allfeatures]{features}
\def\fontbook@defaultfeaturesize{large}
\expandafter\DeclareStringOption\expandafter[\fontbook@defaultfeaturesize]{featuresize}
\ProcessKeyvalOptions*
\def\fontbook@sampletext{%
 Dans l'affliction éphémère qui m'accable, je teste
 la police d'affichage qui est utilisée sur cette page 1 2 3 4 5.
}
\newcommand{\sampletext}[2][]{%
 {\par\csname#2\endcsname \csname#1\endcsname
 #2 #1\\ \fontbook@sampletext}}
\newcommand{\setsampletext}[1]{%
 \def\fontbook@sampletext{#1}}
\newcommand{\samplefeature}[1]{%
 \sampletext[#1]{\fontbook@featuresize}}
%% TODO: call font once
%%%% print all variants
\newcommand{\printfont}[3][\empty]{%
   \fontspec[#1]{#2}
   \section*{#2 #1 --- Licence: #3}
   \ifx#1\empty
     \addcontentsline{toc}{section}{#2}
   \else
     \addcontentsline{toc}{subsection}{#1}
   \fi
   \expandafter\forcsvlist\expandafter\sampletext\expandafter{\fontbook@sizes}
   \expandafter\forcsvlist\expandafter\samplefeature\expandafter{\fontbook@features}
   \pagebreak
}
\endinput
%%
%% End of file `fontbook.sty'.