Open cspiel opened 4 years ago
We need to augment each style-changing macro that expands to a @span
without
its own font-family. Currently these are
\it
,\sl
, and\sc
.I ran into the problem with the "Quattrocento" font which has bold, but no italics. Simply hooking up a font with matching italics, say "TeX Gyre Pagella" as
\newstyle{.italic}{font-family: "TeX Gyre Pagella", serif}
does work, but also changes slanted text and typewriter to Pagella.
My solution is to look at the pending styles (\@top@pending@style
)
and pick the topmost that matches one of the main font-class names
(\@main@styles
).
\newsavebox{\@top@style}
\newcommand{\@main@styles}{serif,sansserif,monospace,cursive,fantasy}
\newcommand{\@save@top@style}{\sbox{\@top@style}{\@top@pending@style{\@main@styles}}}
\newcommand{\@use@top@style}{\@getprint{\usebox{\@top@style}}}
\newenvironment{it}{\@save@top@style\@span{class="\@use@top@style italic"}}{}
With this change we can write a more specific ("conjunction") CSS selector:
\newstyle{.serif.italic}{font-family: "TeX Gyre Pagella", serif}
The OCaml code already looks ok, but the HeVeA code with \sbox
/\usebox
seems complicated. @maranget, do we have a possibility to define a macro that
immediately evaluates its body? The "usual" \expandafter
is off, AFAICS.
Hevea "hard-codes"
font-family: monospace
for typewriter text. Obviously, this has not riled anybody until now. If you are chasing a consistent appearance of the Hevea-translated document or simply want to swap out this bland default monospace font, things change.This P/R introduces CSS-classes for six font families or font variants:
The existing
\@span
calls are adjusted accordingly and new\@span
s are introduced where necessary. The defaults leave unaffected the appearance of all translated documents. So this is a visually neutral change, which actually is quite small. The much larger change is a rewrite of chapter B.15 "Font Selection" of the reference manual along with an additional subsection on "Controlling Font Selection with CSS".Here is a little demo document to play around with.
What this P/R fixes:
monospace
allows the user to select and scale a font family for\texttt
.serif
,sansserif
, andmonospace
together lets the user determine a font super family.slanted
oritalic
can be used to remedy mapping of\textsl
and\textit
to the same font.smallcaps
class can be used to pair a dedicated small-caps font for an existing regular one or to access built-in small-caps in certain OpenType fonts.\oldstylenums
and make it refer to classoldstyle
, which is undefined by default.Open questions:
With
\newatrule{name}[arg, ...]{body}
:What doesn't work yet:
11pt
and12pt
.