You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Migrate text shaping from Swash to Harfrust
This PR migrates Parley’s shaping engine from Swash to Harfrust, while
continuing to use Swash for text analysis and some example rendering.
The goal is to align Parley’s shaping behavior with HarfBuzz parity via
Harfrust to improve correctness across complex scripts (for example, see
the improved and updated RTL Arabic snapshots).
The changes are largely internal and should have no (besides
`.synthesis()`, I believe) external API changes.
### What changed
- **Shaping pipeline**
- Replaced Swash shaping with Harfrust
- Continued using Swash for text analysis (segmentation, clustering,
word boundaries).
- **Layout and run storage**
- Internal run data stores Harfrust results and variation coordinates.
- Parley handling of variation coordinates for variable fonts.
### Follow-ups
- We're going to next look at using ICU4X for text analysis.
cc @conor-93
---------
Co-authored-by: Stewart Connor <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+8-10Lines changed: 8 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ It is backed by [Swash](https://github.com/dfrg/swash).
17
17
18
18
## The Parley text stack
19
19
20
-
Currently, Parley directly depends on four crates: Fontique, Swash, Skrifa, and Peniko.
20
+
Currently, Parley directly depends on five crates: Fontique, HarfRust, Swash, Skrifa, and Peniko.
21
21
These crates cover different pieces of the text-rendering process.
22
22
23
23
### Peniko
@@ -39,6 +39,11 @@ This is necessary because fonts typically don't cover the entire Unicode range:
39
39
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.
40
40
Font fallback is the process which makes that choice.
41
41
42
+
### HarfRust
43
+
44
+
HarfRust is a Rust port of HarfBuzz text shaping engine. **Text shaping** means mapping runs of Unicode codepoints to specific glyphs within fonts.
45
+
This includes applying ligatures, resolving emoji modifiers, but also much more complex transformations for some scripts.
46
+
42
47
### Skrifa
43
48
44
49
Skrifa reads TrueType and OpenType fonts.
@@ -50,15 +55,7 @@ Notably it converts the raw glyph representations in font files into scaled, hin
50
55
51
56
### Swash
52
57
53
-
Swash implements text shaping and [some miscellaneous Unicode-related features](https://github.com/dfrg/swash#text-analysis).
54
-
55
-
**Text shaping** means mapping runs of Unicode codepoints to specific glyphs within fonts.
56
-
This includes applying ligatures, resolving emoji modifiers, but also much more complex transformations for some scripts.
57
-
58
-
Swash's implementation is faster but less complete and tested than Harfbuzz and Rustybuzz.
59
-
60
-
Swash also implements font parsing, scaling, and hinting.
61
-
This part of Swash is now superseded by Skrifa: the implementation in Skrifa is directly descended from the one in Swash.
58
+
Within the context of Parley, Swash implements [some miscellaneous Unicode-related features](https://github.com/dfrg/swash#text-analysis).
62
59
63
60
### Parley
64
61
@@ -106,6 +103,7 @@ at your option.
106
103
107
104
Some files used for tests are under different licenses:
108
105
106
+
- 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).
109
107
- 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).
110
108
- 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).
0 commit comments