Compare commits

...

5 commits

Author SHA1 Message Date
4444857c7f chore: use local cosmic-text
Some checks failed
Format / all (push) Has been cancelled
Lint / all (push) Has been cancelled
Test / all (macOS-latest, beta) (push) Has been cancelled
Test / all (macOS-latest, stable) (push) Has been cancelled
Test / all (ubuntu-latest, beta) (push) Has been cancelled
Test / all (ubuntu-latest, stable) (push) Has been cancelled
Test / all (windows-latest, beta) (push) Has been cancelled
Test / all (windows-latest, stable) (push) Has been cancelled
2026-07-02 18:53:18 +02:00
Ashley Wulber
2e9ec6ec42 fix: cosmic-text 2026-07-02 18:53:18 +02:00
Héctor Ramón Jiménez
e429a025df
Update cosmic-text to 0.19 2026-04-23 20:00:46 +09:00
Héctor Ramón Jiménez
1d68895e9c
Update cosmic-text to 0.18 2026-02-19 19:13:45 +01:00
Héctor Ramón Jiménez
3836ca7a17
Update wgpu to 28 2026-01-20 02:01:42 +01:00
6 changed files with 16 additions and 22 deletions

View file

@ -8,9 +8,9 @@ repository = "https://github.com/iced-rs/cryoglyph"
license = "MIT OR Apache-2.0 OR Zlib"
[dependencies]
wgpu = { version = "27", default-features = false, features = ["wgsl"] }
wgpu = { version = "28", default-features = false, features = ["wgsl"] }
etagere = "0.2"
cosmic-text = "0.16"
cosmic-text = { path = "../cosmic-text" }
lru = { version = "0.16", default-features = false }
rustc-hash = "2"

View file

@ -73,8 +73,8 @@ fn run_bench(ctx: &mut Criterion) {
.copied()
.map(|s| {
let mut text_buffer = Buffer::new(&mut font_system, Metrics::relative(1.0, 10.0));
text_buffer.set_size(&mut font_system, Some(20.0), None);
text_buffer.set_text(&mut font_system, s, &attrs, shaping, None);
text_buffer.set_size(Some(20.0), None);
text_buffer.set_text(s, &attrs, shaping, None);
text_buffer.shape_until_scroll(&mut font_system, false);
text_buffer
})
@ -85,7 +85,7 @@ fn run_bench(ctx: &mut Criterion) {
let text_areas: Vec<TextArea> = buffers
.iter()
.map(|b| TextArea {
buffer: b,
text: b.layout_runs(),
left: 0.0,
top: 0.0,
scale: 1.0,

View file

@ -82,12 +82,8 @@ impl WindowState {
let physical_width = (physical_size.width as f64 * scale_factor) as f32;
let physical_height = (physical_size.height as f64 * scale_factor) as f32;
text_buffer.set_size(
&mut font_system,
Some(physical_width),
Some(physical_height),
);
text_buffer.set_text(&mut font_system, "Hello world! 👋\nThis is rendered with 🦅 glyphon 🦁\nThe text below should be partially clipped.\na b c d e f g h i j k l m n o p q r s t u v w x y z", &Attrs::new().family(Family::SansSerif), Shaping::Advanced, None);
text_buffer.set_size(Some(physical_width), Some(physical_height));
text_buffer.set_text("Hello world! 👋\nThis is rendered with 🦅 glyphon 🦁\nThe text below should be partially clipped.\na b c d e f g h i j k l m n o p q r s t u v w x y z", &Attrs::new().family(Family::SansSerif), Shaping::Advanced, None);
text_buffer.shape_until_scroll(&mut font_system, false);
Self {
@ -179,7 +175,7 @@ impl winit::application::ApplicationHandler for Application {
atlas,
viewport,
[TextArea {
buffer: text_buffer,
text: text_buffer.layout_runs(),
left: 10.0,
top: 10.0,
scale: 1.0,
@ -213,6 +209,7 @@ impl winit::application::ApplicationHandler for Application {
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
multiview_mask: None,
});
text_renderer.render(&atlas, &viewport, &mut pass).unwrap();

View file

@ -42,7 +42,7 @@ impl Cache {
label: Some("glyphon sampler"),
min_filter: FilterMode::Nearest,
mag_filter: FilterMode::Nearest,
mipmap_filter: FilterMode::Nearest,
mipmap_filter: wgpu::MipmapFilterMode::Nearest,
lod_min_clamp: 0f32,
lod_max_clamp: 0f32,
..Default::default()
@ -139,7 +139,7 @@ impl Cache {
let pipeline_layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
label: None,
bind_group_layouts: &[&atlas_layout, &uniforms_layout],
push_constant_ranges: &[],
immediate_size: 0,
});
Self(Arc::new(Inner {
@ -237,7 +237,7 @@ impl Cache {
},
depth_stencil: depth_stencil.clone(),
multisample,
multiview: None,
multiview_mask: None,
cache: None,
});

View file

@ -102,10 +102,9 @@ impl Default for TextBounds {
}
/// A text area containing text to be rendered along with its overflow behavior.
#[derive(Clone)]
pub struct TextArea<'a> {
/// The buffer containing the text to be rendered.
pub buffer: &'a Buffer,
pub text: LayoutRunIter<'a>,
/// The left edge of the buffer.
pub left: f32,
/// The top edge of the buffer.

View file

@ -39,7 +39,7 @@ impl TextRenderer {
let pipeline = atlas.get_or_create_pipeline(device, multisample, depth_stencil);
Self {
staging_belt: StagingBelt::new(vertex_buffer_size),
staging_belt: StagingBelt::new(device.clone(), vertex_buffer_size),
vertex_buffer,
vertex_buffer_size,
pipeline,
@ -81,8 +81,7 @@ impl TextRenderer {
};
let layout_runs = text_area
.buffer
.layout_runs()
.text
.skip_while(|run| !is_run_visible(run))
.take_while(is_run_visible);
@ -295,7 +294,6 @@ impl TextRenderer {
&self.vertex_buffer,
0,
NonZeroU64::new(vertices_raw.len() as u64).expect("Non-empty vertices"),
device,
)
.copy_from_slice(vertices_raw);
} else {
@ -312,7 +310,7 @@ impl TextRenderer {
self.vertex_buffer_size = buffer_size;
self.staging_belt.finish();
self.staging_belt = StagingBelt::new(buffer_size);
self.staging_belt = StagingBelt::new(device.clone(), buffer_size);
}
self.staging_belt.finish();