From e1a9166e1d6a24076796efaf4eec073567bfb037 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 7 Mar 2025 09:22:42 +0100 Subject: [PATCH 01/10] Hotfix for labels on symbols (#6015) --- crates/typst-realize/src/lib.rs | 5 ++++- tests/ref/issue-5930-symbol-label.png | Bin 0 -> 243 bytes tests/suite/symbols/symbol.typ | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/ref/issue-5930-symbol-label.png diff --git a/crates/typst-realize/src/lib.rs b/crates/typst-realize/src/lib.rs index 50685a962..151ae76ba 100644 --- a/crates/typst-realize/src/lib.rs +++ b/crates/typst-realize/src/lib.rs @@ -326,7 +326,10 @@ fn visit_math_rules<'a>( // Symbols in non-math content transparently convert to `TextElem` so we // don't have to handle them in non-math layout. if let Some(elem) = content.to_packed::() { - let text = TextElem::packed(elem.text).spanned(elem.span()); + let mut text = TextElem::packed(elem.text).spanned(elem.span()); + if let Some(label) = elem.label() { + text.set_label(label); + } visit(s, s.store(text), styles)?; return Ok(true); } diff --git a/tests/ref/issue-5930-symbol-label.png b/tests/ref/issue-5930-symbol-label.png new file mode 100644 index 0000000000000000000000000000000000000000..e8127aa0cc494f76def5a178a1985e2ceb294f94 GIT binary patch literal 243 zcmV@g#X!k|JZr|%uUb4ul2)7>$^n8xuD{*KiR4}*s40knJ~PO zEV76vgJ>{#SQT(i1!hG6U}$ZP0001HNklEz3` t-N$in$PcO^<-AY_xoBX~AE|Thn+MaJ1Fvqfmev3O002ovPDHLkV1n1FcTE5Q literal 0 HcmV?d00001 diff --git a/tests/suite/symbols/symbol.typ b/tests/suite/symbols/symbol.typ index 6d2513c1f..5bc2cafae 100644 --- a/tests/suite/symbols/symbol.typ +++ b/tests/suite/symbols/symbol.typ @@ -151,3 +151,7 @@ --- symbol-sect-deprecated --- // Warning: 5-9 `sect` is deprecated, use `inter` instead $ A sect B = A inter B $ + +--- issue-5930-symbol-label --- +#emoji.face +#context test(query().first().text, "😀") From 99b7d2898e802356c66fed01179d42cab9198617 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 7 Mar 2025 09:47:56 +0100 Subject: [PATCH 02/10] Replace `par` function call in tutorial (#6023) --- docs/tutorial/2-formatting.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/tutorial/2-formatting.md b/docs/tutorial/2-formatting.md index fabb544f4..a8c72cefe 100644 --- a/docs/tutorial/2-formatting.md +++ b/docs/tutorial/2-formatting.md @@ -13,11 +13,11 @@ your report using Typst's styling system. As we have seen in the previous chapter, Typst has functions that _insert_ content (e.g. the [`image`] function) and others that _manipulate_ content that they received as arguments (e.g. the [`align`] function). The first impulse you -might have when you want, for example, to justify the report, could be to look +might have when you want, for example, to change the font, could be to look for a function that does that and wrap the complete document in it. ```example -#par(justify: true)[ +#text(font: "New Computer Modern")[ = Background In the case of glaciers, fluid dynamics principles can be used @@ -37,9 +37,9 @@ do in Typst, there is special syntax for it: Instead of putting the content inside of the argument list, you can write it in square brackets directly after the normal arguments, saving on punctuation. -As seen above, that works. The [`par`] function justifies all paragraphs within -it. However, wrapping the document in countless functions and applying styles -selectively and in-situ can quickly become cumbersome. +As seen above, that works. With the [`text`] function, we can adjust the font +for all text within it. However, wrapping the document in countless functions +and applying styles selectively and in-situ can quickly become cumbersome. Fortunately, Typst has a more elegant solution. With _set rules,_ you can apply style properties to all occurrences of some kind of content. You write a set @@ -47,7 +47,9 @@ rule by entering the `{set}` keyword, followed by the name of the function whose properties you want to set, and a list of arguments in parentheses. ```example -#set par(justify: true) +#set text( + font: "New Computer Modern" +) = Background In the case of glaciers, fluid From e0b2c32a8ee6fd5bb43e7f8973972d76bdef573b Mon Sep 17 00:00:00 2001 From: Malo <57839069+MDLC01@users.noreply.github.com> Date: Fri, 7 Mar 2025 10:05:16 +0100 Subject: [PATCH 03/10] Mention that `sym.ohm` was removed in the 0.13.0 changelog (#6017) Co-authored-by: Laurenz --- docs/changelog/0.13.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog/0.13.0.md b/docs/changelog/0.13.0.md index 6c2fe4275..50e7fca72 100644 --- a/docs/changelog/0.13.0.md +++ b/docs/changelog/0.13.0.md @@ -294,7 +294,6 @@ feature flag. `errorbar.diamond.stroked`, `errorbar.diamond.filled`, `errorbar.circle.stroked`, `errorbar.circle.filled` - `numero` - - `Omega.inv` - Renamed - `ohm.inv` to `Omega.inv` - Changed codepoint @@ -308,6 +307,7 @@ feature flag. - `degree.c` in favor of `°C` (`[$upright(°C)$]` or `[$upright(degree C)$]` in math) - `degree.f` in favor of `°F` (`[$upright(°F)$]` or `[$upright(degree F)$]` in math) - `kelvin` in favor of just K (`[$upright(K)$]` in math) + - `ohm` in favor of `Omega` ## Deprecations - The [`path`] function in favor of the [`curve`] function From 476c2df312e8c80ff455a355ce1e987312444cb8 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 7 Mar 2025 10:17:11 +0100 Subject: [PATCH 04/10] Mark breaking symbol changes as breaking in 0.13.0 changelog (#6024) --- docs/changelog/0.13.0.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/changelog/0.13.0.md b/docs/changelog/0.13.0.md index 50e7fca72..1cca48aa2 100644 --- a/docs/changelog/0.13.0.md +++ b/docs/changelog/0.13.0.md @@ -294,16 +294,16 @@ feature flag. `errorbar.diamond.stroked`, `errorbar.diamond.filled`, `errorbar.circle.stroked`, `errorbar.circle.filled` - `numero` -- Renamed +- Renamed **(Breaking change)** - `ohm.inv` to `Omega.inv` -- Changed codepoint +- Changed codepoint **(Breaking change)** - `angle.l.double` from `《` to `⟪` - `angle.r.double` from `》` to `⟫` - `angstrom` from U+212B (`Å`) to U+00C5 (`Å`) - Deprecated - `sect` and all its variants in favor of `inter` - `integral.sect` in favor of `integral.inter` -- Removed +- Removed **(Breaking change)** - `degree.c` in favor of `°C` (`[$upright(°C)$]` or `[$upright(degree C)$]` in math) - `degree.f` in favor of `°F` (`[$upright(°F)$]` or `[$upright(degree F)$]` in math) - `kelvin` in favor of just K (`[$upright(K)$]` in math) From 8d3488a07df83760cafa1e17bf4ed4de415a4d69 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 7 Mar 2025 11:03:52 +0100 Subject: [PATCH 05/10] 0.13.1 changelog (#6025) --- docs/changelog/0.13.1.md | 26 ++++++++++++++++++++++++++ docs/changelog/welcome.md | 1 + docs/src/lib.rs | 1 + 3 files changed, 28 insertions(+) create mode 100644 docs/changelog/0.13.1.md diff --git a/docs/changelog/0.13.1.md b/docs/changelog/0.13.1.md new file mode 100644 index 000000000..15bd9f6d8 --- /dev/null +++ b/docs/changelog/0.13.1.md @@ -0,0 +1,26 @@ +--- +title: 0.13.1 +description: Changes in Typst 0.13.1 +--- + +# Version 0.13.1 + +## Command Line Interface +- Fixed high CPU usage for `typst watch` on Linux. Depending on the project + size, CPU usage would spike for varying amounts of time. This bug appeared + with 0.13.0 due to a behavioral change in the inotify file watching backend. + +## HTML export +- Fixed export of tables with [gutters]($table.gutter) +- Fixed usage of `` and `` element within [context] +- Fixed querying of [metadata] next to `` and `` element + +## Visualization +- Fixed [curves]($curve) with multiple non-closed components + +## Introspection +- Fixed a regression where labelled [symbols]($symbol) could not be + [queried]($query) by label + +## Deprecations +- Fixed false positives in deprecation warnings for type/str comparisons diff --git a/docs/changelog/welcome.md b/docs/changelog/welcome.md index 8fb85f870..7611f1c44 100644 --- a/docs/changelog/welcome.md +++ b/docs/changelog/welcome.md @@ -10,6 +10,7 @@ forward. This section documents all changes to Typst since its initial public release. ## Versions +- [Typst 0.13.1]($changelog/0.13.1) - [Typst 0.13.0]($changelog/0.13.0) - [Typst 0.12.0]($changelog/0.12.0) - [Typst 0.11.1]($changelog/0.11.1) diff --git a/docs/src/lib.rs b/docs/src/lib.rs index e9771738d..091bb1b24 100644 --- a/docs/src/lib.rs +++ b/docs/src/lib.rs @@ -188,6 +188,7 @@ fn changelog_pages(resolver: &dyn Resolver) -> PageModel { let mut page = md_page(resolver, resolver.base(), load!("changelog/welcome.md")); let base = format!("{}changelog/", resolver.base()); page.children = vec![ + md_page(resolver, &base, load!("changelog/0.13.1.md")), md_page(resolver, &base, load!("changelog/0.13.0.md")), md_page(resolver, &base, load!("changelog/0.12.0.md")), md_page(resolver, &base, load!("changelog/0.11.1.md")), From db9a83d9fc2c9928bcfbc78ccafc2a799ccca2f0 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 7 Mar 2025 11:19:12 +0100 Subject: [PATCH 06/10] Bump version on main The tagged commit itself is on the 0.13 branch. --- Cargo.lock | 48 ++++++++++++++++++++-------------------- Cargo.toml | 38 +++++++++++++++---------------- docs/changelog/0.13.1.md | 5 ++++- 3 files changed, 47 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 86f04ee52..85698d8bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "adler2" @@ -2735,7 +2735,7 @@ checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" [[package]] name = "typst" -version = "0.13.0" +version = "0.13.1" dependencies = [ "comemo", "ecow", @@ -2752,12 +2752,12 @@ dependencies = [ [[package]] name = "typst-assets" -version = "0.13.0" -source = "git+https://github.com/typst/typst-assets?rev=fa0f8a4#fa0f8a438cc4bc2113cc0aa3304cd68cdc2bc020" +version = "0.13.1" +source = "git+https://github.com/typst/typst-assets?rev=ab1295f#ab1295ff896444e51902e03c2669955e1d73604a" [[package]] name = "typst-cli" -version = "0.13.0" +version = "0.13.1" dependencies = [ "chrono", "clap", @@ -2802,12 +2802,12 @@ dependencies = [ [[package]] name = "typst-dev-assets" -version = "0.13.0" -source = "git+https://github.com/typst/typst-dev-assets?rev=61aebe9#61aebe9575a5abff889f76d73c7b01dc8e17e340" +version = "0.13.1" +source = "git+https://github.com/typst/typst-dev-assets?rev=9879589#9879589f4b3247b12c5e694d0d7fa86d4d8a198e" [[package]] name = "typst-docs" -version = "0.13.0" +version = "0.13.1" dependencies = [ "clap", "ecow", @@ -2830,7 +2830,7 @@ dependencies = [ [[package]] name = "typst-eval" -version = "0.13.0" +version = "0.13.1" dependencies = [ "comemo", "ecow", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "typst-fuzz" -version = "0.13.0" +version = "0.13.1" dependencies = [ "comemo", "libfuzzer-sys", @@ -2860,7 +2860,7 @@ dependencies = [ [[package]] name = "typst-html" -version = "0.13.0" +version = "0.13.1" dependencies = [ "comemo", "ecow", @@ -2874,7 +2874,7 @@ dependencies = [ [[package]] name = "typst-ide" -version = "0.13.0" +version = "0.13.1" dependencies = [ "comemo", "ecow", @@ -2891,7 +2891,7 @@ dependencies = [ [[package]] name = "typst-kit" -version = "0.13.0" +version = "0.13.1" dependencies = [ "dirs", "ecow", @@ -2914,7 +2914,7 @@ dependencies = [ [[package]] name = "typst-layout" -version = "0.13.0" +version = "0.13.1" dependencies = [ "az", "bumpalo", @@ -2944,7 +2944,7 @@ dependencies = [ [[package]] name = "typst-library" -version = "0.13.0" +version = "0.13.1" dependencies = [ "az", "bitflags 2.8.0", @@ -3005,7 +3005,7 @@ dependencies = [ [[package]] name = "typst-macros" -version = "0.13.0" +version = "0.13.1" dependencies = [ "heck", "proc-macro2", @@ -3015,7 +3015,7 @@ dependencies = [ [[package]] name = "typst-pdf" -version = "0.13.0" +version = "0.13.1" dependencies = [ "arrayvec", "base64", @@ -3041,7 +3041,7 @@ dependencies = [ [[package]] name = "typst-realize" -version = "0.13.0" +version = "0.13.1" dependencies = [ "arrayvec", "bumpalo", @@ -3057,7 +3057,7 @@ dependencies = [ [[package]] name = "typst-render" -version = "0.13.0" +version = "0.13.1" dependencies = [ "bytemuck", "comemo", @@ -3073,7 +3073,7 @@ dependencies = [ [[package]] name = "typst-svg" -version = "0.13.0" +version = "0.13.1" dependencies = [ "base64", "comemo", @@ -3091,7 +3091,7 @@ dependencies = [ [[package]] name = "typst-syntax" -version = "0.13.0" +version = "0.13.1" dependencies = [ "ecow", "serde", @@ -3107,7 +3107,7 @@ dependencies = [ [[package]] name = "typst-tests" -version = "0.13.0" +version = "0.13.1" dependencies = [ "clap", "comemo", @@ -3132,7 +3132,7 @@ dependencies = [ [[package]] name = "typst-timing" -version = "0.13.0" +version = "0.13.1" dependencies = [ "parking_lot", "serde", @@ -3142,7 +3142,7 @@ dependencies = [ [[package]] name = "typst-utils" -version = "0.13.0" +version = "0.13.1" dependencies = [ "once_cell", "portable-atomic", diff --git a/Cargo.toml b/Cargo.toml index f643856e1..0bfd92821 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ default-members = ["crates/typst-cli"] resolver = "2" [workspace.package] -version = "0.13.0" +version = "0.13.1" rust-version = "1.83" # also change in ci.yml authors = ["The Typst Project Developers"] edition = "2021" @@ -16,24 +16,24 @@ keywords = ["typst"] readme = "README.md" [workspace.dependencies] -typst = { path = "crates/typst", version = "0.13.0" } -typst-cli = { path = "crates/typst-cli", version = "0.13.0" } -typst-eval = { path = "crates/typst-eval", version = "0.13.0" } -typst-html = { path = "crates/typst-html", version = "0.13.0" } -typst-ide = { path = "crates/typst-ide", version = "0.13.0" } -typst-kit = { path = "crates/typst-kit", version = "0.13.0" } -typst-layout = { path = "crates/typst-layout", version = "0.13.0" } -typst-library = { path = "crates/typst-library", version = "0.13.0" } -typst-macros = { path = "crates/typst-macros", version = "0.13.0" } -typst-pdf = { path = "crates/typst-pdf", version = "0.13.0" } -typst-realize = { path = "crates/typst-realize", version = "0.13.0" } -typst-render = { path = "crates/typst-render", version = "0.13.0" } -typst-svg = { path = "crates/typst-svg", version = "0.13.0" } -typst-syntax = { path = "crates/typst-syntax", version = "0.13.0" } -typst-timing = { path = "crates/typst-timing", version = "0.13.0" } -typst-utils = { path = "crates/typst-utils", version = "0.13.0" } -typst-assets = { git = "https://github.com/typst/typst-assets", rev = "fa0f8a4" } -typst-dev-assets = { git = "https://github.com/typst/typst-dev-assets", rev = "61aebe9" } +typst = { path = "crates/typst", version = "0.13.1" } +typst-cli = { path = "crates/typst-cli", version = "0.13.1" } +typst-eval = { path = "crates/typst-eval", version = "0.13.1" } +typst-html = { path = "crates/typst-html", version = "0.13.1" } +typst-ide = { path = "crates/typst-ide", version = "0.13.1" } +typst-kit = { path = "crates/typst-kit", version = "0.13.1" } +typst-layout = { path = "crates/typst-layout", version = "0.13.1" } +typst-library = { path = "crates/typst-library", version = "0.13.1" } +typst-macros = { path = "crates/typst-macros", version = "0.13.1" } +typst-pdf = { path = "crates/typst-pdf", version = "0.13.1" } +typst-realize = { path = "crates/typst-realize", version = "0.13.1" } +typst-render = { path = "crates/typst-render", version = "0.13.1" } +typst-svg = { path = "crates/typst-svg", version = "0.13.1" } +typst-syntax = { path = "crates/typst-syntax", version = "0.13.1" } +typst-timing = { path = "crates/typst-timing", version = "0.13.1" } +typst-utils = { path = "crates/typst-utils", version = "0.13.1" } +typst-assets = { git = "https://github.com/typst/typst-assets", rev = "ab1295f" } +typst-dev-assets = { git = "https://github.com/typst/typst-dev-assets", rev = "9879589" } arrayvec = "0.7.4" az = "1.2" base64 = "0.22" diff --git a/docs/changelog/0.13.1.md b/docs/changelog/0.13.1.md index 15bd9f6d8..caf523e1c 100644 --- a/docs/changelog/0.13.1.md +++ b/docs/changelog/0.13.1.md @@ -3,7 +3,7 @@ title: 0.13.1 description: Changes in Typst 0.13.1 --- -# Version 0.13.1 +# Version 0.13.1 (March 7, 2025) ## Command Line Interface - Fixed high CPU usage for `typst watch` on Linux. Depending on the project @@ -24,3 +24,6 @@ description: Changes in Typst 0.13.1 ## Deprecations - Fixed false positives in deprecation warnings for type/str comparisons + +## Contributors + From e66e190a21be9fdb62191d023362154d7c24ffa9 Mon Sep 17 00:00:00 2001 From: Ludovico Gerardi Date: Mon, 10 Mar 2025 12:39:30 +0100 Subject: [PATCH 07/10] Fix typo in docs (#6034) --- crates/typst-library/src/foundations/func.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/typst-library/src/foundations/func.rs b/crates/typst-library/src/foundations/func.rs index 66c6b70a5..27eb34eac 100644 --- a/crates/typst-library/src/foundations/func.rs +++ b/crates/typst-library/src/foundations/func.rs @@ -112,7 +112,7 @@ use crate::foundations::{ /// it into another file by writing `{import "foo.typ": alert}`. /// /// # Unnamed functions { #unnamed } -/// You can also created an unnamed function without creating a binding by +/// You can also create an unnamed function without creating a binding by /// specifying a parameter list followed by `=>` and the function body. If your /// function has just one parameter, the parentheses around the parameter list /// are optional. Unnamed functions are mainly useful for show rules, but also From bd531e08dc3dbe26ac779d5730bf0814800b7de9 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 10 Mar 2025 15:45:08 +0300 Subject: [PATCH 08/10] Bump `rustybuzz` (and adjacent crates) (#5407) --- Cargo.lock | 40 ++++++++++++++++++------------------ Cargo.toml | 14 ++++++------- crates/typst-pdf/src/font.rs | 2 +- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 85698d8bb..ac08b57ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -772,9 +772,9 @@ dependencies = [ [[package]] name = "fontdb" -version = "0.21.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37be9fc20d966be438cd57a45767f73349477fb0f85ce86e000557f787298afb" +checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905" dependencies = [ "fontconfig-parser", "log", @@ -1175,9 +1175,9 @@ dependencies = [ [[package]] name = "image-webp" -version = "0.1.3" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f79afb8cbee2ef20f59ccd477a218c12a93943d075b492015ecb1bb81f8ee904" +checksum = "b77d01e822461baa8409e156015a1d91735549f0f2c17691bd2d996bef238f7f" dependencies = [ "byteorder-lite", "quick-error", @@ -1804,9 +1804,9 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" [[package]] name = "pixglyph" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d15afa937836bf3d876f5a04ce28810c06045857bf46c3d0d31073b8aada5494" +checksum = "3c1106193bc18a4b840eb075ff6664c8a0b0270f0531bb12a7e9c803e53b55c5" dependencies = [ "ttf-parser", ] @@ -2048,9 +2048,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "resvg" -version = "0.43.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7314563c59c7ce31c18e23ad3dd092c37b928a0fa4e1c0a1a6504351ab411d1" +checksum = "dd43d1c474e9dadf09a8fdf22d713ba668b499b5117b9b9079500224e26b5b29" dependencies = [ "gif", "image-webp", @@ -2121,9 +2121,9 @@ checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "rustybuzz" -version = "0.18.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85d1ccd519e61834798eb52c4e886e8c2d7d698dd3d6ce0b1b47eb8557f1181" +checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702" dependencies = [ "bitflags 2.8.0", "bytemuck", @@ -2410,9 +2410,9 @@ checksum = "74f98178f34057d4d4de93d68104007c6dea4dfac930204a69ab4622daefa648" [[package]] name = "svg2pdf" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5014c9dadcf318fb7ef8c16438e95abcc9de1ae24d60d5bccc64c55100c50364" +checksum = "e50dc062439cc1a396181059c80932a6e6bd731b130e674c597c0c8874b6df22" dependencies = [ "fontdb", "image", @@ -2709,9 +2709,9 @@ dependencies = [ [[package]] name = "ttf-parser" -version = "0.24.1" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be21190ff5d38e8b4a2d3b6a3ae57f612cc39c96e83cedeaf7abc338a8bac4a" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" dependencies = [ "core_maths", ] @@ -3185,15 +3185,15 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-bidi-mirroring" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64af057ad7466495ca113126be61838d8af947f41d93a949980b2389a118082f" +checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe" [[package]] name = "unicode-ccc" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "260bc6647b3893a9a90668360803a15f96b85a5257b1c3a0c3daf6ae2496de42" +checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e" [[package]] name = "unicode-ident" @@ -3288,9 +3288,9 @@ dependencies = [ [[package]] name = "usvg" -version = "0.43.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6803057b5cbb426e9fb8ce2216f3a9b4ca1dd2c705ba3cbebc13006e437735fd" +checksum = "2ac8e0e3e4696253dc06167990b3fe9a2668ab66270adf949a464db4088cb354" dependencies = [ "base64", "data-url", diff --git a/Cargo.toml b/Cargo.toml index 0bfd92821..40abaaca7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,7 @@ dirs = "6" ecow = { version = "0.2", features = ["serde"] } env_proxy = "0.4" flate2 = "1" -fontdb = { version = "0.21", default-features = false } +fontdb = { version = "0.23", default-features = false } fs_extra = "1.3" hayagriva = "0.8.1" heck = "0.5" @@ -86,7 +86,7 @@ parking_lot = "0.12.1" pathdiff = "0.2" pdf-writer = "0.12.1" phf = { version = "0.11", features = ["macros"] } -pixglyph = "0.5.1" +pixglyph = "0.6" png = "0.17" portable-atomic = "1.6" proc-macro2 = "1" @@ -96,10 +96,10 @@ quote = "1" rayon = "1.7.0" regex = "1" regex-syntax = "0.8" -resvg = { version = "0.43", default-features = false, features = ["raster-images"] } +resvg = { version = "0.45", default-features = false, features = ["raster-images"] } roxmltree = "0.20" rust_decimal = { version = "1.36.0", default-features = false, features = ["maths"] } -rustybuzz = "0.18" +rustybuzz = "0.20" same-file = "1" self-replace = "1.3.7" semver = "1" @@ -112,7 +112,7 @@ siphasher = "1" smallvec = { version = "1.11.1", features = ["union", "const_generics", "const_new"] } stacker = "0.1.15" subsetter = "0.2" -svg2pdf = "0.12" +svg2pdf = "0.13" syn = { version = "2", features = ["full", "extra-traits"] } syntect = { version = "5", default-features = false, features = ["parsing", "regex-fancy", "plist-load", "yaml-load"] } tar = "0.4" @@ -122,7 +122,7 @@ time = { version = "0.3.20", features = ["formatting", "macros", "parsing"] } tiny_http = "0.12" tiny-skia = "0.11" toml = { version = "0.8", default-features = false, features = ["parse", "display"] } -ttf-parser = "0.24.1" +ttf-parser = "0.25.0" two-face = { version = "0.4.3", default-features = false, features = ["syntect-fancy"] } typed-arena = "2" unicode-bidi = "0.3.18" @@ -133,7 +133,7 @@ unicode-normalization = "0.1.24" unicode-segmentation = "1" unscanny = "0.1" ureq = { version = "2", default-features = false, features = ["native-tls", "gzip", "json"] } -usvg = { version = "0.43", default-features = false, features = ["text"] } +usvg = { version = "0.45", default-features = false, features = ["text"] } walkdir = "2" wasmi = "0.40.0" web-sys = "0.3" diff --git a/crates/typst-pdf/src/font.rs b/crates/typst-pdf/src/font.rs index 93d75e50e..f2df2ac92 100644 --- a/crates/typst-pdf/src/font.rs +++ b/crates/typst-pdf/src/font.rs @@ -180,7 +180,7 @@ pub fn write_font_descriptor<'a>( font.to_em(global_bbox.y_max).to_font_units(), ); - let italic_angle = ttf.italic_angle().unwrap_or(0.0); + let italic_angle = ttf.italic_angle(); let ascender = metrics.ascender.to_font_units(); let descender = metrics.descender.to_font_units(); let cap_height = metrics.cap_height.to_font_units(); From 3650859ae8823f47c9f50db6ad5ed52a0477bf15 Mon Sep 17 00:00:00 2001 From: evie <50974538+mi2ebi@users.noreply.github.com> Date: Tue, 11 Mar 2025 03:00:53 -0700 Subject: [PATCH 09/10] Fix `cargo clippy` warnings (mostly about `.repeat.take` and `.next_back`) (#6038) --- crates/typst-ide/src/analyze.rs | 2 +- crates/typst-layout/src/flow/compose.rs | 2 +- crates/typst-layout/src/grid/layouter.rs | 2 +- crates/typst-layout/src/math/stretch.rs | 2 +- crates/typst-library/src/foundations/cast.rs | 2 +- crates/typst-library/src/model/numbering.rs | 2 +- crates/typst-library/src/visualize/gradient.rs | 3 +-- crates/typst-render/src/shape.rs | 8 +++++--- 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/crates/typst-ide/src/analyze.rs b/crates/typst-ide/src/analyze.rs index 7ee83e709..c493da81a 100644 --- a/crates/typst-ide/src/analyze.rs +++ b/crates/typst-ide/src/analyze.rs @@ -26,7 +26,7 @@ pub fn analyze_expr( ast::Expr::Str(v) => Value::Str(v.get().into()), _ => { if node.kind() == SyntaxKind::Contextual { - if let Some(child) = node.children().last() { + if let Some(child) = node.children().next_back() { return analyze_expr(world, &child); } } diff --git a/crates/typst-layout/src/flow/compose.rs b/crates/typst-layout/src/flow/compose.rs index 76af8f650..54dc487a3 100644 --- a/crates/typst-layout/src/flow/compose.rs +++ b/crates/typst-layout/src/flow/compose.rs @@ -115,7 +115,7 @@ impl<'a, 'b> Composer<'a, 'b, '_, '_> { let column_height = regions.size.y; let backlog: Vec<_> = std::iter::once(&column_height) .chain(regions.backlog) - .flat_map(|&h| std::iter::repeat(h).take(self.config.columns.count)) + .flat_map(|&h| std::iter::repeat_n(h, self.config.columns.count)) .skip(1) .collect(); diff --git a/crates/typst-layout/src/grid/layouter.rs b/crates/typst-layout/src/grid/layouter.rs index af47ff72f..dc9e2238d 100644 --- a/crates/typst-layout/src/grid/layouter.rs +++ b/crates/typst-layout/src/grid/layouter.rs @@ -1469,7 +1469,7 @@ impl<'a> GridLayouter<'a> { // last height is the one for the current region. rowspan .heights - .extend(std::iter::repeat(Abs::zero()).take(amount_missing_heights)); + .extend(std::iter::repeat_n(Abs::zero(), amount_missing_heights)); // Ensure that, in this region, the rowspan will span at least // this row. diff --git a/crates/typst-layout/src/math/stretch.rs b/crates/typst-layout/src/math/stretch.rs index dafa8cbe8..f45035e27 100644 --- a/crates/typst-layout/src/math/stretch.rs +++ b/crates/typst-layout/src/math/stretch.rs @@ -302,6 +302,6 @@ fn assemble( fn parts(assembly: GlyphAssembly, repeat: usize) -> impl Iterator + '_ { assembly.parts.into_iter().flat_map(move |part| { let count = if part.part_flags.extender() { repeat } else { 1 }; - std::iter::repeat(part).take(count) + std::iter::repeat_n(part, count) }) } diff --git a/crates/typst-library/src/foundations/cast.rs b/crates/typst-library/src/foundations/cast.rs index 38f409c67..73645491f 100644 --- a/crates/typst-library/src/foundations/cast.rs +++ b/crates/typst-library/src/foundations/cast.rs @@ -21,7 +21,7 @@ use crate::foundations::{ /// /// Type casting works as follows: /// - [`Reflect for T`](Reflect) describes the possible Typst values for `T` -/// (for documentation and autocomplete). +/// (for documentation and autocomplete). /// - [`IntoValue for T`](IntoValue) is for conversion from `T -> Value` /// (infallible) /// - [`FromValue for T`](FromValue) is for conversion from `Value -> T` diff --git a/crates/typst-library/src/model/numbering.rs b/crates/typst-library/src/model/numbering.rs index 150506758..ada8a3965 100644 --- a/crates/typst-library/src/model/numbering.rs +++ b/crates/typst-library/src/model/numbering.rs @@ -394,7 +394,7 @@ impl NumberingKind { const SYMBOLS: &[char] = &['*', '†', '‡', '§', '¶', '‖']; let symbol = SYMBOLS[(n - 1) % SYMBOLS.len()]; let amount = ((n - 1) / SYMBOLS.len()) + 1; - std::iter::repeat(symbol).take(amount).collect() + std::iter::repeat_n(symbol, amount).collect() } Self::Hebrew => hebrew_numeral(n), diff --git a/crates/typst-library/src/visualize/gradient.rs b/crates/typst-library/src/visualize/gradient.rs index 1a723a9f5..d59175a4e 100644 --- a/crates/typst-library/src/visualize/gradient.rs +++ b/crates/typst-library/src/visualize/gradient.rs @@ -574,8 +574,7 @@ impl Gradient { } let n = repetitions.v; - let mut stops = std::iter::repeat(self.stops_ref()) - .take(n) + let mut stops = std::iter::repeat_n(self.stops_ref(), n) .enumerate() .flat_map(|(i, stops)| { let mut stops = stops diff --git a/crates/typst-render/src/shape.rs b/crates/typst-render/src/shape.rs index ba7ed6d89..9b50d5f1f 100644 --- a/crates/typst-render/src/shape.rs +++ b/crates/typst-render/src/shape.rs @@ -69,9 +69,11 @@ pub fn render_shape(canvas: &mut sk::Pixmap, state: State, shape: &Shape) -> Opt let dash = dash.as_ref().and_then(to_sk_dash_pattern); let bbox = shape.geometry.bbox_size(); - let offset_bbox = (!matches!(shape.geometry, Geometry::Line(..))) - .then(|| offset_bounding_box(bbox, *thickness)) - .unwrap_or(bbox); + let offset_bbox = if !matches!(shape.geometry, Geometry::Line(..)) { + offset_bounding_box(bbox, *thickness) + } else { + bbox + }; let fill_transform = (!matches!(shape.geometry, Geometry::Line(..))).then(|| { From 96f695737174449cbd9efbf4954b676b9bb35056 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 11 Mar 2025 10:18:15 +0000 Subject: [PATCH 10/10] Fix `math.root` frame size (#6021) --- crates/typst-layout/src/math/root.rs | 8 +++++--- tests/ref/math-root-frame-size-index.png | Bin 0 -> 902 bytes tests/suite/math/root.typ | 6 ++++++ 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 tests/ref/math-root-frame-size-index.png diff --git a/crates/typst-layout/src/math/root.rs b/crates/typst-layout/src/math/root.rs index a6b5c03d0..c7f41488e 100644 --- a/crates/typst-layout/src/math/root.rs +++ b/crates/typst-layout/src/math/root.rs @@ -85,14 +85,15 @@ pub fn layout_root( ascent.set_max(shift_up + index.ascent()); } - let radicand_x = sqrt_offset + sqrt.width(); + let sqrt_x = sqrt_offset.max(Abs::zero()); + let radicand_x = sqrt_x + sqrt.width(); let radicand_y = ascent - radicand.ascent(); let width = radicand_x + radicand.width(); let size = Size::new(width, ascent + descent); // The extra "- thickness" comes from the fact that the sqrt is placed // in `push_frame` with respect to its top, not its baseline. - let sqrt_pos = Point::new(sqrt_offset, radicand_y - gap - thickness); + let sqrt_pos = Point::new(sqrt_x, radicand_y - gap - thickness); let line_pos = Point::new(radicand_x, radicand_y - gap - (thickness / 2.0)); let radicand_pos = Point::new(radicand_x, radicand_y); @@ -100,7 +101,8 @@ pub fn layout_root( frame.set_baseline(ascent); if let Some(index) = index { - let index_pos = Point::new(kern_before, ascent - index.ascent() - shift_up); + let index_x = -sqrt_offset.min(Abs::zero()) + kern_before; + let index_pos = Point::new(index_x, ascent - index.ascent() - shift_up); frame.push_frame(index_pos, index); } diff --git a/tests/ref/math-root-frame-size-index.png b/tests/ref/math-root-frame-size-index.png new file mode 100644 index 0000000000000000000000000000000000000000..41d4df2e9ea40429c2bc33bccec9afeb927374d9 GIT binary patch literal 902 zcmV;119|+3P)1i8`-j-*}=qYVapPY5}A+<9-Iye>Z(xM zl~(B}0~RTzPEs)|upmOI7*X&?#8TVRhm;nvwDxJ=wudKah$qu8UY_^u`?4HSYGnS{;D#1a#Z13Z08!n*r88 zzas*c%d^rT<0UE1JOsQ4dode$m!(q&;Aa3^<$?&f*+4}cYR##7;Cd##Ew+7a`3q3q zj5{YFd5g}kMZmv%;$_3I^tSmvu*09)y0jaMei%+R)&L`)V)qa>e1fc z2Z!?`SuiZcDeUolI|Cz#zv{>_#s+nI)O@E#*-!AVuF8y9xPF=HO9c;s;l5ed5Cal# zJQM-XSS{1c+2N4{WZU#$vzgMwTYy6V(_bL~j+7(0m@G-64*|Zzc8n(8gW26auJ!|q zjdfW8u&$koRrtk}k^rxg-nLTuSpE{Y{0+6h-6$Up34j|tu`)MAwi_3KcNUXdBOhTt z?FM%K+YRhf{N`?fyIRXy5#7cX6OH$!!PEDMC|S1D}D$A#-5Jy-q_ zeAVIOc$~Tus7*}XKYL?T;y`w#qi1hI9Qy({-ZS8ZI`&n|DVVXxIZ z#cU_6HUNsg4Xn1-Gyn++s8)cR6%-i`??Jl2bjdn@gn^kO=VV3^sPiheeB%&fcht}5a3%&k>Ms!v}_2LOAUTtXCV2KT#oUK z`sUa(U;t_?d}b;#EZbcz<3Qz)0OO7-Cm!eENp(AWUQGZ|`{~+@pszX@