Name handling for New Computer Modern Math
This commit is contained in:
parent
85f95f75b7
commit
eabbbf7eae
@ -102,24 +102,24 @@ impl MathNode {
|
||||
}
|
||||
|
||||
impl Show for MathNode {
|
||||
fn show(&self, _: &mut Vt, _: &Content, styles: StyleChain) -> SourceResult<Content> {
|
||||
let mut map = StyleMap::new();
|
||||
map.set_family(FontFamily::new("NewComputerModernMath"), styles);
|
||||
|
||||
let mut realized = self
|
||||
.clone()
|
||||
.pack()
|
||||
.guarded(Guard::Base(NodeId::of::<Self>()))
|
||||
.styled_with_map(map);
|
||||
|
||||
fn show(&self, _: &mut Vt, _: &Content, _: StyleChain) -> SourceResult<Content> {
|
||||
let mut realized = self.clone().pack().guarded(Guard::Base(NodeId::of::<Self>()));
|
||||
if self.block {
|
||||
realized = realized.aligned(Axes::with_x(Some(Align::Center.into())))
|
||||
}
|
||||
|
||||
Ok(realized)
|
||||
}
|
||||
}
|
||||
|
||||
impl Finalize for MathNode {
|
||||
fn finalize(&self, realized: Content) -> Content {
|
||||
realized.styled(
|
||||
TextNode::FAMILY,
|
||||
FallbackList(vec![FontFamily::new("New Computer Modern Math")]),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Layout for MathNode {
|
||||
fn layout(
|
||||
&self,
|
||||
|
@ -299,7 +299,7 @@ fn decode_mac_roman(coded: &[u8]) -> String {
|
||||
coded.iter().copied().map(char_from_mac_roman).collect()
|
||||
}
|
||||
|
||||
/// Trim style naming from a family name.
|
||||
/// Trim style naming from a family name and fix bad names.
|
||||
fn typographic_family(mut family: &str) -> &str {
|
||||
// Separators between names, modifiers and styles.
|
||||
const SEPARATORS: [char; 3] = [' ', '-', '_'];
|
||||
@ -349,7 +349,11 @@ fn typographic_family(mut family: &str) -> &str {
|
||||
}
|
||||
}
|
||||
|
||||
&family[..len]
|
||||
// Fix bad names.
|
||||
match &family[..len] {
|
||||
"NewComputerModernMath" => "New Computer Modern Math",
|
||||
other => other,
|
||||
}
|
||||
}
|
||||
|
||||
/// How many words the two strings share in their prefix.
|
||||
|
@ -31,7 +31,7 @@ Emoji: 🐪, 🌋, 🏞
|
||||
]
|
||||
|
||||
// Disable font fallback beyond the user-specified list.
|
||||
// Without disabling, NewComputerModernMath would come to the rescue.
|
||||
// Without disabling, New Computer Modern Math would come to the rescue.
|
||||
#set text("PT Sans", "Twitter Color Emoji", fallback: false)
|
||||
2π = 𝛼 + 𝛽. ✅
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
:woman:old:
|
||||
:turtle:
|
||||
|
||||
#set text("NewComputerModernMath")
|
||||
#set text("New Computer Modern Math")
|
||||
:arrow:
|
||||
:arrow:l:
|
||||
:arrow:r:squiggly:
|
||||
|
Loading…
x
Reference in New Issue
Block a user