Skip to content

Commit ea9465f

Browse files
committed
Move (lack of) overflow handling to sharedparley
1 parent 3e545a9 commit ea9465f

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

internal/core/textlayout/sharedparley.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
graphics::FontRequest,
88
items::TextStrokeStyle,
99
lengths::LogicalLength,
10-
textlayout::{TextHorizontalAlignment, TextVerticalAlignment, TextWrap},
10+
textlayout::{TextHorizontalAlignment, TextVerticalAlignment, TextWrap, TextOverflow},
1111
};
1212
use i_slint_common::sharedfontique;
1313

@@ -38,6 +38,7 @@ pub struct LayoutOptions {
3838
pub selection: Option<std::ops::Range<usize>>,
3939
pub font_request: Option<FontRequest>,
4040
pub text_wrap: TextWrap,
41+
pub text_overflow: TextOverflow
4142
}
4243

4344
impl Default for LayoutOptions {
@@ -51,6 +52,7 @@ impl Default for LayoutOptions {
5152
selection: None,
5253
font_request: None,
5354
text_wrap: TextWrap::WordWrap,
55+
text_overflow: TextOverflow::Clip
5456
}
5557
}
5658
}
@@ -92,7 +94,10 @@ pub fn layout(text: &str, scale_factor: f32, options: LayoutOptions) -> Layout {
9294
TextWrap::WordWrap => parley::style::WordBreakStrength::Normal,
9395
TextWrap::CharWrap => parley::style::WordBreakStrength::BreakAll,
9496
}));
95-
97+
if options.text_overflow == TextOverflow::Elide {
98+
todo!();
99+
}
100+
96101
builder.push_default(parley::StyleProperty::Brush(Brush {
97102
stroke: options.stroke,
98103
..Default::default()

internal/renderers/femtovg/itemrenderer.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,6 @@ impl<'a, R: femtovg::Renderer + TextureImporter> ItemRenderer for GLItemRenderer
414414

415415
let (horizontal_align, vertical_align) = text.alignment();
416416
let color = text.color();
417-
// TODO
418-
let _overflow = text.overflow();
419-
// TODO
420-
let _letter_spacing = text.letter_spacing();
421-
422417
let font_request = text.font_request(self_rc);
423418

424419
let text_path = rect_to_path((size * self.scale_factor).into());
@@ -461,6 +456,7 @@ impl<'a, R: femtovg::Renderer + TextureImporter> ItemRenderer for GLItemRenderer
461456
stroke: stroke_paint.is_some().then_some(stroke_style),
462457
font_request: Some(font_request),
463458
text_wrap: text.wrap(),
459+
text_overflow: text.overflow(),
464460
..Default::default()
465461
},
466462
);

0 commit comments

Comments
 (0)