Skip to content

Commit fe95143

Browse files
oetikerclaude
andcommitted
Port text rendering from ttf-parser to skrifa
This replaces ttf-parser with skrifa for all font parsing and text rendering. fontdb changes: - Vendor fontdb 0.23.0 as a workspace crate - Replace ttf-parser with skrifa for font parsing - Use skrifa's MetadataProvider for font attributes and metrics usvg changes: - Add skrifa_colr.rs: COLR glyph painting using skrifa's ColorPainter - Add skrifa_metrics.rs: Font metrics extraction using skrifa - Update flatten.rs: Use skrifa for glyph outlines and bitmap extraction - Update layout.rs: Use skrifa for font metrics and harfrust for shaping - Replace rustybuzz with harfrust for text shaping - Update test reference images for new skrifa-based rendering Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 9876cd4 commit fe95143

37 files changed

+2534
-381
lines changed

.github/copyright.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
# -g "!src/special_directory"
88

99
# Check all the standard Rust source files
10-
output=$(rg "^// Copyright (19|20)[\d]{2} (.+ and )?the Resvg Authors( and .+)?$\n^// SPDX-License-Identifier: Apache-2\.0 OR MIT$\n\n" --files-without-match --multiline -g "*.{rs,c,cpp,h}" .)
10+
# Exclude vendored fontdb (has its own copyright from original author)
11+
output=$(rg "^// Copyright (19|20)[\d]{2} (.+ and )?the Resvg Authors( and .+)?$\n^// SPDX-License-Identifier: Apache-2\.0 OR MIT$\n\n" --files-without-match --multiline -g "*.{rs,c,cpp,h}" -g "!crates/fontdb/*" .)
1112

1213
if [ -n "$output" ]; then
1314
echo -e "The following files lack the correct copyright header:\n"

Cargo.lock

Lines changed: 92 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[workspace]
22
members = [
33
"crates/c-api",
4+
"crates/fontdb",
45
"crates/resvg",
56
"crates/usvg",
67
"crates/usvg/codegen",

crates/fontdb/Cargo.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[package]
2+
name = "fontdb"
3+
version = "0.23.0"
4+
authors = ["Yevhenii Reizner <[email protected]>"]
5+
edition = "2024"
6+
rust-version = "1.87.0"
7+
license = "MIT"
8+
description = "A simple, in-memory font database with CSS-like queries. Vendored for resvg with skrifa backend."
9+
repository = "https://github.com/linebender/resvg"
10+
documentation = "https://docs.rs/fontdb/"
11+
keywords = ["font", "db", "css", "truetype", "opentype"]
12+
categories = ["text-processing"]
13+
14+
[dependencies]
15+
slotmap = "1.0"
16+
tinyvec = { version = "1.8", features = ["alloc"] }
17+
skrifa = "0.40"
18+
log = "0.4"
19+
20+
memmap2 = { version = "0.9", optional = true }
21+
fontconfig-parser = { version = "0.5.8", optional = true }
22+
23+
[features]
24+
default = ["std", "fs", "system-fonts", "memmap"]
25+
# Enables standard library support (always on for this vendored version).
26+
std = []
27+
# Enables file system operations (loading fonts from files/directories).
28+
fs = ["std"]
29+
# Enables system fonts loading.
30+
system-fonts = ["fs", "fontconfig"]
31+
# Enables fontconfig support on Linux.
32+
fontconfig = ["fontconfig-parser"]
33+
# Enables font files memory mapping for faster loading.
34+
memmap = ["fs", "memmap2"]

0 commit comments

Comments
 (0)