|
4 | 4 |
|
5 | 5 | use crate::fallback::FontFallbackIter;
|
6 | 6 | use crate::{
|
7 |
| - math, Align, AttrsList, CacheKeyFlags, Color, Font, FontSystem, LayoutGlyph, |
8 |
| - LayoutLine, Metrics, Wrap, |
| 7 | + math, Align, AttrsList, CacheKeyFlags, Color, Font, FontSystem, LayoutGlyph, LayoutLine, |
| 8 | + Metrics, Wrap, |
9 | 9 | };
|
10 | 10 | #[cfg(not(feature = "std"))]
|
11 | 11 | use alloc::vec::Vec;
|
12 | 12 |
|
| 13 | +use alloc::collections::VecDeque; |
13 | 14 | use core::cmp::{max, min};
|
14 | 15 | use core::fmt;
|
15 | 16 | use core::mem;
|
16 | 17 | use core::ops::Range;
|
17 |
| -use alloc::collections::VecDeque; |
18 | 18 |
|
19 | 19 | #[cfg(not(feature = "std"))]
|
20 | 20 | use core_maths::CoreFloat;
|
@@ -84,7 +84,7 @@ const NUM_SHAPE_PLANS: usize = 4;
|
84 | 84 | /// A set of buffers containing allocations for shaped text.
|
85 | 85 | #[derive(Default)]
|
86 | 86 | pub struct ShapeBuffer {
|
87 |
| - /// Cache for HarfRust shape plans. Stores up to [`NUM_SHAPE_PLANS`] plans at once. Inserting a new one past that |
| 87 | + /// Cache for harfrust shape plans. Stores up to [`NUM_SHAPE_PLANS`] plans at once. Inserting a new one past that |
88 | 88 | /// will remove the one that was least recently added (not least recently used).
|
89 | 89 | shape_plan_cache: VecDeque<harfrust::ShapePlan>,
|
90 | 90 |
|
@@ -186,13 +186,16 @@ fn shape_fallback(
|
186 | 186 | scratch.shape_plan_cache.pop_front();
|
187 | 187 | }
|
188 | 188 | scratch.shape_plan_cache.push_back(plan);
|
189 |
| - scratch.shape_plan_cache.back().unwrap() |
| 189 | + scratch |
| 190 | + .shape_plan_cache |
| 191 | + .back() |
| 192 | + .expect("we just pushed the shape plan") |
190 | 193 | }
|
191 | 194 | };
|
192 | 195 |
|
193 | 196 | let glyph_buffer = font
|
194 | 197 | .shaper()
|
195 |
| - .shape_with_plan(&shape_plan, buffer, &rb_font_features); |
| 198 | + .shape_with_plan(shape_plan, buffer, &rb_font_features); |
196 | 199 | let glyph_infos = glyph_buffer.glyph_infos();
|
197 | 200 | let glyph_positions = glyph_buffer.glyph_positions();
|
198 | 201 |
|
|
0 commit comments