From fb4eb5f9ce55e62de62b7c6df03a17e7c527b6fb Mon Sep 17 00:00:00 2001 From: Pavel Ivanov Date: Sun, 28 Dec 2025 00:54:39 +0100 Subject: [PATCH] build(deps): bump allsorts from 0.15.1 to 0.16.1 Bumps [allsorts](https://github.com/yeslogic/allsorts) from 0.15.1 to 0.16.1. - [Release notes](https://github.com/yeslogic/allsorts/releases) - [Changelog](https://github.com/yeslogic/allsorts/blob/master/CHANGELOG.md) - [Commits](https://github.com/yeslogic/allsorts/compare/v0.15.1...v0.16.1) --- updated-dependencies: - dependency-name: allsorts dependency-version: 0.16.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 4 ++-- src/font.rs | 22 +++++++++++----------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 81ef578..fc0a7c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,11 +51,11 @@ dependencies = [ [[package]] name = "allsorts" -version = "0.15.1" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ec6442ceba5ea9d0201cd0afe96ecac4e8253e5f5be725e074747e6f4238735" +checksum = "4ba21c7f883cc76d76a41910815b1b212e1ca7870af2bd551565282140660ca5" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.10.0", "bitreader", "brotli-decompressor", "byteorder", @@ -530,9 +530,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "4.0.3" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a334ef7c9e23abf0ce748e8cd309037da93e606ad52eb372e4ce327a0dcfbdfd" +checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -2867,7 +2867,7 @@ dependencies = [ [[package]] name = "termframe" -version = "0.7.4" +version = "0.7.5-alpha.1" dependencies = [ "allsorts", "anyhow", @@ -3190,15 +3190,15 @@ dependencies = [ [[package]] name = "unicode-canonical-combining-class" -version = "0.5.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6925586af9268182c711e47c0853ed84131049efaca41776d0ca97f983865c32" +checksum = "41c99d5174052d02ce765418e826597a1be18f32c114e35d9e22f92390239561" [[package]] name = "unicode-general-category" -version = "0.6.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2281c8c1d221438e373249e065ca4989c4c36952c211ff21a0ee91c44a3869e7" +checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f" [[package]] name = "unicode-ident" @@ -3208,9 +3208,9 @@ checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "unicode-joining-type" -version = "0.7.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22f8cb47ccb8bc750808755af3071da4a10dcd147b68fc874b7ae4b12543f6f5" +checksum = "d8d00a78170970967fdb83f9d49b92f959ab2bb829186b113e4f4604ad98e180" [[package]] name = "unicode-segmentation" diff --git a/Cargo.toml b/Cargo.toml index 7235538..9556370 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ authors = ["Pavel Ivanov "] description = "Terminal output SVG screenshot tool" categories = ["command-line-utilities"] keywords = ["cli", "terminal", "screenshot", "svg"] -version = "0.7.4" +version = "0.7.5-alpha.1" edition = "2024" license = "MIT" build = "build/build.rs" @@ -20,7 +20,7 @@ rust-version = "1.88.0" tidy-themes = { path = "tools/tidy-themes" } [dependencies] -allsorts = "0.15" +allsorts = "0.16" anyhow = "1" askama = "0.15" base64 = "0.22" diff --git a/src/font.rs b/src/font.rs index 6d8ed50..a5e818b 100644 --- a/src/font.rs +++ b/src/font.rs @@ -6,8 +6,8 @@ use allsorts::{ binary::read::{ReadScope, ReadScopeOwned}, font::MatchingPresentation, font_data::{DynamicFontTableProvider, FontData}, - subset::subset, - tables::{FontTableProvider, HeadTable, NameTable, os2::Os2}, + subset::{CmapTarget, SubsetProfile, subset}, + tables::{FontTableProvider, NameTable, os2::Os2}, tag, }; use anyhow::anyhow; @@ -128,15 +128,11 @@ impl FontFile { let family = name_table.string_for_id(16); let inner = allsorts::Font::new(provider)?; - let Some(head) = inner.head_table()? else { - return Err(anyhow!("No head table found in the font")); - }; let Some(os2) = inner.os2_table()? else { return Err(anyhow!("No os/2 table found in the font")); }; Ok(Font { inner, - head, os2, format: self.format(), name, @@ -201,7 +197,6 @@ impl From<&str> for Location { #[allow(dead_code)] pub struct Font<'a> { inner: allsorts::Font>, - head: HeadTable, os2: Os2, format: Option, name: Option, @@ -259,12 +254,12 @@ impl Font<'_> { /// Check if the font is italic. pub fn italic(&self) -> bool { - self.head.is_italic() + self.inner.head_table.is_italic() } /// Check if the font is bold. pub fn bold(&self) -> bool { - self.head.is_bold() + self.inner.head_table.is_bold() } /// Get the weight axis range of the font. @@ -299,12 +294,17 @@ impl Font<'_> { let glyphs = glyphs.into_iter().collect::>(); - Ok(subset(&self.inner.font_table_provider, &glyphs)?) + Ok(subset( + &self.inner.font_table_provider, + &glyphs, + &SubsetProfile::Minimal, + CmapTarget::Unrestricted, + )?) } /// Get the units per em value of the font. fn em(&self) -> u16 { - self.head.units_per_em + self.inner.head_table.units_per_em } /// Get the range of a specific axis in the font.