Skip to content

Remove font-kit and pathfinder as dependencies#735

Open
pbdeuchler wants to merge 7 commits intoplotters-rs:masterfrom
pbdeuchler:pbd/remove-pathfinder-geometry
Open

Remove font-kit and pathfinder as dependencies#735
pbdeuchler wants to merge 7 commits intoplotters-rs:masterfrom
pbdeuchler:pbd/remove-pathfinder-geometry

Conversation

@pbdeuchler
Copy link
Copy Markdown
Contributor

The servo organization no longer maintains font-kit or pathfinder and has only been doing ad hoc PR fixes for failing builds. However as Rust continues to change things in the simd std lib crate pathfinder continues to break builds and it has been communicated that we should not rely on releases happening in the future.

This PR aims to completely remove font-kit and pathfinder dependencies in favor of the maintained fontique and swash crates. It uses fontique to discover system fonts and build an internal cache of available fonts, and swash for rendering.

Tradeoffs

We do lose subpixel AA rendering with this PR, however the introduction of swash will allow us to improve typographic quality with a future PR (which I already have in progress) that removes ttf-parser in favor of a 100% swash rendering backend, which would also mean improved support for ligatures and non-Latin fonts. swash also does slightly more allocations and is slightly less performant than pathfinder, but the perf difference here is extremely small and I doubt anyone will notice in real world usage.

Breaking Changes

I changed the error type in ttf.rs since the underlying types no longer apply, this could break some public API consumers

This PR will also up the MSRV to 1.88 and introduces memmap2 as a transitive dependency of fontique.

This is my first foray into the plotters internals, and my first time messing around with fonts/rasterization... I utilized my good friend Claude to guide me but let me know if there's anything that's missing or needs fixing here.

Comment on lines +233 to +239
if let Err(e) = draw(
base_x + image.placement.left + dx as i32,
base_y - image.placement.top + dy as i32,
alpha,
) {
return Err(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants