Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b6b0d0a
test changes
StewartCanva Jul 16, 2025
8cad993
Compiling and running but not working
StewartCanva Jul 16, 2025
21383f7
linebreaking different but actually linebreaking
StewartCanva Jul 18, 2025
f9f1aab
passing font variations
StewartCanva Jul 28, 2025
e7d0667
push variations, but hardcoded order
StewartCanva Jul 28, 2025
beafd28
push actual axis normalized and in correct order
StewartCanva Jul 29, 2025
3b17133
script conversion
StewartCanva Jul 29, 2025
2eee448
working tree commits
StewartCanva Aug 4, 2025
912865c
some cleanup
StewartCanva Aug 4, 2025
7ebe0fb
more cleanup + todos
StewartCanva Aug 4, 2025
0736ae7
more todo
StewartCanva Aug 4, 2025
56df45e
Squashed commits of harfrust-migration2
taj-p Aug 19, 2025
d061792
Merge remote-tracking branch 'origin/main' into tajp/harfrust-migration3
taj-p Aug 19, 2025
a97cfff
.
taj-p Aug 19, 2025
33d74be
Clippy
taj-p Aug 19, 2025
e478d1d
.
taj-p Aug 19, 2025
2f118f5
Don't collect variations
taj-p Aug 19, 2025
ef0bb64
Fix documentation
taj-p Aug 19, 2025
c1ad1a9
Use optional unicode buffer
taj-p Aug 19, 2025
317882c
Use Feature::new
taj-p Aug 19, 2025
04e76a8
.
taj-p Aug 19, 2025
4014e9f
.
taj-p Aug 19, 2025
c9cc74d
Remove HARFRUST_SCRIPT_TAGS
taj-p Aug 19, 2025
61fccc4
Update to Harfrust 0.1.2 and use reserve
taj-p Aug 20, 2025
efb6e2d
Move scratch clusters to LayoutDataContext
taj-p Aug 20, 2025
b8c1b51
Use harfrust coords
taj-p Aug 20, 2025
06a9650
Use Skrifa for font metrics
taj-p Aug 21, 2025
39b3e72
Use clusters reverse
taj-p Aug 21, 2025
f456338
Update snapshots
taj-p Aug 21, 2025
a0920d1
Process clusters documentation
taj-p Aug 21, 2025
a63ae9e
cargo fmt
taj-p Aug 21, 2025
4600ff6
.
taj-p Aug 21, 2025
2643008
Update README.md
taj-p Aug 21, 2025
0a6da9b
Update README.md
taj-p Aug 21, 2025
4495cbd
HarfBuzz -> HarfRust
taj-p Aug 21, 2025
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
33 changes: 29 additions & 4 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ repository = "https://github.com/linebender/parley"
accesskit = "0.21.0"
bytemuck = { version = "1.23.0", default-features = false }
fontique = { version = "0.5.0", default-features = false, path = "fontique" }
harfrust = "0.1.1"
hashbrown = "0.15.3"
parley = { version = "0.5.0", default-features = false, path = "parley" }
peniko = { version = "0.4.0", default-features = false }
Expand Down
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ It is backed by [Swash](https://github.com/dfrg/swash).

## The Parley text stack

Currently, Parley directly depends on four crates: Fontique, Swash, Skrifa, and Peniko.
Currently, Parley directly depends on five crates: Fontique, Harfrust, Swash, Skrifa, and Peniko.
These crates cover different pieces of the text-rendering process.

### Peniko
Expand All @@ -39,6 +39,11 @@ This is necessary because fonts typically don't cover the entire Unicode range:
But if you have, say arabic text or emoji embedded within latin text, you don't typically specify the font for the arabic text or the emoji, one is chosen for you.
Font fallback is the process which makes that choice.

### Harfrust

Harfrust is a Rust port of HarfBuzz text shaping engine. **Text shaping** means mapping runs of Unicode codepoints to specific glyphs within fonts.
This includes applying ligatures, resolving emoji modifiers, but also much more complex transformations for some scripts.

### Skrifa

Skrifa reads TrueType and OpenType fonts.
Expand All @@ -50,15 +55,7 @@ Notably it converts the raw glyph representations in font files into scaled, hin

### Swash

Swash implements text shaping and [some miscellaneous Unicode-related features](https://github.com/dfrg/swash#text-analysis).

**Text shaping** means mapping runs of Unicode codepoints to specific glyphs within fonts.
This includes applying ligatures, resolving emoji modifiers, but also much more complex transformations for some scripts.

Swash's implementation is faster but less complete and tested than Harfbuzz and Rustybuzz.

Swash also implements font parsing, scaling, and hinting.
This part of Swash is now superseded by Skrifa: the implementation in Skrifa is directly descended from the one in Swash.
Within the context of Parley, Swash implements [some miscellaneous Unicode-related features](https://github.com/dfrg/swash#text-analysis).

### Parley

Expand Down Expand Up @@ -106,6 +103,7 @@ at your option.

Some files used for tests are under different licenses:

- The font file `Arimo-VariableFont_wght.ttf` in `/parley/tests/assets/arimo_fonts/` is licensed solely as documented in that folder (and is licensed under the Apache License, Version 2.0).
- The font file `Roboto-Regular.ttf` in `/parley/tests/assets/roboto_fonts/` is licensed solely as documented in that folder (and is licensed under the Apache License, Version 2.0).
- The font file `NotoKufiArabic-Regular.otf` in `/parley/tests/assets/noto_fonts/` is licensed solely as documented in that folder (and is licensed under the SIL Open Font License, Version 1.1).

Expand Down
2 changes: 1 addition & 1 deletion examples/swash_render/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ fn render_glyph(
// Apply the fractional offset
.offset(offset)
// Render the image
.render(scaler, glyph.id)
.render(scaler, glyph.id as u16)
.unwrap();

let glyph_width = rendered_glyph.placement.width;
Expand Down
2 changes: 1 addition & 1 deletion examples/vello_editor/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ impl Editor {
let gy = y - glyph.y;
x += glyph.advance;
vello::Glyph {
id: glyph.id as _,
id: glyph.id,
x: gx,
y: gy,
}
Expand Down
2 changes: 1 addition & 1 deletion fontique/src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ pub struct AxisInfo {
/// as well as [`QueryFont::synthesis`].
///
/// [`QueryFont::synthesis`]: crate::QueryFont::synthesis
#[derive(Copy, Clone, Default)]
#[derive(Copy, Clone, Default, PartialEq)]
pub struct Synthesis {
vars: [(Tag, f32); 3],
len: u8,
Expand Down
1 change: 1 addition & 0 deletions parley/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fontique = { workspace = true }
core_maths = { version = "0.1.1", optional = true }
accesskit = { workspace = true, optional = true }
hashbrown = { workspace = true }
harfrust = { workspace = true }

[dev-dependencies]
tiny-skia = "0.11.4"
2 changes: 1 addition & 1 deletion parley/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ use super::builder::RangedBuilder;
use super::resolve::{RangedStyle, RangedStyleBuilder, ResolveContext, ResolvedStyle, tree};
use super::style::{Brush, TextStyle};

use swash::shape::ShapeContext;
use swash::text::cluster::CharInfo;

use crate::builder::TreeBuilder;
use crate::inline_box::InlineBox;
use crate::shape::ShapeContext;

/// Shared scratch space used when constructing text layouts.
///
Expand Down
8 changes: 3 additions & 5 deletions parley/src/layout/cluster.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Copyright 2021 the Parley Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

use super::{
BreakReason, Brush, Cluster, ClusterInfo, Glyph, Layout, Line, LineItem, Range, Run, Style,
};
use super::{BreakReason, Brush, Cluster, Glyph, Layout, Line, LineItem, Range, Run, Style, data};
use swash::text::cluster::Whitespace;

/// Defines the visual side of the cluster for hit testing.
Expand Down Expand Up @@ -390,8 +388,8 @@ impl<'a, B: Brush> Cluster<'a, B> {
Some(offset)
}

pub(crate) fn info(&self) -> ClusterInfo {
self.data.info
pub(crate) fn info(&self) -> &data::ClusterInfo {
&self.data.info
}
}

Expand Down
Loading
Loading