Add sans-serif bold and italic faces
Map \sffamily with \bfseries or \itshape onto the bundled cmssbx10 and cmssi10 metrics, with their Type1 outlines embedded alongside the other Computer Modern faces. Bold italic sans substitutes cmssbx10, matching the OT1 fallback in TeX.
This commit is contained in:
1 parent
03925e3116
commit
9140990a7d
13 files changed
+223
-19
No files matched your search
@@ -29,6 +29,10 @@ pub enum FontFace {
|
||||
MathBlackboard,
|
||||
/// Euler Fraktur (`eufm10`).
|
||||
MathFraktur,
|
||||
/// Computer Modern sans-serif bold (`cmssbx10`).
|
||||
SansBold,
|
||||
/// Computer Modern sans-serif italic (`cmssi10`).
|
||||
SansItalic,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -159,19 +163,28 @@ impl DisplayList {
|
||||
let size = *size as f64 / 65_536.0;
|
||||
let family = if matches!(font, FontFace::Mono) {
|
||||
"monospace"
|
||||
} else if matches!(font, FontFace::Sans) {
|
||||
} else if matches!(
|
||||
font,
|
||||
FontFace::Sans | FontFace::SansBold | FontFace::SansItalic
|
||||
) {
|
||||
"sans-serif"
|
||||
} else {
|
||||
"serif"
|
||||
};
|
||||
let weight = if matches!(font, FontFace::Bold | FontFace::BoldItalic) {
|
||||
let weight = if matches!(
|
||||
font,
|
||||
FontFace::Bold | FontFace::BoldItalic | FontFace::SansBold
|
||||
) {
|
||||
" font-weight=\"bold\""
|
||||
} else {
|
||||
""
|
||||
};
|
||||
let style = if matches!(
|
||||
font,
|
||||
FontFace::Italic | FontFace::BoldItalic | FontFace::MathItalic
|
||||
FontFace::Italic
|
||||
| FontFace::BoldItalic
|
||||
| FontFace::MathItalic
|
||||
| FontFace::SansItalic
|
||||
) {
|
||||
" font-style=\"italic\""
|
||||
} else {
|
||||
@@ -271,6 +284,8 @@ fn paragraph_face(font: ParagraphFont) -> FontFace {
|
||||
ParagraphFont::BoldItalic => FontFace::BoldItalic,
|
||||
ParagraphFont::Mono => FontFace::Mono,
|
||||
ParagraphFont::Sans => FontFace::Sans,
|
||||
ParagraphFont::SansBold => FontFace::SansBold,
|
||||
ParagraphFont::SansItalic => FontFace::SansItalic,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user