Map math alphabets onto Computer Modern Type1 faces

This commit is contained in:
gloamxun committed 2026-10-24 03:38:53 +08:00
1 parent a95cf8092e
commit a07d93510f
5 files changed
+142 -4

No files matched your search

+25
View File
@@ -682,6 +682,31 @@ impl Page {
cursor += font.width(character);
}
}
MathAtom::Alphabet { text, alphabet } => {
let metrics = math::alphabet_metrics(*font, *alphabet);
let face = match alphabet {
math::MathAlphabet::Roman => FontFace::Roman,
math::MathAlphabet::Bold => FontFace::Bold,
math::MathAlphabet::Italic => FontFace::MathItalic,
math::MathAlphabet::Sans => FontFace::Sans,
math::MathAlphabet::Mono => FontFace::Mono,
};
let mut cursor = x;
for character in text.chars() {
list.push(DisplayItem::Text {
font: face,
x: cursor,
y: baseline,
size,
text: character.to_string(),
});
cursor += if character == ' ' {
metrics.space()
} else {
metrics.width(character)
};
}
}
MathAtom::Row(atoms) => {
let mut cursor = x;
for child in atoms {