Skip to content

Commit

Permalink
Merge pull request #75 from benwebber/refactor/font
Browse files Browse the repository at this point in the history
Abstract font definitions
  • Loading branch information
BrianCriswell authored Oct 9, 2017
2 parents 7588191 + d6956fa commit 1221f68
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 37 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

* Deprecated `dnditemtable`.
* Deprecated `bg-a4` and `bg-letter` package options.
* Deprecated `lmss` environment.

## [0.5] - 2016-03-24

Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,12 @@ Load the template in your preamble:

### Package options

| Option | Description | Default |
|-------------|-------------------------------------------------------------------|:-------:|
| `bg-letter` | Loads a letter-sized background image ||
| `bg-a4` | Loads an A4-sized background image | |
| `bg-print` | Loads a printer-friendly background-image (only the footer image) | |
| `bg-full` | Loads the full background image ||
| `justified` | Justifies column copy | |
| Option | Description | Default |
|-------------|-------------------------------------------|:-------:|
| `bg-full` | Loads both background and footer images ||
| `bg-none` | Removes both background and footer images | |
| `bg-print` | Loads only the footer image | |
| `justified` | Justifies column copy | |

## Dependencies

Expand Down
8 changes: 5 additions & 3 deletions dnd.sty
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
bottom=50pt, % .7in
footskip=30pt, % makes the footer text line up with the graphic
]{geometry}
\RequirePackage{bookman} % Closest built-in font I could find
\RequirePackage[T1]{fontenc}
\RequirePackage[table]{xcolor}
\RequirePackage{array}
\RequirePackage{tabularx}
Expand All @@ -37,6 +35,7 @@

% Load other modules of this package
\RequirePackage{lib/dndcolors} % color definitions
\RequirePackage{lib/dndfonts} % font definitions
\RequirePackage{lib/dndcomment} % \commentbox definition
\RequirePackage{lib/dndheader} % fancy headers and footers
\RequirePackage{lib/dndmonster} % \monsterbox definition
Expand Down Expand Up @@ -86,7 +85,10 @@
\setlength{\parskip}{0pt}

% Font environment
\newenvironment{lmss}{\fontfamily{lmss}\selectfont}{}
\newenvironment{lmss}{%
\dnd@deprecate{lmss}{0.7}
\fontfamily{lmss}\selectfont
}{}

% Columns setup
\setlength{\columnsep}{25pt} % .35in
Expand Down
4 changes: 2 additions & 2 deletions lib/dndcomment.sty
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
left=8pt,
right=8pt,
arc=0mm,
fonttitle=\fontfamily{fosj}\selectfont\scshape\bfseries\color{black},
fontupper=\fontfamily{lmss}\selectfont,
fonttitle=\dnd@BoxTitleFont\color{black},
fontupper=\dnd@BoxBodyFont,
title={#2},
parbox=false,
colback={#3},
Expand Down
19 changes: 19 additions & 0 deletions lib/dndfonts.sty
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
\RequirePackage{bookman}
\RequirePackage[T1]{fontenc}

\renewcommand{\sfdefault}{lmss}

\newcommand{\dnd@TitleFont}{\normalfont\scshape}

\newcommand{\dnd@TableTitleFont}{\fontfamily{fosj}\selectfont\bfseries\scshape}
\newcommand{\dnd@TableBodyFont}{\sffamily}

\newcommand{\dnd@BoxTitleFont}{\fontfamily{fosj}\selectfont\bfseries\scshape}
\newcommand{\dnd@BoxBodyFont}{\sffamily}

\newcommand{\dnd@StatBlockTitleFont}{\normalfont\bfseries\scshape}
\newcommand{\dnd@StatBlockSubtitleFont}{\fontfamily{fosj}\selectfont\scshape}
\newcommand{\dnd@StatBlockBodyFont}{\sffamily}

\newcommand{\dnd@FooterFont}{\normalfont\scshape}
\newcommand{\dnd@PageNumberFont}{\normalfont}
12 changes: 6 additions & 6 deletions lib/dndheader.sty
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
\iftoggle{bool-footer-scroll}{
\begin{tikzpicture}[remember picture,overlay]
\node[xscale=-1,inner sep=0pt,anchor=south,nearly opaque] at (current page.south) {\includegraphics[width=\paperwidth,height=43pt]{img/footerscroll}};
\node[xshift=20pt,yshift=30pt] at (current page.south west) {\textcolor{pagegold}{\thepage}};
\node[anchor=south west,xshift=\marginparwidth+\marginparpush,yshift=27pt] at (current page.south west) {\textsc{\textcolor{pagegold}{\nouppercase\leftmark}}};
\node[xshift=20pt,yshift=30pt] at (current page.south west) {\dnd@PageNumberFont\textcolor{pagegold}{\thepage}};
\node[anchor=south west,xshift=\marginparwidth+\marginparpush,yshift=27pt] at (current page.south west) {\dnd@FooterFont{\textcolor{pagegold}{\nouppercase\leftmark}}};
\end{tikzpicture}
}{
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=south west,xshift=\marginparwidth-\marginparpush,yshift=\nobgfooterheight+2pt] at (current page.south west) {\textbf{\thepage}};
\node[anchor=south west,xshift=\marginparwidth-\marginparpush,yshift=\nobgfooterheight+2pt] at (current page.south west) {\dnd@PageNumberFont{\thepage}};
\node[anchor=south west,xshift=\marginparwidth+\marginparpush,yshift=\nobgfooterheight] at (current page.south west) {\leftmark};
\end{tikzpicture}
}
Expand All @@ -44,12 +44,12 @@
\iftoggle{bool-footer-scroll}{
\begin{tikzpicture}[remember picture,overlay]
\node[inner sep=0pt,anchor=south,nearly opaque] at (current page.south) {\includegraphics[width=\paperwidth,height=43pt]{img/footerscroll}};
\node[xshift=-20pt,yshift=30pt] at (current page.south east) {\textcolor{pagegold}{\thepage}};
\node[anchor=south east,xshift=-\marginparwidth-\marginparpush,yshift=27pt] at (current page.south east) {\textsc{\textcolor{pagegold}{\nouppercase\leftmark}}};
\node[xshift=-20pt,yshift=30pt] at (current page.south east) {\dnd@PageNumberFont\textcolor{pagegold}{\thepage}};
\node[anchor=south east,xshift=-\marginparwidth-\marginparpush,yshift=27pt] at (current page.south east) {\dnd@FooterFont{\textcolor{pagegold}{\nouppercase\leftmark}}};
\end{tikzpicture}
}{
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=south east,xshift=-\marginparwidth+2\marginparpush,yshift=\nobgfooterheight+2pt] at (current page.south east) {\textbf{\thepage}};
\node[anchor=south east,xshift=-\marginparwidth+2\marginparpush,yshift=\nobgfooterheight+2pt] at (current page.south east) {\dnd@PageNumberFont{\thepage}};
\node[anchor=south east,xshift=-\marginparwidth,yshift=\nobgfooterheight] at (current page.south east) {\leftmark};
\end{tikzpicture}
}
Expand Down
13 changes: 5 additions & 8 deletions lib/dndmonster.sty
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
arc=0mm,
opacityback=0,
colframe=titlered,
fonttitle=\scshape\bfseries\color{titlered}\Large,
fontupper=\fontfamily{lmss}\selectfont,
fonttitle=\dnd@StatBlockTitleFont\color{titlered}\Large,
fontupper=\dnd@StatBlockBodyFont,
title=#2,
after={\vspace{7pt plus 1pt}\noindent},
#1
Expand All @@ -76,8 +76,8 @@
colback=statblockbg,
colbacktitle=statblockbg,
colframe=titlered,
fonttitle=\scshape\bfseries\color{titlered}\Large,
fontupper=\fontfamily{lmss}\selectfont,
fonttitle=\dnd@StatBlockTitleFont\color{titlered}\Large,
fontupper=\dnd@StatBlockBodyFont,
title=#2,
after={\vspace{7pt plus 1pt}\noindent},
#1
Expand All @@ -88,13 +88,10 @@
%\newcommand{\monstersection}[1]{\subsubsection*{#1}}
\newcommand{\monstersection}[1]{
{\par
\color{titlered}\normalfont\scshape\Large #1 \vspace{3pt}
\color{titlered}\dnd@StatBlockSubtitleFont\large #1 \vspace{3pt}
\titleline{\color{titlered}\titlerule[0.6pt]}
\par\medskip}
}
%\titlespacing*{\subsubsection}{0pt}{*0.5}{5pt}
%\titleformat{\subsubsection}
%{\color{titlered}\normalfont\scshape\Large}{\thesubsection}{1em}{}[{\color{titlered}\titlerule[0.5pt]\color{black}}]

\newenvironment{monsteraction}[1][\unskip]{\emph{\textbf{#1.}}}{\vspace{0.5em}}

Expand Down
4 changes: 2 additions & 2 deletions lib/dndpaperbox.sty
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
boxsep=0.25ex,
left=8pt,
right=8pt,
fonttitle=\fontfamily{fosj}\selectfont\scshape\bfseries\color{black},
fontupper=\fontfamily{lmss}\selectfont,
fonttitle=\dnd@BoxTitleFont\color{black},
fontupper=\dnd@BoxBodyFont,
title={#2},
arc=0mm,
parbox=false,
Expand Down
2 changes: 1 addition & 1 deletion lib/dndquote.sty
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
parbox=false,
borderline west={1pt}{-0.5pt}{titlered},
borderline east={1pt}{-0.5pt}{titlered},
fontupper=\fontfamily{lmss}\selectfont,
fontupper=\dnd@BoxBodyFont,
overlay={%
\foreach\n in {north east,north west,south east,south west}
{\draw[titlered, fill=titlered] (frame.\n) circle (2pt); }; },
Expand Down
10 changes: 5 additions & 5 deletions lib/dndsections.sty
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@

% Chapter
\titleformat{\chapter}
{\color{titlered}\normalfont\scshape\Huge}{\thechapter\quad}{0pt}{}
{\color{titlered}\dnd@TitleFont\Huge}{\thechapter\quad}{0pt}{}

\titlespacing*{\chapter}{0pt}{0pt}{20pt}

\renewcommand\cftchapfont{\color{titlered}\bfseries\scshape}
\renewcommand\cftchapfont{\color{titlered}\dnd@TitleFont\bfseries}

% Section
\titleformat{\section}
{\color{titlered}\normalfont\scshape\LARGE}{\thesection\quad}{0pt}{}
{\color{titlered}\dnd@TitleFont\LARGE}{\thesection\quad}{0pt}{}

% Subsection
\titleformat{\subsection}
{\color{titlered}\normalfont\scshape\Large}{\thesubsection\quad}{0pt}{}
{\color{titlered}\dnd@TitleFont\Large}{\thesubsection\quad}{0pt}{}
[\titleline{\color{titlegold}\titlerule[1pt]}]

% Subsubsection
\titleformat{\subsubsection}
{\color{titlered}\normalfont\scshape\large}{\thesubsubsection\quad}{0pt}{}[]
{\color{titlered}\dnd@TitleFont\large}{\thesubsubsection\quad}{0pt}{}[]

% Paragraph
\titleformat{\paragraph}[runin]
Expand Down
6 changes: 3 additions & 3 deletions lib/dndtable.sty
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
\newcommand{\header}[1]{{
\par\vspace*{8pt}
\noindent
\sffamily\bfseries\scshape
\dnd@TableTitleFont
#1}}

% Centered Column
Expand All @@ -12,7 +12,7 @@
\NewDocumentEnvironment{dndtable}{O{XX} O{tablecolor}}{%
\par\vspace*{8pt}
\noindent
\fontfamily{lmss}\selectfont
\dnd@TableBodyFont
\rowcolors{1}{}{#2}
\tabularx{\linewidth}{#1}
}{%
Expand All @@ -25,7 +25,7 @@
\dnd@deprecate{dnditemtable}{0.7}[Set tablecolor and use dndtable instead.]
\par\vspace*{8pt}
\noindent
\fontfamily{lmss}\selectfont
\dnd@TableBodyFont
\rowcolors{1}{}{DmgCoral}
\tabularx{\linewidth}{#1}
}{%
Expand Down

0 comments on commit 1221f68

Please sign in to comment.