summaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-02-25 19:14:08 +0100
committerLaurenz <laurmaedje@gmail.com>2023-02-25 20:04:30 +0100
commit7597b997890647aa0546ec7bfef1eae4e33cedcb (patch)
tree286f2f30fe4814d1b5171ed166c9f162b152ce93 /library
parent49940fde7398a642f88c444700d482436266909d (diff)
New default style
Diffstat (limited to 'library')
-rw-r--r--library/src/math/mod.rs13
-rw-r--r--library/src/meta/heading.rs10
-rw-r--r--library/src/text/misc.rs1
-rw-r--r--library/src/text/mod.rs5
-rw-r--r--library/src/text/raw.rs7
-rw-r--r--library/src/text/shaping.rs2
6 files changed, 24 insertions, 14 deletions
diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs
index 84af15cb..c455d106 100644
--- a/library/src/math/mod.rs
+++ b/library/src/math/mod.rs
@@ -30,6 +30,7 @@ pub use self::underover::*;
use ttf_parser::{GlyphId, Rect};
use typst::font::Font;
+use typst::font::FontWeight;
use typst::model::{Guard, Module, Scope, SequenceNode, StyledNode};
use unicode_math_class::MathClass;
@@ -113,7 +114,7 @@ pub fn module() -> Module {
///
/// ## Example
/// ```example
-/// #set text("Latin Modern Roman")
+/// #set text("New Computer Modern")
///
/// Let $a$, $b$, and $c$ be the side
/// lengths of right-angled triangle.
@@ -179,10 +180,12 @@ impl Show for FormulaNode {
impl Finalize for FormulaNode {
fn finalize(&self, realized: Content) -> Content {
- realized.styled(
- TextNode::FAMILY,
- FallbackList(vec![FontFamily::new("New Computer Modern Math")]),
- )
+ realized
+ .styled(TextNode::WEIGHT, FontWeight::from_number(450))
+ .styled(
+ TextNode::FAMILY,
+ FallbackList(vec![FontFamily::new("New Computer Modern Math")]),
+ )
}
}
diff --git a/library/src/meta/heading.rs b/library/src/meta/heading.rs
index c9032e88..f108cad1 100644
--- a/library/src/meta/heading.rs
+++ b/library/src/meta/heading.rs
@@ -1,9 +1,9 @@
use typst::font::FontWeight;
use super::Numbering;
-use crate::layout::{BlockNode, VNode};
+use crate::layout::{BlockNode, HNode, VNode};
use crate::prelude::*;
-use crate::text::{SpaceNode, TextNode, TextSize};
+use crate::text::{TextNode, TextSize};
/// # Heading
/// A section heading.
@@ -145,7 +145,9 @@ impl Show for HeadingNode {
let mut realized = self.title.clone();
let numbers = this.field("numbers").unwrap();
if numbers != Value::None {
- realized = numbers.display() + SpaceNode.pack() + realized;
+ realized = numbers.display()
+ + HNode { amount: Em::new(0.3).into(), weak: true }.pack()
+ + realized;
}
Ok(BlockNode {
body: realized,
@@ -166,7 +168,7 @@ impl Finalize for HeadingNode {
let size = Em::new(scale);
let above = Em::new(if self.level.get() == 1 { 1.8 } else { 1.44 }) / scale;
- let below = Em::new(0.66) / scale;
+ let below = Em::new(0.75) / scale;
let mut map = StyleMap::new();
map.set(TextNode::SIZE, TextSize(size.into()));
diff --git a/library/src/text/misc.rs b/library/src/text/misc.rs
index 68d46d80..147f758a 100644
--- a/library/src/text/misc.rs
+++ b/library/src/text/misc.rs
@@ -321,7 +321,6 @@ impl Case {
/// ## Example
/// ```example
/// #set par(justify: true)
-/// #set text(family: "Noto Serif")
/// #set heading(numbering: "I.")
///
/// #show heading: it => {
diff --git a/library/src/text/mod.rs b/library/src/text/mod.rs
index 29217944..bdd2d0c2 100644
--- a/library/src/text/mod.rs
+++ b/library/src/text/mod.rs
@@ -80,7 +80,8 @@ impl TextNode {
impl TextNode {
/// A prioritized sequence of font families.
#[property(skip, referenced)]
- pub const FAMILY: FallbackList = FallbackList(vec![FontFamily::new("IBM Plex Sans")]);
+ pub const FAMILY: FallbackList =
+ FallbackList(vec![FontFamily::new("Linux Libertine")]);
/// Whether to allow last resort font fallback when the primary font list
/// contains no match. This lets Typst search through all available fonts
@@ -115,7 +116,7 @@ impl TextNode {
/// style later if you change your mind about how to signify the emphasis.
///
/// ```example
- /// #text("IBM Plex Sans", style: "italic")[Italic]
+ /// #text("Linux Libertine", style: "italic")[Italic]
/// #text("DejaVu Sans", style: "oblique")[Oblique]
/// ```
pub const STYLE: FontStyle = FontStyle::Normal;
diff --git a/library/src/text/raw.rs b/library/src/text/raw.rs
index 225c257d..ec11582c 100644
--- a/library/src/text/raw.rs
+++ b/library/src/text/raw.rs
@@ -4,6 +4,7 @@ use typst::syntax::{self, LinkedNode};
use super::{
FallbackList, FontFamily, Hyphenate, LinebreakNode, SmartQuoteNode, TextNode,
+ TextSize,
};
use crate::layout::BlockNode;
use crate::prelude::*;
@@ -216,8 +217,12 @@ impl Finalize for RawNode {
let mut map = StyleMap::new();
map.set(TextNode::OVERHANG, false);
map.set(TextNode::HYPHENATE, Hyphenate(Smart::Custom(false)));
+ map.set(TextNode::SIZE, TextSize(Em::new(0.8).into()));
+ map.set(
+ TextNode::FAMILY,
+ FallbackList(vec![FontFamily::new("DejaVu Sans Mono")]),
+ );
map.set(SmartQuoteNode::ENABLED, false);
- map.set(TextNode::FAMILY, FallbackList(vec![FontFamily::new("IBM Plex Mono")]));
realized.styled_with_map(map)
}
}
diff --git a/library/src/text/shaping.rs b/library/src/text/shaping.rs
index 6d4e41dc..feb9b24b 100644
--- a/library/src/text/shaping.rs
+++ b/library/src/text/shaping.rs
@@ -551,7 +551,7 @@ pub fn variant(styles: StyleChain) -> FontVariant {
/// Resolve a prioritized iterator over the font families.
pub fn families(styles: StyleChain) -> impl Iterator<Item = &str> + Clone {
const FALLBACKS: &[&str] = &[
- "ibm plex sans",
+ "linux libertine",
"twitter color emoji",
"noto color emoji",
"apple color emoji",