Embed math italic letters as Computer Modern Type1 outlines
This commit is contained in:
1 parent
f7849f39c2
commit
a95cf8092e
10 files changed
+120
-35
No files matched your search
@@ -19,6 +19,8 @@ pub enum FontFace {
|
||||
BoldItalic,
|
||||
Mono,
|
||||
Sans,
|
||||
/// Computer Modern math italic (`cmmi10`).
|
||||
MathItalic,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -159,7 +161,10 @@ impl DisplayList {
|
||||
} else {
|
||||
""
|
||||
};
|
||||
let style = if matches!(font, FontFace::Italic | FontFace::BoldItalic) {
|
||||
let style = if matches!(
|
||||
font,
|
||||
FontFace::Italic | FontFace::BoldItalic | FontFace::MathItalic
|
||||
) {
|
||||
" font-style=\"italic\""
|
||||
} else {
|
||||
""
|
||||
@@ -261,6 +266,10 @@ fn paragraph_face(font: ParagraphFont) -> FontFace {
|
||||
}
|
||||
}
|
||||
|
||||
fn is_math_letter(character: char) -> bool {
|
||||
matches!(character, '\u{0391}'..='\u{03A9}' | '\u{03B1}'..='\u{03C9}')
|
||||
}
|
||||
|
||||
fn character_text(character: char) -> String {
|
||||
match character {
|
||||
'\u{FB00}' => "ff".to_owned(),
|
||||
@@ -646,8 +655,13 @@ impl Page {
|
||||
MathAtom::Space(_) => {}
|
||||
MathAtom::Symbol(character) => {
|
||||
if !character.is_whitespace() {
|
||||
let face = if character.is_ascii_alphabetic() || is_math_letter(*character) {
|
||||
FontFace::MathItalic
|
||||
} else {
|
||||
FontFace::Roman
|
||||
};
|
||||
list.push(DisplayItem::Text {
|
||||
font: FontFace::Roman,
|
||||
font: face,
|
||||
x,
|
||||
y: baseline,
|
||||
size,
|
||||
|
||||
Reference in new issue
Block a user