| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (c) 2026 David Purton <[email protected]> |
| 4 |
% |
| 5 |
% This work may be distributed and/or modified under the conditions of |
| 6 |
% the LaTeX Project Public License, either version 1.3c of this license |
| 7 |
% or (at your option) any later version. The latest version of this |
| 8 |
% license is in |
| 9 |
% http://www.latex-project.org/lppl.txt |
| 10 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 11 |
% version 2005/12/01 or later. |
| 12 |
% |
| 13 |
%<*driver> |
| 14 |
\RequirePackage{pdfmanagement} |
| 15 |
\documentclass[a4paper]{l3doc} |
| 16 |
\usepackage[T1]{fontenc} |
| 17 |
\usepackage{microtype} |
| 18 |
\usepackage{mlmodern} |
| 19 |
\usepackage[font=small, skip=6pt]{caption} |
| 20 |
\usepackage{xcolor} |
| 21 |
\usepackage{listings} |
| 22 |
\usepackage{sblfonts} |
| 23 |
|
| 24 |
\AddToHook{env/macrocode/before}{% |
| 25 |
\addvspace{\medskipamount}} |
| 26 |
|
| 27 |
\AddToHook{env/macro/before}{% |
| 28 |
\addvspace{\medskipamount}} |
| 29 |
|
| 30 |
\begin{document} |
| 31 |
\DocInput{\jobname.dtx} |
| 32 |
\end{document} |
| 33 |
%</driver> |
| 34 |
% \fi |
| 35 |
% |
| 36 |
% \title{The \pkg{sblfonts} Package} |
| 37 |
% \author{David Purton\thanks{Email: \url{[email protected]}}} |
| 38 |
% \date{2026-05-06 v1.1} |
| 39 |
% |
| 40 |
% \maketitle |
| 41 |
% |
| 42 |
% \begin{abstract} |
| 43 |
% \pkg{sblfonts} provides a LaTeX package for setting up font and language |
| 44 |
% support for documents conforming to the requirements of the Society of |
| 45 |
% Biblical Literature. Greek and Hebrew languages are supported using the |
| 46 |
% SBL fonts. If these fonts are not available then fonts included with |
| 47 |
% TeXLive are used. |
| 48 |
% \end{abstract} |
| 49 |
% |
| 50 |
% \tableofcontents |
| 51 |
% |
| 52 |
% \section{Introduction} |
| 53 |
% |
| 54 |
% This package is intended to be used with the SBL fonts and a Unicode \TeX\ |
| 55 |
% engine (|lualatex| is recommended). The SBL fonts are free for personal use |
| 56 |
% and can be downloaded from \url{https://www.sbl-site.org/resources/fonts/}. |
| 57 |
% It is, however, possible to use the package with any Unicode font and there |
| 58 |
% is limited support for 8bit fonts under |pdflatex| (in particular pointed |
| 59 |
% Hebrew is not easily possible). |
| 60 |
% |
| 61 |
% The \pkg{sblfonts} package only sets up fonts for the default Roman family. |
| 62 |
% You can set up typewriter and sans serif families in the usual way if you |
| 63 |
% need them. |
| 64 |
% |
| 65 |
% \subsection{Usage} |
| 66 |
% |
| 67 |
% To use default \LaTeX\ fonts, load the package with no options. The \LaTeX\ |
| 68 |
% source is shown in Figure \ref{exampleusage} and the output is shown in |
| 69 |
% Figure \ref{exampleoutput}. |
| 70 |
% |
| 71 |
% In reality, you will want to install the SBL fonts, use |lualatex|, and load |
| 72 |
% the package with |\usepackage[sblfonts]{sblfonts}|. Note that it is not |
| 73 |
% necessary to mark up inline Greek and Hebrew with |lualatex|. |
| 74 |
% |
| 75 |
% \begin{figure} |
| 76 |
% \centering |
| 77 |
% \framebox[\linewidth]{% |
| 78 |
% \parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule}{% |
| 79 |
% \small\ttfamily |
| 80 |
% \textbackslash\textcolor{blue!70!black}{documentclass}\{article\}\\ |
| 81 |
% \textbackslash\textcolor{blue!70!black}{usepackage}\{sblfonts\}\\ |
| 82 |
% \textbackslash\textcolor{blue!70!black}{begin}\{document\}\\ |
| 83 |
% \textbackslash\textcolor{blue!70!black}{begin}\{quotation\}\\ |
| 84 |
% \phantom{..}\textbackslash\textcolor{blue!70!black}{selectlanguage}\{polytonicgreek\}\\ |
| 85 |
% {\fontencoding{LGR}\fontfamily{cmtt}\selectfont |
| 86 |
% \phantom{..}Ἐν ἀρχῇ ἦν ὁ λόγος, καὶ ὁ λόγος ἦν πρὸς τὸν θεόν, καὶ θεὸς ἦν ὁ λόγος.\\ |
| 87 |
% \phantom{..}οὗτος ἦν ἐν ἀρχῇ πρὸς τὸν θεόν.}\\ |
| 88 |
% \textbackslash\textcolor{blue!70!black}{end}\{quotation\}\\ |
| 89 |
% \textbackslash\textcolor{blue!70!black}{begin}\{quotation\}\\ |
| 90 |
% \phantom{..}\textbackslash\textcolor{blue!70!black}{selectlanguage}\{hebrew\}\\ |
| 91 |
% {\fontencoding{NHE8}\fontfamily{miriam}\fontseries{b}\selectfont |
| 92 |
% \phantom{..}\foreignlanguage{hebrew}{ב\kern-4.6pt ּ\kern-1ptראש\kern-5.3pt ׁית |
| 93 |
% ב\kern-4.6pt ּ\kern-1ptרא אלהים את הש\kern-5.3pt ׁ\kern-6.3pt ּ\kern1ptמים ואת |
| 94 |
% הארץ׃ והארץ היתה תהו\kern-4pt ּ ובהו\kern-4pt ּ וחש\kern-5.3pt ׁך}\\ |
| 95 |
% \phantom{..}\foreignlanguage{hebrew}{על־פ\kern-5.8pt ּני תהום |
| 96 |
% ורו\kern-4pt ּח אלהים מרחפת על־פ\kern-5.8pt ּני המ\kern-5.5pt ּים׃}}\\ |
| 97 |
% \textbackslash\textcolor{blue!70!black}{end}\{quotation\}\\ |
| 98 |
% Inline Greek |
| 99 |
% (\textbackslash\textcolor{blue!70!black}{foreignlanguage}\{polytonicgreek\}\{{\fontencoding{LGR}\fontfamily{cmtt}\selectfont |
| 100 |
% Ἐν ἀρχῇ}\}) and Hebrew |
| 101 |
% (\textbackslash\textcolor{blue!70!black}{foreignlanguage}\{hebrew\}\{{\fontencoding{NHE8}\fontfamily{miriam}\fontseries{b}\selectfont\foreignlanguage{hebrew}{ב\kern-4.6pt ּ\kern-1ptראש\kern-5.3pt ׁית}}\}) |
| 102 |
% are also possible.\\ |
| 103 |
% \textbackslash\textcolor{blue!70!black}{end}\{document\}% |
| 104 |
% }% |
| 105 |
% } |
| 106 |
% \caption{Example \LaTeX\ source showing default Greek and Hebrew fonts.} |
| 107 |
% \label{exampleusage} |
| 108 |
% \end{figure} |
| 109 |
% |
| 110 |
% \begin{figure} |
| 111 |
% \centering |
| 112 |
% \framebox[\linewidth]{% |
| 113 |
% \parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule}{% |
| 114 |
% \begin{quotation} |
| 115 |
% \selectlanguage{polytonicgreek} |
| 116 |
% Ἐν ἀρχῇ ἦν ὁ λόγος, καὶ ὁ λόγος ἦν πρὸς τὸν θεόν, καὶ θεὸς ἦν ὁ |
| 117 |
% λόγος. οὗτος ἦν ἐν ἀρχῇ πρὸς τὸν θεόν. |
| 118 |
% \end{quotation} |
| 119 |
% \begin{quotation} |
| 120 |
% \selectlanguage{hebrew} |
| 121 |
% בּראשׁית בּרא אלהים את השּׁמים ואת הארץ׃ והארץ היתה תהוּ ובהוּ וחשׁך על־פּני |
| 122 |
% תהום ורוּח אלהים מרחפת על־פּני המּים׃ |
| 123 |
% \end{quotation} |
| 124 |
% Inline Greek (\foreignlanguage{polytonicgreek}{Ἐν ἀρχῇ}) and Hebrew |
| 125 |
% (\foreignlanguage{hebrew}{בּראשׁית}) are also possible. |
| 126 |
% }% |
| 127 |
% } |
| 128 |
% \caption{Example output showing Greek and Hebrew in default \LaTeX\ |
| 129 |
% fonts.} |
| 130 |
% \label{exampleoutput} |
| 131 |
% \end{figure} |
| 132 |
% |
| 133 |
% \subsection{Bug Reports and Feature Requests} |
| 134 |
% |
| 135 |
% Bug reports and feature requests can be made at the \pkg{sbltex} |
| 136 |
% GitHub repository. See \url{https://github.com/dcpurton/sbltex}. |
| 137 |
% |
| 138 |
% \section{Package Options} |
| 139 |
% |
| 140 |
% \begin{function}{mainlang} |
| 141 |
% \begin{syntax} |
| 142 |
% mainlang = \meta{babel language}\hfill Default: \emph{unset} |
| 143 |
% \end{syntax} |
| 144 |
% Set the main language of the document. If this is unset, the main language |
| 145 |
% is the language passed to the document class or if that is unset, |
| 146 |
% |american|. |
| 147 |
% \end{function} |
| 148 |
% |
| 149 |
% \begin{function}{mainlangoptions} |
| 150 |
% \begin{syntax} |
| 151 |
% mainlanguageoptions = \meta{babelprovide options}\hfill Default: \emph{unset} |
| 152 |
% \end{syntax} |
| 153 |
% Set the options passed to \cs{babelprovide} when loading the main language |
| 154 |
% (in addition to |import, main|). This is not used if the main language is |
| 155 |
% passed to \pkg{babel} via the document class options. |
| 156 |
% \end{function} |
| 157 |
% |
| 158 |
% \begin{function}{mainfont} |
| 159 |
% \begin{syntax} |
| 160 |
% mainfont = \meta{package} \textbar\ \meta{fontspec name}\hfill Default: \emph{unset} |
| 161 |
% \end{syntax} |
| 162 |
% Set the main font. Under |pdftex| this is the name of a font package to |
| 163 |
% load. Under Unicode engines it should be a \pkg{fontspec} name which is |
| 164 |
% passed to \cs{babelfont}. The optional arguments passed to the package or |
| 165 |
% \cs{babelfont} can be specified in the |mainfontoptions| option. |
| 166 |
% \end{function} |
| 167 |
% |
| 168 |
% \begin{function}{mainfontoptions} |
| 169 |
% \begin{syntax} |
| 170 |
% mainfontoptions = \meta{package options} \textbar\ \meta{fontspec options}\hfill Default: \emph{unset} |
| 171 |
% \end{syntax} |
| 172 |
% The optional arguments passed to the font package under |pdflatex| or |
| 173 |
% \cs{babelfont} under Unicode engines. |
| 174 |
% \end{function} |
| 175 |
% |
| 176 |
% \begin{function}{grfont} |
| 177 |
% \begin{syntax} |
| 178 |
% grfont = \meta{NFSS font} \textbar\ \meta{fontspec name}\hfill Default: \emph{unset} |
| 179 |
% \end{syntax} |
| 180 |
% Set the Greek font. For |pdflatex| this should be an NFSS font name which |
| 181 |
% supports the LGR encoding. For Unicode engines this should be a |
| 182 |
% \pkg{fontspec} font name. If unset, then under |pdflatex| the default |
| 183 |
% font is |grmn1000| and under Unicode engines the default font is CMU Serif |
| 184 |
% or |mainfont| if it supports Greek. With the Unicode engines, the optional |
| 185 |
% arguments passed to \cs{babelfont} can be specified in the |grfontoptions| |
| 186 |
% option. |
| 187 |
% \end{function} |
| 188 |
% |
| 189 |
% \begin{function}{grfontoptions} |
| 190 |
% \begin{syntax} |
| 191 |
% grfontoptions = \meta{fontspec options}\hfill Default: \emph{unset} |
| 192 |
% \end{syntax} |
| 193 |
% The optional arguments passed to \cs{babelfont} for the Greek font under |
| 194 |
% Unicode engines. This option is ignored under |pdftex|. |
| 195 |
% \end{function} |
| 196 |
% |
| 197 |
% \begin{function}{grlangoptions} |
| 198 |
% \begin{syntax} |
| 199 |
% grlangoptions = \meta{babelprovide options}\hfill Default: \emph{unset} |
| 200 |
% \end{syntax} |
| 201 |
% Set the options passed to \cs{babelprovide} when loading |polytonicgreek| |
| 202 |
% (in addition to |import, onchar=ids fonts|). |
| 203 |
% \end{function} |
| 204 |
% |
| 205 |
% \begin{function}{hefont} |
| 206 |
% \begin{syntax} |
| 207 |
% hefont = \meta{NFSS font} \textbar\ \meta{fontspec name}\hfill Default: \emph{unset} |
| 208 |
% \end{syntax} |
| 209 |
% Set the Hebrew font. For |pdflatex| this should be an NFSS font name which |
| 210 |
% supports the NHE8 encoding. For Unicode engines this should be a |
| 211 |
% \pkg{fontspec} font name. If unset, then under |pdflatex| the default |
| 212 |
% font is |david| and under Unicode engines the default font is David CLM |
| 213 |
% or |mainfont| if it supports Hebrew. With the Unicode engines, the optional |
| 214 |
% arguments passed to \cs{babelfont} can be specified in the |hefontoptions| |
| 215 |
% option. |
| 216 |
% \end{function} |
| 217 |
% |
| 218 |
% In reality, |pdflatex| is really only supported for interest. You should use |
| 219 |
% |lualatex| for any right-to-left languages. |
| 220 |
% |
| 221 |
% \begin{function}{hefontoptions} |
| 222 |
% \begin{syntax} |
| 223 |
% hefontoptions = \meta{fontspec options}\hfill Default: \emph{unset} |
| 224 |
% \end{syntax} |
| 225 |
% The optional arguments passed to \cs{babelfont} for the Hebrew font under |
| 226 |
% Unicode engines. This option is ignored under |pdftex|. |
| 227 |
% \end{function} |
| 228 |
% |
| 229 |
% \begin{function}{helangoptions} |
| 230 |
% \begin{syntax} |
| 231 |
% helangoptions = \meta{babelprovide options}\hfill Default: \emph{unset} |
| 232 |
% \end{syntax} |
| 233 |
% Set the options passed to \cs{babelprovide} when loading |hebrew| (in |
| 234 |
% addition to |import, onchar=ids fonts|). |
| 235 |
% \end{function} |
| 236 |
% |
| 237 |
% \subsection{Using SBL Greek and Hebrew fonts} |
| 238 |
% |
| 239 |
% Under Unicode engines, the following options control whether the SBL Greek |
| 240 |
% and Hebrew fonts should be used. Under |pdftex| the similar looking |
| 241 |
% |Alegreya-OsF| and |frank| fonts are used. |
| 242 |
% |
| 243 |
% \begin{function}{sblfonts} |
| 244 |
% \begin{syntax} |
| 245 |
% sblfonts = true \textbar\ false \textbar\ fallback\hfill Default: fallback |
| 246 |
% \end{syntax} |
| 247 |
% This is a shortcut option for setting both |sblgreek| and |sblhebrew| at |
| 248 |
% the same time. Under |pdftex|, |false| and |fallback| behave the same. |
| 249 |
% \end{function} |
| 250 |
% |
| 251 |
% \begin{function}{sblgreek} |
| 252 |
% \begin{syntax} |
| 253 |
% sblgreek = true \textbar\ false \textbar\ fallback\hfill Default: fallback |
| 254 |
% \end{syntax} |
| 255 |
% This option controls if and when the SBL Greek font should be used. The order |
| 256 |
% of fonts tried for each option is: |
| 257 |
% \end{function} |
| 258 |
% \begin{description} |
| 259 |
% \item[\texttt{true}] Under Unicode engines: SBL BibLit, SBL Greek, |
| 260 |
% Alegreya. Under |pdftex|: |Alegreya-OsF|. |
| 261 |
% \item[\texttt{false}] Under Unicode engines: |mainfont| (if specified) |
| 262 |
% otherwise CMU Serif. This is useful if the test to detect Greek support |
| 263 |
% in |mainfont| is not accurate. Under |pdftex|: the same as the |
| 264 |
% |fallback| option. |
| 265 |
% \item[\texttt{fallback}] Under Unicode engines: |mainfont| (if specified |
| 266 |
% and if Greek is supported) otherwise CMU Serif. Under |pdftex|: |
| 267 |
% |mainfont| (if specified and if the LGR encoding is supported), |
| 268 |
% otherwise |grmn1000|. |
| 269 |
% \end{description} |
| 270 |
% |
| 271 |
% \begin{function}{sblhebrew} |
| 272 |
% \begin{syntax} |
| 273 |
% sblhebrew = true \textbar\ false \textbar\ fallback\hfill Default: fallback |
| 274 |
% \end{syntax} |
| 275 |
% This option controls if and when the SBL Hebrew font should be used. The order |
| 276 |
% of fonts tried for each option is: |
| 277 |
% \end{function} |
| 278 |
% \begin{description} |
| 279 |
% \item[\texttt{true}] Under Unicode engines: SBL BibLit, SBL Hebrew, Frank |
| 280 |
% Ruehl CLM. Under |pdftex|: |frank|. |
| 281 |
% \item[\texttt{false}] Under Unicode engines: |mainfont| (if specified) |
| 282 |
% otherwise David CLM. This is useful if the test to detect Hebrew support |
| 283 |
% in |mainfont| is not accurate. Under |pdftex|: the same as the |
| 284 |
% |fallback| option. |
| 285 |
% \item[\texttt{fallback}] Under Unicode engines: |mainfont| (if specified |
| 286 |
% and if Hebrew is supported) otherwise David CLM. Under |pdftex|: |
| 287 |
% |mainfont| (if specified and if the NHE8 encoding is supported), |
| 288 |
% otherwise |david|. |
| 289 |
% \end{description} |
| 290 |
% |
| 291 |
% \section{Implementation} |
| 292 |
% |
| 293 |
% \setlength{\parindent}{0em} |
| 294 |
% |
| 295 |
% \begin{macrocode} |
| 296 |
%<*package> |
| 297 |
%<@@=sblfonts> |
| 298 |
% \end{macrocode} |
| 299 |
% |
| 300 |
% \begin{macrocode} |
| 301 |
\NeedsTeXFormat{LaTeX2e} |
| 302 |
\ProvidesExplPackage{sblfonts}{2026-05-06}{1.1} |
| 303 |
{Society of Biblical Literature Font and Language Set Up (DCP)} |
| 304 |
% \end{macrocode} |
| 305 |
% |
| 306 |
% \begin{macrocode} |
| 307 |
\keys_define:nn { sblfonts } |
| 308 |
{ |
| 309 |
, mainlang .tl_set:N = \l_@@_mainlang_tl |
| 310 |
, mainlangoptions .clist_set:N = \l_@@_mainlang_options_clist |
| 311 |
, mainfont .tl_set:N = \l_@@_mainfont_tl |
| 312 |
, mainfontoptions .clist_set:N = \l_@@_mainfont_options_clist |
| 313 |
, grfont .tl_set:N = \l_@@_grfont_tl |
| 314 |
, grfontoptions .clist_set:N = \l_@@_grfont_options_clist |
| 315 |
, grlangoptions .clist_set:N = \l_@@_grlang_options_clist |
| 316 |
, hefont .tl_set:N = \l_@@_hefont_tl |
| 317 |
, hefontoptions .clist_set:N = \l_@@_hefont_options_clist |
| 318 |
, helangoptions .clist_set:N = \l_@@_helang_options_clist |
| 319 |
} |
| 320 |
% \end{macrocode} |
| 321 |
% |
| 322 |
% \begin{macrocode} |
| 323 |
\str_new:N \l_@@_sblgreek_str |
| 324 |
\str_new:N \l_@@_sblhebrew_str |
| 325 |
% \end{macrocode} |
| 326 |
% |
| 327 |
% \begin{macrocode} |
| 328 |
\sys_if_engine_opentype:TF |
| 329 |
{ |
| 330 |
\keys_define:nn { sblfonts } |
| 331 |
{ |
| 332 |
, sblfonts .choices:nn = { true, false, fallback } |
| 333 |
{ |
| 334 |
\str_set:NV |
| 335 |
\l_@@_sblgreek_str |
| 336 |
\l_keys_choice_str |
| 337 |
\str_set:NV |
| 338 |
\l_@@_sblhebrew_str |
| 339 |
\l_keys_choice_str |
| 340 |
} |
| 341 |
, sblfonts .default:n = { true } |
| 342 |
, sblgreek .choices:nn = { true, false, fallback } |
| 343 |
{ |
| 344 |
\str_set:NV |
| 345 |
\l_@@_sblgreek_str |
| 346 |
\l_keys_choice_str |
| 347 |
} |
| 348 |
, sblgreek .default:n = { true } |
| 349 |
, sblgreek .initial:n = { fallback } |
| 350 |
, sblhebrew .choices:nn = { true, false, fallback } |
| 351 |
{ |
| 352 |
\str_set:NV |
| 353 |
\l_@@_sblhebrew_str |
| 354 |
\l_keys_choice_str |
| 355 |
} |
| 356 |
, sblhebrew .default:n = { true } |
| 357 |
, sblhebrew .initial:n = { fallback } |
| 358 |
} |
| 359 |
} |
| 360 |
% \end{macrocode} |
| 361 |
% |
| 362 |
% For |pdftex| make |sblfonts|, |sblgreek| and |sblhebrew| noops. |
| 363 |
% |
| 364 |
% \begin{macrocode} |
| 365 |
{ |
| 366 |
\keys_define:nn { sblfonts } |
| 367 |
{ |
| 368 |
, sblfonts .meta:n = { sblgreek = #1 , sblhebrew = #1 } |
| 369 |
, sblfonts .default:n = { true } |
| 370 |
, sblgreek .code:n = { |
| 371 |
\str_if_eq:nnT {#1} { true } |
| 372 |
{ |
| 373 |
\tl_set:Nn \l_@@_grfont_tl |
| 374 |
{ Alegreya-OsF } |
| 375 |
} |
| 376 |
} |
| 377 |
, sblgreek .default:n = { true } |
| 378 |
, sblhebrew .code:n = { |
| 379 |
\str_if_eq:nnT {#1} { true } |
| 380 |
{ |
| 381 |
\tl_set:Nn \l_@@_hefont_tl |
| 382 |
{ frank } |
| 383 |
} |
| 384 |
} |
| 385 |
, sblhebrew .default:n = { true } |
| 386 |
} |
| 387 |
} |
| 388 |
% \end{macrocode} |
| 389 |
% |
| 390 |
% \begin{macrocode} |
| 391 |
\ProcessKeyOptions |
| 392 |
% \end{macrocode} |
| 393 |
% |
| 394 |
% \subsection{Language Set Up} |
| 395 |
% |
| 396 |
% \cs{babelprovide} macros need to be run outside of ExplSyntax. |
| 397 |
% |
| 398 |
% \begin{macrocode} |
| 399 |
\tl_set_eq:NN \@sblfonts@mainlang \l_@@_mainlang_tl |
| 400 |
\clist_set:Ne \@sblfonts@mainlang@options |
| 401 |
{ |
| 402 |
, import |
| 403 |
, \clist_use:N \l_@@_mainlang_options_clist |
| 404 |
, main |
| 405 |
} |
| 406 |
\clist_set:Ne \@sblfonts@grlang@options |
| 407 |
{ |
| 408 |
, import |
| 409 |
, onchar = ids ~ fonts |
| 410 |
, \clist_use:N \l_@@_grlang_options_clist |
| 411 |
} |
| 412 |
\clist_set:Ne \@sblfonts@helang@options |
| 413 |
{ |
| 414 |
, import |
| 415 |
, onchar = ids ~ fonts |
| 416 |
, \clist_use:N \l_@@_helang_options_clist |
| 417 |
} |
| 418 |
% \end{macrocode} |
| 419 |
% |
| 420 |
% \begin{macrocode} |
| 421 |
\ExplSyntaxOff |
| 422 |
% \end{macrocode} |
| 423 |
% |
| 424 |
% \begin{macrocode} |
| 425 |
\newcommand*{\@sblfonts@load@american}{% |
| 426 |
\expandafter\babelprovide\expandafter |
| 427 |
[\@sblfonts@mainlang@options]{american}} |
| 428 |
\newcommand*{\@sblfonts@load@mainlang}{% |
| 429 |
\expandafter\babelprovide\expandafter |
| 430 |
[\@sblfonts@mainlang@options]{\@sblfonts@mainlang}} |
| 431 |
\newcommand*{\@sblfonts@load@polytonicgreek}{% |
| 432 |
\expandafter\babelprovide\expandafter |
| 433 |
[\@sblfonts@grlang@options]{polytonicgreek}} |
| 434 |
\newcommand*{\@sblfonts@load@hebrew}{% |
| 435 |
\expandafter\babelprovide\expandafter |
| 436 |
[\@sblfonts@helang@options]{hebrew}} |
| 437 |
% \end{macrocode} |
| 438 |
% |
| 439 |
% \begin{macrocode} |
| 440 |
\ExplSyntaxOn |
| 441 |
% \end{macrocode} |
| 442 |
% |
| 443 |
% \begin{macro}{\@@_load_languages:} |
| 444 |
% |
| 445 |
% Load American, Polytonic Greek and Hebrew languages using \pkg{babel}. |
| 446 |
% |
| 447 |
% \begin{macrocode} |
| 448 |
\cs_new_protected:Nn \@@_load_languages: |
| 449 |
{ |
| 450 |
\tl_if_eq:NnT \languagename { nil } |
| 451 |
{ |
| 452 |
\tl_if_empty:NTF \l_@@_mainlang_tl |
| 453 |
{ \@sblfonts@load@american } |
| 454 |
{ \@sblfonts@load@mainlang } |
| 455 |
} |
| 456 |
\@sblfonts@load@polytonicgreek |
| 457 |
\@sblfonts@load@hebrew |
| 458 |
\babeladjust{ select.write = shift } |
| 459 |
} |
| 460 |
% \end{macrocode} |
| 461 |
% |
| 462 |
% \begin{macrocode} |
| 463 |
\cs_set_eq:NN \@sblfonts@load@languages \@@_load_languages: |
| 464 |
% \end{macrocode} |
| 465 |
% \end{macro} |
| 466 |
% |
| 467 |
% \begin{macrocode} |
| 468 |
\sys_if_engine_opentype:TF |
| 469 |
{ |
| 470 |
\RequirePackage { fontspec } |
| 471 |
\sys_if_engine_luatex:T |
| 472 |
{ \RequirePackage [ bidi=basic, provide*=* ] { babel } } |
| 473 |
\sys_if_engine_xetex:T |
| 474 |
{ \RequirePackage [ bidi=default, provide*=* ] { babel } } |
| 475 |
} |
| 476 |
{ |
| 477 |
\RequirePackage [ NHE8, LGR, T1 ] { fontenc } |
| 478 |
\RequirePackage [ bidi=default, provide*=* ] { babel } |
| 479 |
} |
| 480 |
% \end{macrocode} |
| 481 |
% |
| 482 |
% \cs{babelprovide} macros need to be run outside of ExplSyntax. |
| 483 |
% |
| 484 |
% \begin{macrocode} |
| 485 |
\ExplSyntaxOff |
| 486 |
\@sblfonts@load@languages |
| 487 |
\ExplSyntaxOn |
| 488 |
% \end{macrocode} |
| 489 |
% |
| 490 |
% \subsection{Font Set Up} |
| 491 |
% |
| 492 |
% \begin{macro}{\@@_load_default_greek_font:} |
| 493 |
% |
| 494 |
% Load the default \LaTeX\ Greek font. |
| 495 |
% |
| 496 |
% \begin{macrocode} |
| 497 |
\cs_new_protected:Nn \@@_load_default_greek_font: |
| 498 |
{ |
| 499 |
\babelfont [ polytonicgreek ] { rm } |
| 500 |
[ |
| 501 |
Extension = .otf , |
| 502 |
ItalicFont = cmunti , |
| 503 |
BoldFont = cmunbx , |
| 504 |
BoldItalicFont = cmunbi , |
| 505 |
\l_@@_grfont_options_clist |
| 506 |
] |
| 507 |
{ cmunrm } |
| 508 |
} |
| 509 |
% \end{macrocode} |
| 510 |
% \end{macro} |
| 511 |
% |
| 512 |
% \begin{macro}{\@@_load_default_hebrew_font:} |
| 513 |
% \begin{macrocode} |
| 514 |
% |
| 515 |
% Load the default \LaTeX\ Hebrew font. |
| 516 |
% |
| 517 |
\cs_new_protected:Nn \@@_load_default_hebrew_font: |
| 518 |
{ |
| 519 |
\babelfont [ hebrew ] { rm } |
| 520 |
[ |
| 521 |
Extension = .otf , |
| 522 |
UprightFont = *-Medium , |
| 523 |
ItalicFont = *-MediumItalic , |
| 524 |
BoldFont = *-Bold , |
| 525 |
BoldItalicFont = *-BoldItalic , |
| 526 |
\l_@@_hefont_options_clist |
| 527 |
] |
| 528 |
{ DavidCLM } |
| 529 |
} |
| 530 |
% \end{macrocode} |
| 531 |
% \end{macro} |
| 532 |
% |
| 533 |
% \begin{macrocode} |
| 534 |
\sys_if_engine_opentype:TF |
| 535 |
{ |
| 536 |
% \end{macrocode} |
| 537 |
% |
| 538 |
% Use main font for Greek and Hebrew if it supports it unless SBL fonts have |
| 539 |
% been explicitly asked for. \textbf{Note:} Some fonts support only monotonic |
| 540 |
% Greek, but there generally isn't a way to tell this without checking which |
| 541 |
% glyphs are actually present. |
| 542 |
% |
| 543 |
% \begin{macrocode} |
| 544 |
\tl_if_empty:NTF \l_@@_mainfont_tl |
| 545 |
{ |
| 546 |
% \end{macrocode} |
| 547 |
% |
| 548 |
% Initially set Greek and Hebrew to CMU Serif and David CLM |
| 549 |
% |
| 550 |
% \begin{macrocode} |
| 551 |
\@@_load_default_greek_font: |
| 552 |
\@@_load_default_hebrew_font: |
| 553 |
} |
| 554 |
{ |
| 555 |
\babelfont { rm } |
| 556 |
[ \l_@@_mainfont_options_clist ] |
| 557 |
{ \l_@@_mainfont_tl } |
| 558 |
\fontspec_if_script:nF { grek } |
| 559 |
{ |
| 560 |
\str_if_eq:VnT \l_@@_sblgreek_str { fallback } |
| 561 |
{ \@@_load_default_greek_font: } |
| 562 |
} |
| 563 |
\fontspec_if_script:nF { hebr } |
| 564 |
{ |
| 565 |
\str_if_eq:VnT \l_@@_sblhebrew_str { fallback } |
| 566 |
{ \@@_load_default_hebrew_font: } |
| 567 |
} |
| 568 |
} |
| 569 |
% \end{macrocode} |
| 570 |
% |
| 571 |
% Try to load SBL fonts if asked for. |
| 572 |
% \begin{description} |
| 573 |
% \item[For Greek:] SBL BibLit, SBL Greek, Alegreya |
| 574 |
% \item[For Hebrew:] SBL BibLit, SBL Hebrew, Frank Ruehl CLM |
| 575 |
% \end{description} |
| 576 |
% \textbf{Note:} The SBL font is strongly advised for biblical Hebrew. |
| 577 |
% Alegreya and Frank Ruehl CLM are included in TeXLive so should be present. |
| 578 |
% |
| 579 |
% \begin{macrocode} |
| 580 |
\str_if_eq:VnT \l_@@_sblgreek_str { true } |
| 581 |
{ |
| 582 |
\fontspec_font_if_exist:nTF { SBL ~ BibLit } |
| 583 |
{ |
| 584 |
\babelfont [ polytonicgreek ] { rm } |
| 585 |
[ |
| 586 |
ItalicFont = SBL ~ BibLit , |
| 587 |
BoldFont = SBL ~ BibLit , |
| 588 |
BoldItalicFont = SBL ~ BibLit , |
| 589 |
\l_@@_grfont_options_clist |
| 590 |
] |
| 591 |
{ SBL ~ BibLit } |
| 592 |
} |
| 593 |
{ |
| 594 |
\fontspec_font_if_exist:nTF { SBL ~ Greek } |
| 595 |
{ |
| 596 |
\babelfont [ polytonicgreek ] { rm } |
| 597 |
[ |
| 598 |
ItalicFont = SBL ~ Greek , |
| 599 |
BoldFont = SBL ~ Greek , |
| 600 |
BoldItalicFont = SBL ~ Greek , |
| 601 |
\l_@@_grfont_options_clist |
| 602 |
] |
| 603 |
{ SBL ~ Greek } |
| 604 |
} |
| 605 |
{ |
| 606 |
\babelfont [ polytonicgreek ] { rm } |
| 607 |
[ |
| 608 |
Extension = .otf , |
| 609 |
UprightFont = *-Regular , |
| 610 |
ItalicFont = *-Italic , |
| 611 |
BoldFont = *-Bold , |
| 612 |
BoldItalic = *-BoldItalic , |
| 613 |
\l_@@_grfont_options_clist |
| 614 |
] |
| 615 |
{ Alegreya } |
| 616 |
} |
| 617 |
} |
| 618 |
} |
| 619 |
% \end{macrocode} |
| 620 |
% |
| 621 |
% \begin{macrocode} |
| 622 |
\str_if_eq:VnT \l_@@_sblhebrew_str { true } |
| 623 |
{ |
| 624 |
\fontspec_font_if_exist:nTF { SBL ~ BibLit } |
| 625 |
{ |
| 626 |
\babelfont [ hebrew ] { rm } |
| 627 |
[ |
| 628 |
ItalicFont = SBL ~ BibLit , |
| 629 |
BoldFont = SBL ~ BibLit , |
| 630 |
BoldItalicFont = SBL ~ BibLit , |
| 631 |
\l_@@_hefont_options_clist |
| 632 |
] |
| 633 |
{ SBL ~ BibLit } |
| 634 |
} |
| 635 |
{ |
| 636 |
\fontspec_font_if_exist:nTF { SBL ~ Hebrew } |
| 637 |
{ |
| 638 |
\babelfont [ hebrew ] { rm } |
| 639 |
[ |
| 640 |
ItalicFont = SBL ~ Hebrew , |
| 641 |
BoldFont = SBL ~ Hebrew , |
| 642 |
BoldItalicFont = SBL ~ Hebrew , |
| 643 |
\l_@@_hefont_options_clist |
| 644 |
] |
| 645 |
{ SBL ~ Hebrew } |
| 646 |
} |
| 647 |
{ |
| 648 |
\babelfont [ hebrew ] { rm } |
| 649 |
[ |
| 650 |
Extension = .ttf , |
| 651 |
UprightFont = *-Medium , |
| 652 |
ItalicFont = *-MediumOblique , |
| 653 |
BoldFont = *-Bold , |
| 654 |
BoldItalic = *-BoldOblique , |
| 655 |
\l_@@_hefont_options_clist |
| 656 |
] |
| 657 |
{ FrankRuehlCLM } |
| 658 |
} |
| 659 |
} |
| 660 |
} |
| 661 |
% \end{macrocode} |
| 662 |
% |
| 663 |
% Override Greek and Hebrew fonts if specified in |grfont| and |hefont| |
| 664 |
% options. |
| 665 |
% |
| 666 |
% \begin{macrocode} |
| 667 |
\tl_if_empty:NF \l_@@_grfont_tl |
| 668 |
{ |
| 669 |
\babelfont [ polytonicgreek ] { rm } |
| 670 |
[ \l_@@_grfont_options_clist ] |
| 671 |
{ \l_@@_grfont_tl } |
| 672 |
} |
| 673 |
\tl_if_empty:NF \l_@@_hefont_tl |
| 674 |
{ |
| 675 |
\babelfont [ hebrew ] { rm } |
| 676 |
[ \l_@@_hefont_options_clist ] |
| 677 |
{ \l_@@_hefont_tl } |
| 678 |
} |
| 679 |
} |
| 680 |
{ |
| 681 |
% \end{macrocode} |
| 682 |
% |
| 683 |
% For |pdflatex|, load font using a package. |
| 684 |
% |
| 685 |
% \begin{macrocode} |
| 686 |
\tl_if_empty:NF \l_@@_mainfont_tl |
| 687 |
{ |
| 688 |
\RequirePackage |
| 689 |
[ \l_@@_mainfont_options_clist ] |
| 690 |
{ \l_@@_mainfont_tl } |
| 691 |
} |
| 692 |
% \end{macrocode} |
| 693 |
% |
| 694 |
% Override Greek and Hebrew fonts if specified in |grfont| and |hefont| |
| 695 |
% options. |
| 696 |
% |
| 697 |
% \begin{macrocode} |
| 698 |
\tl_if_empty:NF \l_@@_grfont_tl |
| 699 |
{ |
| 700 |
\DeclareFontFamilySubstitution |
| 701 |
{ LGR } |
| 702 |
{ \rmdefault } |
| 703 |
{ \l_@@_grfont_tl } |
| 704 |
} |
| 705 |
\tl_if_empty:NF \l_@@_hefont_tl |
| 706 |
{ |
| 707 |
\DeclareFontFamilySubstitution |
| 708 |
{ NHE8 } |
| 709 |
{ \rmdefault } |
| 710 |
{ \l_@@_hefont_tl } |
| 711 |
} |
| 712 |
} |
| 713 |
% \end{macrocode} |
| 714 |
% |
| 715 |
% \begin{macrocode} |
| 716 |
\endinput |
| 717 |
% \end{macrocode} |
| 718 |
% |
| 719 |
% \begin{macrocode} |
| 720 |
%</package> |
| 721 |
% \end{macrocode} |