Draw mathbb letters from msbm10
This commit is contained in:
1 parent
e229809581
commit
cb40cc4634
7 files changed
+122
-1
No files matched your search
@@ -14,6 +14,7 @@ pub enum MathAlphabet {
|
||||
Sans,
|
||||
Mono,
|
||||
Calligraphic,
|
||||
Blackboard,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
@@ -307,6 +308,7 @@ pub(crate) fn alphabet_metrics(font: Cmr10Metrics, alphabet: MathAlphabet) -> Cm
|
||||
Cmr10Metrics::for_paragraph_font(crate::paragraph::ParagraphFont::Mono)
|
||||
}
|
||||
MathAlphabet::Calligraphic => Cmr10Metrics::MathCalligraphic,
|
||||
MathAlphabet::Blackboard => Cmr10Metrics::MathBlackboard,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1347,6 +1349,7 @@ fn parse_atom(chars: &[char], index: usize) -> (MathAtom, usize) {
|
||||
"mathsf" => Some(MathAlphabet::Sans),
|
||||
"mathtt" => Some(MathAlphabet::Mono),
|
||||
"mathcal" => Some(MathAlphabet::Calligraphic),
|
||||
"mathbb" => Some(MathAlphabet::Blackboard),
|
||||
_ => None,
|
||||
};
|
||||
match alphabet {
|
||||
@@ -1571,6 +1574,18 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mathbb_uses_blackboard_widths() {
|
||||
let font = Cmr10Metrics::default();
|
||||
let blackboard = layout_math(&parse_math("\\mathbb{A}"), &font);
|
||||
let upright = layout_math(&parse_math("\\mathrm{A}"), &font);
|
||||
assert_ne!(blackboard.width, upright.width);
|
||||
assert_eq!(
|
||||
blackboard.width,
|
||||
crate::cmr10::math_blackboard_width('A').expect("msbm has blackboard capitals")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn smash_can_target_only_the_top_or_bottom() {
|
||||
let font = Cmr10Metrics::default();
|
||||
|
||||
Reference in new issue
Block a user