Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors = ["Pavel Ivanov <mr.pavel.ivanov@gmail.com>"]
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"
Expand All @@ -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"
Expand Down
22 changes: 11 additions & 11 deletions src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -201,7 +197,6 @@ impl From<&str> for Location {
#[allow(dead_code)]
pub struct Font<'a> {
inner: allsorts::Font<DynamicFontTableProvider<'a>>,
head: HeadTable,
os2: Os2,
format: Option<FontFormat>,
name: Option<String>,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -299,12 +294,17 @@ impl Font<'_> {

let glyphs = glyphs.into_iter().collect::<Vec<_>>();

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.
Expand Down