Distinguish slanted from italic and add italic typewriter
Add cmsl10/cmbxsl10/cmitt10 faces so \slshape and \textsl no longer reuse the italic cmti10 and \ttfamily\itshape reaches cmitt10. The NFSS state tracks italic, slanted and small caps separately, with last-shape-wins semantics for \em and the shape commands.
This commit is contained in:
1 parent
6df38ced25
commit
aa4d86d735
15 files changed
+328
-34
No files matched your search
@@ -35,6 +35,9 @@ pub enum FontFace {
|
||||
SansItalic,
|
||||
/// Computer Modern roman small caps (`cmcsc10`).
|
||||
SmallCaps,
|
||||
Slanted,
|
||||
BoldSlanted,
|
||||
MonoItalic,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -163,7 +166,7 @@ impl DisplayList {
|
||||
let x = *x as f64 / 65_536.0;
|
||||
let y = *y as f64 / 65_536.0;
|
||||
let size = *size as f64 / 65_536.0;
|
||||
let family = if matches!(font, FontFace::Mono) {
|
||||
let family = if matches!(font, FontFace::Mono | FontFace::MonoItalic) {
|
||||
"monospace"
|
||||
} else if matches!(
|
||||
font,
|
||||
@@ -175,7 +178,10 @@ impl DisplayList {
|
||||
};
|
||||
let weight = if matches!(
|
||||
font,
|
||||
FontFace::Bold | FontFace::BoldItalic | FontFace::SansBold
|
||||
FontFace::Bold
|
||||
| FontFace::BoldItalic
|
||||
| FontFace::SansBold
|
||||
| FontFace::BoldSlanted
|
||||
) {
|
||||
" font-weight=\"bold\""
|
||||
} else {
|
||||
@@ -187,6 +193,9 @@ impl DisplayList {
|
||||
| FontFace::BoldItalic
|
||||
| FontFace::MathItalic
|
||||
| FontFace::SansItalic
|
||||
| FontFace::Slanted
|
||||
| FontFace::BoldSlanted
|
||||
| FontFace::MonoItalic
|
||||
) {
|
||||
" font-style=\"italic\""
|
||||
} else {
|
||||
@@ -289,6 +298,9 @@ fn paragraph_face(font: ParagraphFont) -> FontFace {
|
||||
ParagraphFont::SansBold => FontFace::SansBold,
|
||||
ParagraphFont::SansItalic => FontFace::SansItalic,
|
||||
ParagraphFont::SmallCaps => FontFace::SmallCaps,
|
||||
ParagraphFont::Slanted => FontFace::Slanted,
|
||||
ParagraphFont::BoldSlanted => FontFace::BoldSlanted,
|
||||
ParagraphFont::MonoItalic => FontFace::MonoItalic,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user