Update glyph_brush and glow_glyph

This commit is contained in:
Héctor Ramón Jiménez 2020-05-27 23:09:27 +02:00
parent 22ced3485e
commit 823ea15732
7 changed files with 41 additions and 86 deletions

View file

@ -101,7 +101,6 @@ impl Backend {
for text in layer.text.iter() {
// Target physical coordinates directly to avoid blurry text
let text = glow_glyph::Section {
text: text.content,
// TODO: We `round` here to avoid rerasterizing text when
// its position changes slightly. This can make text feel a
// bit "jumpy". We may be able to do better once we improve
@ -123,12 +122,18 @@ impl Backend {
(text.bounds.width * scale_factor).ceil(),
(text.bounds.height * scale_factor).ceil(),
),
scale: glow_glyph::Scale {
x: text.size * scale_factor,
y: text.size * scale_factor,
},
color: text.color,
font_id: self.text_pipeline.find_font(text.font),
text: vec![glow_glyph::Text {
text: text.content,
scale: glow_glyph::ab_glyph::PxScale {
x: text.size * scale_factor,
y: text.size * scale_factor,
},
font_id: self.text_pipeline.find_font(text.font),
extra: glow_glyph::Extra {
color: text.color,
z: 0.0,
},
}],
layout: glow_glyph::Layout::default()
.h_align(match text.horizontal_alignment {
HorizontalAlignment::Left => {
@ -191,10 +196,6 @@ impl backend::Text for Backend {
) -> (f32, f32) {
self.text_pipeline.measure(contents, size, font, bounds)
}
fn space_width(&self, size: f32) -> f32 {
self.text_pipeline.space_width(size)
}
}
#[cfg(feature = "image")]