Skip to content

Commit 85166dc

Browse files
committed
Upgrade to vello with font-embolden support
Signed-off-by: Nico Burns <nico@nicoburns.com>
1 parent 4708fa7 commit 85166dc

11 files changed

Lines changed: 49 additions & 19 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ serde = "1.0.228"
4242
serde_json = "1.0"
4343
zip = { version = "2.1", default-features = false, features = ["deflate"] }
4444
sha2 = "0.10"
45-
skera = "=0.1.0" # pin because of breaking changes in past patch releases
45+
skera = "=0.1.0" # pin because of breaking changes in past patch releases
4646
read-fonts = "0.37"
4747
ttf2woff2 = "0.11"
4848
wuff = "0.2"
@@ -53,8 +53,12 @@ linebender_resource_handle = "0.1"
5353
peniko = "0.6"
5454
kurbo = "0.13"
5555
glifo = "0.0.0"
56-
vello = { version = "0.8", features = [ "wgpu" ] }
57-
vello_cpu = { version = "0.0.7", default-features = false, features = ["std", "text", "u8_pipeline"] }
56+
vello = { version = "0.8", features = ["wgpu"] }
57+
vello_cpu = { version = "0.0.7", default-features = false, features = [
58+
"std",
59+
"text",
60+
"u8_pipeline",
61+
] }
5862
vello_hybrid = { version = "0.0.7" }
5963
vello_common = { version = "0.0.7" }
6064

@@ -81,8 +85,9 @@ wasm-bindgen-futures = "0.4"
8185
winit = { version = "0.30.2", features = ["rwh_06"] }
8286

8387
[patch.crates-io]
84-
vello = { git = "https://github.com/linebender/vello", rev = "b5c4a3192c1a2a5cc1dc2fe45342de1de95a1dc5" }
85-
vello_cpu = { git = "https://github.com/linebender/vello", rev = "b5c4a3192c1a2a5cc1dc2fe45342de1de95a1dc5" }
86-
vello_hybrid = { git = "https://github.com/linebender/vello", rev = "b5c4a3192c1a2a5cc1dc2fe45342de1de95a1dc5" }
87-
vello_common = { git = "https://github.com/linebender/vello", rev = "b5c4a3192c1a2a5cc1dc2fe45342de1de95a1dc5" }
88-
glifo = { git = "https://github.com/linebender/vello", rev = "b5c4a3192c1a2a5cc1dc2fe45342de1de95a1dc5" }
88+
vello = { git = "https://github.com/linebender/vello", rev = "3e1aba3ffa1286012119052cb4bc7250e1b61a4b" }
89+
vello_cpu = { git = "https://github.com/linebender/vello", rev = "3e1aba3ffa1286012119052cb4bc7250e1b61a4b" }
90+
vello_hybrid = { git = "https://github.com/linebender/vello", rev = "3e1aba3ffa1286012119052cb4bc7250e1b61a4b" }
91+
vello_common = { git = "https://github.com/linebender/vello", rev = "3e1aba3ffa1286012119052cb4bc7250e1b61a4b" }
92+
glifo = { git = "https://github.com/linebender/vello", rev = "3e1aba3ffa1286012119052cb4bc7250e1b61a4b" }
93+
kurbo = { git = "https://github.com/linebender/kurbo", rev = "6836244" }

crates/anyrender/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ pub trait PaintScene: RenderContext {
229229
font_size: f32,
230230
hint: bool,
231231
normalized_coords: &'a [NormalizedCoord],
232+
embolden: kurbo::Vec2,
232233
style: impl Into<StyleRef<'a>>,
233234
brush: impl Into<PaintRef<'a>>,
234235
brush_alpha: f32,
@@ -294,6 +295,7 @@ pub trait PaintScene: RenderContext {
294295
cmd.font_size,
295296
cmd.hint,
296297
&cmd.normalized_coords,
298+
cmd.embolden,
297299
&cmd.style,
298300
match cmd.brush {
299301
Paint::Solid(alpha_color) => Paint::Solid(alpha_color),

crates/anyrender/src/null_backend.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ impl PaintScene for NullScenePainter {
135135
_font_size: f32,
136136
_hint: bool,
137137
_normalized_coords: &'a [crate::NormalizedCoord],
138+
_embolden: kurbo::Vec2,
138139
_style: impl Into<peniko::StyleRef<'a>>,
139140
_brush: impl Into<crate::PaintRef<'a>>,
140141
_brush_alpha: f32,

crates/anyrender/src/recording.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ pub struct GlyphRunCommand<Font = FontData, Brush = Paint> {
103103
pub font_size: f32,
104104
pub hint: bool,
105105
pub normalized_coords: Vec<NormalizedCoord>,
106+
#[serde(default = "Default::default")]
107+
pub embolden: kurbo::Vec2,
106108
pub style: Style,
107109
pub brush: Brush,
108110
pub brush_alpha: f32,
@@ -244,6 +246,7 @@ impl PaintScene for Scene {
244246
font_size: f32,
245247
hint: bool,
246248
normalized_coords: &'a [NormalizedCoord],
249+
embolden: kurbo::Vec2,
247250
style: impl Into<StyleRef<'a>>,
248251
paint_ref: impl Into<PaintRef<'a>>,
249252
brush_alpha: f32,
@@ -257,6 +260,7 @@ impl PaintScene for Scene {
257260
font_size,
258261
hint,
259262
normalized_coords: normalized_coords.to_vec(),
263+
embolden,
260264
style: style.into().to_owned(),
261265
brush,
262266
brush_alpha,

crates/anyrender_serialize/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ impl ResourceCollector {
221221
font_size: glyph_run.font_size,
222222
hint: glyph_run.hint,
223223
normalized_coords: glyph_run.normalized_coords.clone(),
224+
embolden: glyph_run.embolden,
224225
style: glyph_run.style.clone(),
225226
brush,
226227
brush_alpha: glyph_run.brush_alpha,
@@ -308,6 +309,7 @@ impl ResourceReconstructor {
308309
font_size: glyph_run.font_size,
309310
hint: glyph_run.hint,
310311
normalized_coords: glyph_run.normalized_coords.clone(),
312+
embolden: glyph_run.embolden,
311313
style: glyph_run.style.clone(),
312314
brush,
313315
brush_alpha: glyph_run.brush_alpha,

crates/anyrender_skia/src/scene.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ impl PaintScene for SkiaScenePainter<'_> {
465465
font_size: f32,
466466
hint: bool,
467467
normalized_coords: &'a [anyrender::NormalizedCoord],
468+
_embolden: kurbo::Vec2,
468469
style: impl Into<peniko::StyleRef<'a>>,
469470
brush: impl Into<anyrender::PaintRef<'a>>,
470471
brush_alpha: f32,

crates/anyrender_vello/src/scene.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ impl PaintScene for VelloScenePainter<'_, '_> {
138138
font_size: f32,
139139
hint: bool,
140140
normalized_coords: &'a [NormalizedCoord],
141+
embolden: kurbo::Vec2,
141142
style: impl Into<StyleRef<'a>>,
142143
paint: impl Into<PaintRef<'a>>,
143144
brush_alpha: f32,
@@ -150,6 +151,9 @@ impl PaintScene for VelloScenePainter<'_, '_> {
150151
.font_size(font_size)
151152
.hint(hint)
152153
.normalized_coords(normalized_coords)
154+
.font_embolden(vello::FontEmbolden::new(kurbo::Diagonal2::new(
155+
embolden.x, embolden.y,
156+
)))
153157
.brush(paint.into())
154158
.brush_alpha(brush_alpha)
155159
.transform(transform)

crates/anyrender_vello_cpu/src/scene.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ impl PaintScene for VelloCpuScenePainter {
125125
font_size: f32,
126126
hint: bool,
127127
normalized_coords: &'a [NormalizedCoord],
128+
_embolden: kurbo::Vec2,
128129
style: impl Into<StyleRef<'a>>,
129130
paint: impl Into<PaintRef<'a>>,
130131
_brush_alpha: f32,

crates/anyrender_vello_hybrid/src/scene.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ impl PaintScene for VelloHybridScenePainter<'_> {
196196
font_size: f32,
197197
hint: bool,
198198
normalized_coords: &'a [NormalizedCoord],
199+
_embolden: kurbo::Vec2,
199200
style: impl Into<StyleRef<'a>>,
200201
paint: impl Into<PaintRef<'a>>,
201202
_brush_alpha: f32,

0 commit comments

Comments
 (0)