Skip to content

Commit

Permalink
Added options for customizing Alternate Styles.
Browse files Browse the repository at this point in the history
  • Loading branch information
psb1558 committed Dec 7, 2023
1 parent d647f44 commit aa5441d
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 54 deletions.
141 changes: 102 additions & 39 deletions TeX/Junicode.sty
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,28 @@
\PackageError{Junicode}{This package works only with LuaLaTeX or XeLaTeX}{}
\fi

% Declear empty commands for Alternative styles

\newcommand{\RegularDef}{}
\newcommand{\BoldDef}{}
\newcommand{\CondDef}{}
\newcommand{\CondLightDef}{}
\newcommand{\CondMediumDef}{}
\newcommand{\ExpDef}{}
\newcommand{\ExpBoldDef}{}
\newcommand{\ExpMediumDef}{}
\newcommand{\ExpSmboldDef}{}
\newcommand{\LightDef}{}
\newcommand{\MediumDef}{}
\newcommand{\SmboldDef}{}
\newcommand{\SmCondDef}{}
\newcommand{\SmCondLightDef}{}
\newcommand{\SmCondMediumDef}{}
\newcommand{\SmExpDef}{}
\newcommand{\SmExpBoldDef}{}
\newcommand{\SmExpMediumDef}{}
\newcommand{\SmExpSmboldDef}{}

% Choose the type of font: otf or ttf.

\newcommand*{\junicode@fonttype}{otf}
Expand Down Expand Up @@ -77,6 +99,46 @@
\newif\ifjunicode@boldexpanded \junicode@boldexpandedfalse
\newif\ifjunicode@boldsemiexpanded \junicode@boldsemiexpandedfalse

% Options for Alternative styles

\DeclareOptionX{BoldFeatures}{\renewcommand*{\BoldDef}{#1,}}

\DeclareOptionX{CondFeatures}{\renewcommand*{\CondDef}{#1,}}

\DeclareOptionX{CondLightFeatures}{\renewcommand*{\CondLightDef}{#1,}}

\DeclareOptionX{CondMediumFeatures}{\renewcommand*{\CondMediumDef}{#1,}}

\DeclareOptionX{ExpFeatures}{\renewcommand*{\ExpDef}{#1,}}

\DeclareOptionX{ExpBoldDef}{\renewcommand*{\ExpBoldDef}{#1,}}

\DeclareOptionX{ExpMediumFeatures}{\renewcommand*{\ExpMediumDef}{#1,}}

\DeclareOptionX{ExpSmboldFeatures}{\renewcommand*{\ExpSmboldDef}{#1,}}

\DeclareOptionX{LightDefFeatures}{\renewcommand*{\LightDef}{#1,}}

\DeclareOptionX{MediumFeatures}{\renewcommand*{\MediumDef}{#1,}}

\DeclareOptionX{RegularFeatures}{\renewcommand*{\RegularDef}{#1,}}

\DeclareOptionX{SmboldFeatures}{\renewcommand*{\SmboldDef}{#1,}}

\DeclareOptionX{SmCondFeatures}{\renewcommand*{\SmCondDef}{#1,}}

\DeclareOptionX{SmCondLightFeatures}{\renewcommand*{\SmCondLightDef}{#1,}}

\DeclareOptionX{SmCondMediumFeatures}{\renewcommand*{\SmCondMediumDef}{#1,}}

\DeclareOptionX{SmExpFeatures}{\renewcommand*{\SmExpDef}{#1,}}

\DeclareOptionX{SmExpBoldFeatures}{\renewcommand*{\SmExpBoldDef}{#1,}}

\DeclareOptionX{SmExpMediumFeatures}{\renewcommand*{\SmExpMediumDef}{#1,}}

\DeclareOptionX{SmExpSmboldFeatures}{\renewcommand*{\SmExpSmboldDef}{#1,}}

% Declare the width options.

\DeclareOptionX{condensed}{\junicode@condensedtrue}
Expand Down Expand Up @@ -158,89 +220,90 @@
% These commands let you access any style, despite the options passed to
% this package.

\newcommand{\junicode@newfont}[2]{
\newcommand{\junicode@newfont}[3]{
\newfontface#1{#2}[
Renderer = HarfBuzz,
#3
Numbers = {\junicode@figurealign,\junicode@figurestyle},
SmallCapsFeatures = {Letters=SmallCaps},
]
}

\junicode@newfont{\jBold}{Junicode-Bold}
\junicode@newfont{\jBold}{Junicode-Bold}{\BoldDef}

\junicode@newfont{\jBoldItalic}{Junicode-BoldItalic}
\junicode@newfont{\jBoldItalic}{Junicode-BoldItalic}{\BoldDef}

\junicode@newfont{\jCond}{Junicode-Cond}
\junicode@newfont{\jCond}{Junicode-Cond}{\CondDef}

\junicode@newfont{\jCondItalic}{Junicode-CondItalic}
\junicode@newfont{\jCondItalic}{Junicode-CondItalic}{\CondDef}

\junicode@newfont{\jCondLight}{Junicode-CondLight}
\junicode@newfont{\jCondLight}{Junicode-CondLight}{\CondLightDef}

\junicode@newfont{\jCondLightItalic}{Junicode-CondLightItalic}
\junicode@newfont{\jCondLightItalic}{Junicode-CondLightItalic}{\CondLightDef}

\junicode@newfont{\jCondMedium}{Junicode-CondMedium}
\junicode@newfont{\jCondMedium}{Junicode-CondMedium}{\CondMediumDef}

\junicode@newfont{\jCondMediumItalic}{Junicode-CondMediumItalic}
\junicode@newfont{\jCondMediumItalic}{Junicode-CondMediumItalic}{\CondMediumDef}

\junicode@newfont{\jExp}{Junicode-Exp}
\junicode@newfont{\jExp}{Junicode-Exp}{\ExpDef}

\junicode@newfont{\jExpBold}{Junicode-ExpBold}
\junicode@newfont{\jExpItalic}{Junicode-ExpItalic}{\ExpDef}

\junicode@newfont{\jExpBoldItalic}{Junicode-ExpBoldItalic}
\junicode@newfont{\jExpBold}{Junicode-ExpBold}{\ExpBoldDef}

\junicode@newfont{\jExpItalic}{Junicode-ExpItalic}
\junicode@newfont{\jExpBoldItalic}{Junicode-ExpBoldItalic}{\ExpBoldDef}

\junicode@newfont{\jExpMedium}{Junicode-ExpMedium}
\junicode@newfont{\jExpMedium}{Junicode-ExpMedium}{\ExpMediumDef}

\junicode@newfont{\jExpMediumItalic}{Junicode-ExpMediumItalic}
\junicode@newfont{\jExpMediumItalic}{Junicode-ExpMediumItalic}{\ExpMediumDef}

\junicode@newfont{\jExpSmbold}{Junicode-ExpSmbold}
\junicode@newfont{\jExpSmbold}{Junicode-ExpSmbold}{\ExpSmboldDef}

\junicode@newfont{\jExpSmboldItalic}{Junicode-ExpSmboldItalic}
\junicode@newfont{\jExpSmboldItalic}{Junicode-ExpSmboldItalic}{\ExpSmboldDef}

\junicode@newfont{\jItalic}{Junicode-Italic}
\junicode@newfont{\jRegular}{Junicode-Regular}{\RegularDef}

\junicode@newfont{\jLight}{Junicode-Light}
\junicode@newfont{\jItalic}{Junicode-Italic}{\RegularDef}

\junicode@newfont{\jLightItalic}{Junicode-LightItalic}
\junicode@newfont{\jLight}{Junicode-Light}{\LightDef}

\junicode@newfont{\jMedium}{Junicode-Medium}
\junicode@newfont{\jLightItalic}{Junicode-LightItalic}{\LightDef}

\junicode@newfont{\jMediumItalic}{Junicode-MediumItalic}
\junicode@newfont{\jMedium}{Junicode-Medium}{\MediumDef}

\junicode@newfont{\jRegular}{Junicode-Regular}
\junicode@newfont{\jMediumItalic}{Junicode-MediumItalic}{\MediumDef}

\junicode@newfont{\jSmbold}{Junicode-Smbold}
\junicode@newfont{\jSmbold}{Junicode-Smbold}{\SmboldDef}

\junicode@newfont{\jSmboldItalic}{Junicode-SmboldItalic}
\junicode@newfont{\jSmboldItalic}{Junicode-SmboldItalic}{\SmboldDef}

\junicode@newfont{\jSmCond}{Junicode-SmCond}
\junicode@newfont{\jSmCond}{Junicode-SmCond}{\SmCondDef}

\junicode@newfont{\jSmCondItalic}{Junicode-SmCondItalic}
\junicode@newfont{\jSmCondItalic}{Junicode-SmCondItalic}{\SmCondDef}

\junicode@newfont{\jSmCondLight}{Junicode-SmCondLight}
\junicode@newfont{\jSmCondLight}{Junicode-SmCondLight}{\SmCondLightDef}

\junicode@newfont{\jSmCondLightItalic}{Junicode-SmCondLightItalic}
\junicode@newfont{\jSmCondLightItalic}{Junicode-SmCondLightItalic}{\SmCondLightDef}

\junicode@newfont{\jSmCondMedium}{Junicode-SmCondMedium}
\junicode@newfont{\jSmCondMedium}{Junicode-SmCondMedium}{\SmCondMediumDef}

\junicode@newfont{\jSmCondMediumItalic}{Junicode-SmCondMediumItalic}
\junicode@newfont{\jSmCondMediumItalic}{Junicode-SmCondMediumItalic}{\SmCondMediumDef}

\junicode@newfont{\jSmExp}{Junicode-SmExp}
\junicode@newfont{\jSmExp}{Junicode-SmExp}{\SmExpDef}

\junicode@newfont{\jSmExpBold}{Junicode-SmExpBold}
\junicode@newfont{\jSmExpItalic}{Junicode-SmExpItalic}{\SmExpDef}

\junicode@newfont{\jSmExpBoldItalic}{Junicode-SmExpBoldItalic}
\junicode@newfont{\jSmExpBold}{Junicode-SmExpBold}{\SmExpBoldDef}

\junicode@newfont{\jSmExpItalic}{Junicode-SmExpItalic}
\junicode@newfont{\jSmExpBoldItalic}{Junicode-SmExpBoldItalic}{\SmExpBoldDef}

\junicode@newfont{\jSmExpMedium}{Junicode-SmExpMedium}
\junicode@newfont{\jSmExpMedium}{Junicode-SmExpMedium}{\SmExpDef}{\SmExpMediumDef}

\junicode@newfont{\jSmExpMediumItalic}{Junicode-SmExpMediumItalic}
\junicode@newfont{\jSmExpMediumItalic}{Junicode-SmExpMediumItalic}{\SmExpMediumDef}

\junicode@newfont{\jSmExpSmbold}{Junicode-SmExpSmbold}
\junicode@newfont{\jSmExpSmbold}{Junicode-SmExpSmbold}{\SmExpSmboldDef}

\junicode@newfont{\jSmExpSmboldItalic}{Junicode-SmExpSmboldItalic}
\junicode@newfont{\jSmExpSmboldItalic}{Junicode-SmExpSmboldItalic}{\SmExpSmboldDef}

% Convenience commands for non-verbose access to the cvNN features.
% See also the "jcv" mnemonics below.
Expand Down
Binary file modified TeX/junicode-package.pdf
Binary file not shown.
63 changes: 48 additions & 15 deletions TeX/junicode-package.tex
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
\documentclass{article}
\usepackage[medium,semiexpanded]{Junicode}
\usepackage[
medium,
semiexpanded,
SmExpSmboldFeatures={
Language=English,
StylisticSet=8
}
]{Junicode}
\usepackage{microtype}
\usepackage{multicol}
\usepackage{supertabular}
\setmonofont{SourceCodePro-Regular}[Scale=MatchLowercase,Numbers=Lowercase]
\linespread{1.1}
\tolerance=1500
\title{Junicode}
\author{Peter S. Baker}
\date{}
Expand All @@ -21,13 +30,13 @@ \section{Introduction}

\section{Loading Junicode}

Load Junicode in the usual way, with {\small\verb|\usepackage{Junicode}|}. Several options are available:
Load Junicode in the usual way, with {\verb|\usepackage{Junicode}|}. Several options are available:

\begin{description}
\item[fonttype] The type of font to look for, CFF or TrueType. These font types differ in the
way they draw outlines, and their hinting technologies are very different. Values may be otf
(the default) or ttf, e.g.\\
\hspace*{1in}{\small\verb|\usepackage[fonttype=ttf]{Junicode}|}
\hspace*{1in}{\verb|\usepackage[fonttype=ttf]{Junicode}|}
\item[light] The weight of the type for the main text is Light instead of Regular.
\item[medium] The weight of the type for the main text is Medium, somewhat heavier than Regular.
\item[semibold] The weight of bold type is somewhat lighter than the usual bold. This may be a
Expand All @@ -46,6 +55,7 @@ \section{Loading Junicode}
\item[tabular] Numbers will be tabular or monospaced.
\item[oldstyle] Numbers will be old-style, harmonizing with lowercase letters.
\item[lining] Numbers will be lining, harmonizing with uppercase letters.
\item[style options] These will be discussed in the next section.
\end{description}

\section{Selecting Alternate Styles}
Expand Down Expand Up @@ -132,19 +142,42 @@ \section{Selecting Alternate Styles}
\textbackslash jSmExpSmboldItalic
\end{multicols}

\noindent You can customize these styles by passing options when you load the package.
The name of each option is based on the corresponding stylename, but without the
prefixed “j” or any suffixed “Italic” (since each of these options
affects both the roman and the matching italic face), and with “Features” suffixed.
The content of the option must be one or more of the fontspec features appropriate to
Junicode. For example, this is the {\verb|\usepackage|} command from the preamble to
this document:

\begin{verbatim}
\usepackage[
medium,
semiexpanded,
SmExpSmboldFeatures={
Language=English,
StylisticSet=8
}
]{Junicode}
\end{verbatim}

\noindent After the options for setting the main text, the \textbf{SmExpSmboldFeatures}
option sets the language to English and turns on Stylistic Set 8 (“Contextual Long s”)
for the SemiExpanded Semibold face:
{\jSmExpSmbold \textcv[4]{\jcvf}{self\char"200Clessness}}.

\section{Other Commands}

These commands do nothing more than wrap fontspec commands, which can still be
used with the Junicode package and are actually needed if you want to take full
advantage of the Junicode font’s features. Some of these commands are more mnemonic
than the corresponding fontspec commands, and others are more compact. Each command
This package's other commands are offered as conveniences---shorter and more
mnemonic than the fontspec commands they invoke (though of course all fontspec commands
remain available). Each of these commands
also has a corresponding “text” command that works like
{\small\verb|\textit{}|}—that is, it takes
{\verb|\textit{}|}—that is, it takes
as its sole argument the text to which the command will be applied. Each “text” command
consists of the main command with “text” prefixed—for example,
{\small\verb|\textInsularLetterForms{}|}
corresponding to {\small\verb|\InsularLetterForms|}. For a fuller account of the OpenType features
applied by these commands, see Chapter 4, Feature Reference.
{\verb|\textInsularLetterForms{}|}
corresponding to {\verb|\InsularLetterForms|}. For a fuller account of the OpenType features
applied by these commands, see Chapter 4 of the \textit{Junicode Manual}, “Feature Reference.

\begin{center}
\tablehead{\hline}
Expand All @@ -159,7 +192,7 @@ \section{Other Commands}
\textbackslash EnlargedMinuscules & Applies ss06, Enlarged minuscules.\\\hline
\textbackslash Underdotted & Applies ss07, Underdotted.\\\hline
\textbackslash ContextualLongS & Applies ss08, Contextual long s. This should be used only in English or
French text. With other languages it simply converts all instances of s to ſ.\\\hline
French text. With other languages it converts all instances of s to ſ.\\\hline
\textbackslash AlternateFigures & Applies ss09, Alternate Figures.\\\hline
\textbackslash EntitiesAndTags & Applies ss10, Entities and Tags.\\\hline
\textbackslash EarlyEnglishFuthorc & Applies ss12, Early English Futhorc.\\\hline
Expand All @@ -176,13 +209,13 @@ \section{Other Commands}
\end{center}

\noindent The syntax of \textbackslash jcv
is {\small\verb|\jcv[num]{num}|}, where the second (required) argument is the number of the Character Variant feature,
is {\verb|\jcv[num]{num}|}, where the second (required) argument is the number of the Character Variant feature,
and the first (optional) argument is an index into the variants provided by that feature (starting with zero, the default).
\textbackslash textcv takes an additional required argument ({\small\verb|\textcv[num]{num}{text}|}—the text to which the
\textbackslash textcv takes an additional required argument ({\verb|\textcv[num]{num}{text}|}—the text to which the
feature should be applied.

Character Variant features can also be selected with mnemonics, listed below. For example, a feature for
lowercase \textbf{a} can be expressed as {\small\verb|\textcv[2]{\jcva}{a}|}, yielding \textbf{\textcv[2]{\jcva}{a}}.
lowercase \textbf{a} can be expressed as {\verb|\textcv[2]{\jcva}{a}|}, yielding \textbf{\textcv[2]{\jcva}{a}}.

\begin{multicols}{3}
\jCond\textbackslash jcvA
Expand Down

0 comments on commit aa5441d

Please sign in to comment.