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": * #import "constants.typ": *
/// The main function for easy typography setup. /// The main function for easy typography setup.
/// - body-size: The size of body text (default 10pt). ///
/// - fonts: A dictionary specifying heading/body fonts. /// - body-size (): The size of body text (default 10pt).
/// - paper: The paper size to use (none to skip). /// - fonts (): A dictionary specifying heading/body fonts.
/// - margin: Margin for the page (none to skip). /// - paper (str): The paper size to use (none to skip).
/// - margin (): Margin for the page (none to skip).
/// -> content
#let easy-typography( #let easy-typography(
body-size: 10pt, body-size: 10pt,
fonts: (heading: "Libertinus Sans", body: "Libertinus Serif"), fonts: (heading: "Libertinus Sans", body: "Libertinus Serif"),
@@ -43,12 +45,20 @@
hyphenate: true, hyphenate: true,
kerning: true, kerning: true,
ligatures: 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: show table: set text(number-width: "tabular")
// - max = biggest size (H1), min = smallest size (H5), level in [1..5]
// - sqrt(t) => gives biggest decrease at top, gentlest at bottom /// 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) = { let compute-size(max, min, level) = {
if level <= 1 { if level <= 1 {
max max
Binary file not shown.

Before

Width:  |  Height:  |  Size: 770 KiB

After

Width:  |  Height:  |  Size: 769 KiB

Binary file not shown.
+1 -1
View File
@@ -6,7 +6,7 @@
#codly(languages: codly-languages) #codly(languages: codly-languages)
#show: easy-typography.with( #show: easy-typography.with(
fonts: (heading: "Source Sans Pro", body: "Source Serif Pro"), fonts: (heading: "Source Sans 3", body: "Source Serif 4"),
) )
= Introducing Easy Typography = Introducing Easy Typography