fix(easy-typography): incorporates changes from community

Incoroporates changes from [this
PR](https://github.com/typst/packages/pull/1527) and updates tests
accordingly.

Thank you to [neuralpain](https://github.com/neuralpain) and
[ssotoen](https://github.com/ssotoen) for the suggestions and code
fixes.
This commit is contained in:
swaits committed 2025-01-09 12:06:06 -07:00
1 parent 5ad6c10b65
commit 093fcf88fd
4 files changed
+19 -9

No files matched your search

+18 -8
View File
@@ -1,10 +1,12 @@
#import "constants.typ": *
/// The main function for easy typography setup.
/// - body-size: The size of body text (default 10pt).
/// - fonts: A dictionary specifying heading/body fonts.
/// - paper: The paper size to use (none to skip).
/// - margin: Margin for the page (none to skip).
///
/// - body-size (): The size of body text (default 10pt).
/// - fonts (): A dictionary specifying heading/body fonts.
/// - paper (str): The paper size to use (none to skip).
/// - margin (): Margin for the page (none to skip).
/// -> content
#let easy-typography(
body-size: 10pt,
fonts: (heading: "Libertinus Sans", body: "Libertinus Serif"),
@@ -43,12 +45,20 @@
hyphenate: true,
kerning: true,
ligatures: true,
number-type: "lining",
number-width: "proportional",
// number-type: "lining", // commented: intentionally left up to the font to choose
)
// Top-heavy easing function for heading sizes/spacing:
// - max = biggest size (H1), min = smallest size (H5), level in [1..5]
// - sqrt(t) => gives biggest decrease at top, gentlest at bottom
show table: set text(number-width: "tabular")
/// Top-heavy easing function for heading sizes/spacing.
///
/// `sqrt(t)` gives biggest decrease at top, gentlest at bottom.
///
/// - max (length): Biggest size (H1)
/// - min (length): Smallest size (H5)
/// - level (length): From 1 to 5
/// -> length
let compute-size(max, min, level) = {
if level <= 1 {
max