| 1 |
% !TeX TXS-program:compile = txs:///arara |
| 2 |
% arara: lualatex: {shell: no, synctex: no, interaction: batchmode} |
| 3 |
|
| 4 |
\documentclass{article} |
| 5 |
\usepackage[margin=0.75in]{geometry} |
| 6 |
\usepackage{cascadiamono-otf} |
| 7 |
\usepackage{listings} |
| 8 |
\usepackage{xcolor} |
| 9 |
\setlength{\parindent}{0pt} |
| 10 |
|
| 11 |
\newcommand\demotext{For \textsterling 45, almost anything can be found floating in fields.\\ |
| 12 |
!`THE DAZED BROWN FOX QUICKLY GAVE 12345--67890 JUMPS!\\ |
| 13 |
--- ?`But aren't Kafka's Schlo\ss{} and \AE sop's \OE uvres often na\"\i ve vis-\`a-vis the d\ae monic ph\oe nix's official r\^ole in fluffy souffl\'es? |
| 14 |
} |
| 15 |
|
| 16 |
\newcommand\samplettxt{oO08 iIlL1 g9qCGQ <=>} |
| 17 |
\newcommand\samplett[1][]{#1\samplettxt} |
| 18 |
\newcommand\samplettit[1][]{\textit{#1\samplettxt}} |
| 19 |
\newcommand\samplettbf[1][]{\textbf{#1\samplettxt}} |
| 20 |
\newcommand\samplettbfit[1][]{\textbf{\textit{#1\samplettxt}}} |
| 21 |
\newcommand\sampletttbl[1][]{& \samplett[#1] & \samplettit[#1] & \samplettbf[#1] & \samplettbfit[#1]} |
| 22 |
|
| 23 |
\begin{document} |
| 24 |
|
| 25 |
\part*{cascadiamono-otf (v 0.3)} |
| 26 |
|
| 27 |
\section{Usages} |
| 28 |
|
| 29 |
With \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|\usepackage{fontspec}| (so with \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|XeTeX| or \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|LuaLaTeX| compilation), you can use \texttt{CascadiaCode} fonts, and \textit{remove} ligature's features, in order to use (in fact) \texttt{CascadiaMono} fonts. |
| 30 |
|
| 31 |
\smallskip |
| 32 |
|
| 33 |
Following OpenType fonts are supported (it's based on \texttt{CascadiaCode} without the ligatures) : |
| 34 |
|
| 35 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 36 |
CascadiaCode-Bold.otf CascadiaCode-BoldItalic.otf |
| 37 |
CascadiaCode-ExtraLight.otf CascadiaCode-ExtraLightItalic.otf |
| 38 |
CascadiaCode-Italic.otf CascadiaCode-Light.otf |
| 39 |
CascadiaCode-LightItalic.otf CascadiaCode-Regular.otf |
| 40 |
CascadiaCode-SemiBold.otf CascadiaCode-SemiBoldItalic.otf |
| 41 |
CascadiaCode-SemiLight.otf CascadiaCode-SemiLightItalic.otf |
| 42 |
\end{lstlisting} |
| 43 |
|
| 44 |
\section{The default settings} |
| 45 |
|
| 46 |
The \texttt{fontspec} config for the \textit{normal} version : |
| 47 |
|
| 48 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 49 |
\defaultfontfeatures[CascadiaMono] |
| 50 |
{Extension=.otf, |
| 51 |
UprightFont=CascadiaCode-Regular, |
| 52 |
ItalicFont=CascadiaCode-Italic, |
| 53 |
BoldFont=CascadiaCode-Bold, |
| 54 |
BoldItalicFont=CascadiaCode-BoldItalic, |
| 55 |
Contextuals=AlternateOff} |
| 56 |
\end{lstlisting} |
| 57 |
|
| 58 |
The \texttt{fontspec} config for the other versions are : |
| 59 |
|
| 60 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 61 |
\defaultfontfeatures[CascadiaMono-Light] |
| 62 |
{Extension=.otf, |
| 63 |
UprightFont=CascadiaCode-Light, |
| 64 |
ItalicFont=CascadiaCode-LightItalic, |
| 65 |
BoldFont=CascadiaCode-Regular, |
| 66 |
BoldItalicFont=CascadiaCode-Italic, |
| 67 |
Contextuals=AlternateOff} |
| 68 |
\end{lstlisting} |
| 69 |
|
| 70 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 71 |
\defaultfontfeatures[CascadiaMono-SemiLight] |
| 72 |
{Extension=.otf, |
| 73 |
UprightFont=CascadiaCode-SemiLight, |
| 74 |
ItalicFont=CascadiaCode-SemiLightItalic, |
| 75 |
BoldFont=CascadiaCode-SemiBold, |
| 76 |
BoldItalicFont=CascadiaCode-SemiBoldItalic, |
| 77 |
Contextuals=AlternateOff} |
| 78 |
\end{lstlisting} |
| 79 |
|
| 80 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 81 |
\defaultfontfeatures[CascadiaMono-ExtraLight] |
| 82 |
{Extension=.otf, |
| 83 |
UprightFont=CascadiaCode-ExtraLight, |
| 84 |
ItalicFont=CascadiaCode-ExtraLightItalic, |
| 85 |
BoldFont=CascadiaCode-SemiLight, |
| 86 |
BoldItalicFont=CascadiaCode-SemiLightItalic, |
| 87 |
Contextuals=AlternateOff} |
| 88 |
\end{lstlisting} |
| 89 |
|
| 90 |
It's possible to use ligatures with \texttt{Code} alias, instead of \texttt{Mono}. |
| 91 |
|
| 92 |
\pagebreak |
| 93 |
|
| 94 |
\subsection{With config files} |
| 95 |
|
| 96 |
The idea is to propose \texttt{fontspec} config files to load correctly \texttt{CascadiaMono} features. |
| 97 |
|
| 98 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 99 |
\usepackage{fontspec} |
| 100 |
%w/o ligatures |
| 101 |
\setmonofont{CascadiaMono}[options] %version regular |
| 102 |
\setmonofont{CascadiaMono-SemiLight}[options] %version semilight |
| 103 |
\setmonofont{CascadiaMono-Light}[options] %version light |
| 104 |
\setmonofont{CascadiaMono-ExtraLight}[options] %version extralight |
| 105 |
%w ligatures |
| 106 |
\setmonofont{cascadiacode}[options] %version regular |
| 107 |
\setmonofont{cascadiacode-semilight}[options] %version semilight |
| 108 |
\setmonofont{cascadiacode-light}[options] %version light |
| 109 |
\setmonofont{cascadiacode-extralight}[options] %version extralight |
| 110 |
\end{lstlisting} |
| 111 |
|
| 112 |
\subsection{With the package loading} |
| 113 |
|
| 114 |
With \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|\usepackage[scale=...]{cascadiamono-otf}|, \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|fontspec| is loaded, and \lstinline[language={[latex]TeX},basicstyle=\ttfamily]|fontfamily| are defined : |
| 115 |
|
| 116 |
\begin{lstlisting}[language={[latex]TeX},basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\color{magenta},tabsize=4,frame=single] |
| 117 |
%w/o ligatures |
| 118 |
\newfontfamily\cascadiamono{CascadiaMono} |
| 119 |
\newfontfamily\cascadiamonosemilight{CascadiaMono-SemiLight} |
| 120 |
\newfontfamily\cascadiamonolight{CascadiaMono-Light} |
| 121 |
\newfontfamily\cascadiamonoextralight{CascadiaMono-ExtraLight} |
| 122 |
%w ligatures |
| 123 |
\newfontfamily\cascadiacode{cascadiacode} |
| 124 |
\newfontfamily\cascadiacodesemilight{cascadiacode-semilight} |
| 125 |
\newfontfamily\cascadiacodelight{cascadiacode-light} |
| 126 |
\newfontfamily\cascadiacodeextralight{cascadiacode-extralight} |
| 127 |
\end{lstlisting} |
| 128 |
|
| 129 |
\section{Font Samples} |
| 130 |
|
| 131 |
\subsection{Normal version (Regular - Italic - Bold - BoldItalic)} |
| 132 |
|
| 133 |
\setmonofont{CascadiaMono}[Scale=MatchLowercase] |
| 134 |
|
| 135 |
\texttt{\demotext}\par\bigskip |
| 136 |
|
| 137 |
\texttt{\textit{\demotext}}\par\bigskip |
| 138 |
|
| 139 |
\texttt{\textbf{\demotext}}\par\bigskip |
| 140 |
|
| 141 |
\texttt{\textbf{\textit{\demotext}}}\par |
| 142 |
|
| 143 |
\subsection{SemiLight version (SemiLight - SemiLightItalic - SemiBold - SemiBoldItalic)} |
| 144 |
|
| 145 |
\setmonofont{CascadiaMono-SemiLight}[Scale=MatchLowercase] |
| 146 |
|
| 147 |
\texttt{\demotext}\par\bigskip |
| 148 |
|
| 149 |
\texttt{\itshape\demotext}\par\bigskip |
| 150 |
|
| 151 |
\texttt{\bfseries\demotext}\par\bigskip |
| 152 |
|
| 153 |
\texttt{\bfseries\itshape\demotext}\par |
| 154 |
|
| 155 |
\subsection{Light version (Light - LightItalic - Regular - Italic)} |
| 156 |
|
| 157 |
\setmonofont{CascadiaMono-Light}[Scale=MatchLowercase] |
| 158 |
|
| 159 |
\texttt{\demotext}\par\bigskip |
| 160 |
|
| 161 |
\texttt{\itshape\demotext}\par\bigskip |
| 162 |
|
| 163 |
\texttt{\bfseries\demotext}\par\bigskip |
| 164 |
|
| 165 |
\texttt{\bfseries\itshape\demotext}\par |
| 166 |
|
| 167 |
\subsection{ExtraLight version (ExtraLight - ExtraLightItalic - SemiLightItalic - SemiLightItalic)} |
| 168 |
|
| 169 |
\setmonofont{CascadiaMono-ExtraLight}[Scale=MatchLowercase] |
| 170 |
|
| 171 |
\texttt{\demotext}\par\bigskip |
| 172 |
|
| 173 |
\texttt{\itshape\demotext}\par\bigskip |
| 174 |
|
| 175 |
\texttt{\bfseries\demotext}\par\bigskip |
| 176 |
|
| 177 |
\texttt{\bfseries\itshape\demotext}\par |
| 178 |
|
| 179 |
\pagebreak |
| 180 |
|
| 181 |
\section{Simple code samples} |
| 182 |
|
| 183 |
\setmonofont{CMU Typewriter Text}[Scale=MatchLowercase] |
| 184 |
|
| 185 |
\noindent{\small \begin{tabular}{lllll} |
| 186 |
\hline |
| 187 |
Type & Normal & Italic & Bold & BoldItalic \\ \hline |
| 188 |
ttdefault \sampletttbl[\ttfamily] \\ \hline |
| 189 |
Cmonoregular \sampletttbl[\cascadiamono]\\ \hline |
| 190 |
Cmonosemilight \sampletttbl[\cascadiamonosemilight] \\ \hline |
| 191 |
Cmonolight \sampletttbl[\cascadiamonolight] \\ \hline |
| 192 |
Cmonoextralight \sampletttbl[\cascadiamonoextralight]\\ \hline |
| 193 |
Ccoderegular \sampletttbl[\cascadiacode]\\ \hline |
| 194 |
Ccodesemilight \sampletttbl[\cascadiacodesemilight] \\ \hline |
| 195 |
Ccodelight \sampletttbl[\cascadiacodelight] \\ \hline |
| 196 |
Ccodeextralight \sampletttbl[\cascadiacodeextralight]\\ \hline |
| 197 |
\end{tabular}} |
| 198 |
|
| 199 |
\section{Algorithm samples, without ligatures} |
| 200 |
|
| 201 |
\subsection{Normal version} |
| 202 |
|
| 203 |
\setmonofont{CascadiaMono}[Scale=MatchLowercase] |
| 204 |
|
| 205 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single] |
| 206 |
def Fibonacci(n) : |
| 207 |
# Check if input is 0 then it will print incorrect input |
| 208 |
if n < 0 : |
| 209 |
print("Incorrect input") |
| 210 |
elif n == 0 : |
| 211 |
return 0 |
| 212 |
elif n == 1 or n == 2 : |
| 213 |
return 1 |
| 214 |
else : |
| 215 |
return Fibonacci(n-1) + Fibonacci(n-2) |
| 216 |
\end{lstlisting} |
| 217 |
|
| 218 |
\subsection{SemiLight version} |
| 219 |
|
| 220 |
\setmonofont{CascadiaMono-SemiLight}[Scale=MatchLowercase] |
| 221 |
|
| 222 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single] |
| 223 |
def Fibonacci(n) : |
| 224 |
# Check if input is 0 then it will print incorrect input |
| 225 |
if n < 0 : |
| 226 |
print("Incorrect input") |
| 227 |
elif n == 0 : |
| 228 |
return 0 |
| 229 |
elif n == 1 or n == 2 : |
| 230 |
return 1 |
| 231 |
else : |
| 232 |
return Fibonacci(n-1) + Fibonacci(n-2) |
| 233 |
\end{lstlisting} |
| 234 |
|
| 235 |
\subsection{Light version} |
| 236 |
|
| 237 |
\setmonofont{CascadiaMono-Light}[Scale=MatchLowercase] |
| 238 |
|
| 239 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single] |
| 240 |
def Fibonacci(n) : |
| 241 |
# Check if input is 0 then it will print incorrect input |
| 242 |
if n < 0 : |
| 243 |
print("Incorrect input") |
| 244 |
elif n == 0 : |
| 245 |
return 0 |
| 246 |
elif n == 1 or n == 2 : |
| 247 |
return 1 |
| 248 |
else : |
| 249 |
return Fibonacci(n-1) + Fibonacci(n-2) |
| 250 |
\end{lstlisting} |
| 251 |
|
| 252 |
\subsection{ExtraLight version} |
| 253 |
|
| 254 |
\setmonofont{CascadiaMono-ExtraLight}[Scale=MatchLowercase] |
| 255 |
|
| 256 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\ttfamily,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single] |
| 257 |
def Fibonacci(n) : |
| 258 |
# Check if input is 0 then it will print incorrect input |
| 259 |
if n < 0 : |
| 260 |
print("Incorrect input") |
| 261 |
elif n == 0 : |
| 262 |
return 0 |
| 263 |
elif n == 1 or n == 2 : |
| 264 |
return 1 |
| 265 |
else : |
| 266 |
return Fibonacci(n-1) + Fibonacci(n-2) |
| 267 |
\end{lstlisting} |
| 268 |
|
| 269 |
\pagebreak |
| 270 |
|
| 271 |
\section{Algorithm code, with ligatures} |
| 272 |
|
| 273 |
\setmonofont{CMU Typewriter Text}[Scale=MatchLowercase] |
| 274 |
|
| 275 |
Regular version of the fonts, with ligatures enable, can be uses with \texttt{code} alias (\lstinline[language={[latex]TeX},basicstyle=\ttfamily]|\cascadiacode|). |
| 276 |
|
| 277 |
\makeatletter |
| 278 |
\renewcommand*\verbatim@nolig@list{} |
| 279 |
\makeatother |
| 280 |
|
| 281 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\cascadiacode,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single,columns=flexible,showstringspaces=false] |
| 282 |
\lstset{ |
| 283 |
language=python, |
| 284 |
basicstyle=\footnotesize\cascadiacode, |
| 285 |
commentstyle=\itshape\color{gray}, |
| 286 |
keywordstyle=\bfseries\color{magenta}, |
| 287 |
tabsize=4, |
| 288 |
frame=single, |
| 289 |
columns=flexible, |
| 290 |
showstringspaces=false |
| 291 |
} |
| 292 |
\end{lstlisting} |
| 293 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\cascadiacode,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single,columns=flexible,showstringspaces=false] |
| 294 |
const similar = "oO08 iIlL1 g9qCGQ" |
| 295 |
const diacritics_etc = "â é ù ï ø ç Ã Ē Æ œ" |
| 296 |
|
| 297 |
window.toggleFavorite = (alias) => { |
| 298 |
try { |
| 299 |
let favorites = JSON.parse(localStorage.getItem('favorites')) || [] |
| 300 |
if (favorites.indexOf(alias) > -1) { |
| 301 |
favorites = favorites.filter((v) => { |
| 302 |
return v !== alias |
| 303 |
}) |
| 304 |
} else { |
| 305 |
favorites.push(alias) |
| 306 |
} |
| 307 |
localStorage.setItem('favorites', JSON.stringify(Array.from(new Set(favorites)))) |
| 308 |
} catch (err) { |
| 309 |
// eslint-disable-next-line no-console |
| 310 |
console.error('could not save favorite', err) |
| 311 |
} |
| 312 |
renderSelectList() |
| 313 |
return false |
| 314 |
} |
| 315 |
\end{lstlisting} |
| 316 |
|
| 317 |
\begin{lstlisting}[language=python,basicstyle=\footnotesize\cascadiacode,commentstyle=\itshape\color{gray},keywordstyle=\bfseries\color{magenta},tabsize=4,frame=single,columns=flexible,showstringspaces=false] |
| 318 |
def Fibonacci(n) : |
| 319 |
# Check if input is 0 then it will print incorrect input |
| 320 |
if n < 0 : |
| 321 |
print("Incorrect input") |
| 322 |
elif n == 0 : |
| 323 |
return 0 |
| 324 |
elif 1 <= n <= 2 : |
| 325 |
return 1 |
| 326 |
else : |
| 327 |
return Fibonacci(n-1) + Fibonacci(n-2) |
| 328 |
\end{lstlisting} |
| 329 |
|
| 330 |
\pagebreak |
| 331 |
|
| 332 |
|
| 333 |
\section{History} |
| 334 |
|
| 335 |
\setmonofont{CMU Typewriter Text}[Scale=MatchLowercase] |
| 336 |
|
| 337 |
\begin{verbatim} |
| 338 |
v0.3 Package loading with fontfamily + 'code' version |
| 339 |
v0.2 New weight options |
| 340 |
v0.1 Initial version |
| 341 |
\end{verbatim} |
| 342 |
|
| 343 |
\end{document} |