Remove iced_glow, glyph-brush, and wgpu_glyph dependencies
This commit is contained in:
parent
573d27eb52
commit
b9a9576207
47 changed files with 30 additions and 3846 deletions
|
|
@ -4,10 +4,8 @@ use crate::triangle;
|
|||
use crate::{Settings, Transformation};
|
||||
|
||||
use iced_graphics::backend;
|
||||
use iced_graphics::font;
|
||||
use iced_graphics::layer::Layer;
|
||||
use iced_graphics::{Primitive, Viewport};
|
||||
use iced_native::alignment;
|
||||
use iced_native::{Font, Size};
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
|
|
@ -173,83 +171,11 @@ impl Backend {
|
|||
}
|
||||
|
||||
if !layer.text.is_empty() {
|
||||
for text in layer.text.iter() {
|
||||
// Target physical coordinates directly to avoid blurry text
|
||||
let text = wgpu_glyph::Section {
|
||||
// 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
|
||||
// our text rendering/caching pipeline.
|
||||
screen_position: (
|
||||
(text.bounds.x * scale_factor).round(),
|
||||
(text.bounds.y * scale_factor).round(),
|
||||
),
|
||||
// TODO: Fix precision issues with some scale factors.
|
||||
//
|
||||
// The `ceil` here can cause some words to render on the
|
||||
// same line when they should not.
|
||||
//
|
||||
// Ideally, `wgpu_glyph` should be able to compute layout
|
||||
// using logical positions, and then apply the proper
|
||||
// scaling when rendering. This would ensure that both
|
||||
// measuring and rendering follow the same layout rules.
|
||||
bounds: (
|
||||
(text.bounds.width * scale_factor).ceil(),
|
||||
(text.bounds.height * scale_factor).ceil(),
|
||||
),
|
||||
text: vec![wgpu_glyph::Text {
|
||||
text: text.content,
|
||||
scale: wgpu_glyph::ab_glyph::PxScale {
|
||||
x: text.size * scale_factor,
|
||||
y: text.size * scale_factor,
|
||||
},
|
||||
font_id: self.text_pipeline.find_font(text.font),
|
||||
extra: wgpu_glyph::Extra {
|
||||
color: text.color,
|
||||
z: 0.0,
|
||||
},
|
||||
}],
|
||||
layout: wgpu_glyph::Layout::default()
|
||||
.h_align(match text.horizontal_alignment {
|
||||
alignment::Horizontal::Left => {
|
||||
wgpu_glyph::HorizontalAlign::Left
|
||||
}
|
||||
alignment::Horizontal::Center => {
|
||||
wgpu_glyph::HorizontalAlign::Center
|
||||
}
|
||||
alignment::Horizontal::Right => {
|
||||
wgpu_glyph::HorizontalAlign::Right
|
||||
}
|
||||
})
|
||||
.v_align(match text.vertical_alignment {
|
||||
alignment::Vertical::Top => {
|
||||
wgpu_glyph::VerticalAlign::Top
|
||||
}
|
||||
alignment::Vertical::Center => {
|
||||
wgpu_glyph::VerticalAlign::Center
|
||||
}
|
||||
alignment::Vertical::Bottom => {
|
||||
wgpu_glyph::VerticalAlign::Bottom
|
||||
}
|
||||
}),
|
||||
};
|
||||
|
||||
self.text_pipeline.queue(text);
|
||||
for _text in layer.text.iter() {
|
||||
// TODO: Queue text sections
|
||||
}
|
||||
|
||||
self.text_pipeline.draw_queued(
|
||||
device,
|
||||
staging_belt,
|
||||
encoder,
|
||||
target,
|
||||
transformation,
|
||||
wgpu_glyph::Region {
|
||||
x: bounds.x,
|
||||
y: bounds.y,
|
||||
width: bounds.width,
|
||||
height: bounds.height,
|
||||
},
|
||||
);
|
||||
// TODO: Draw queued
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -261,9 +187,9 @@ impl iced_graphics::Backend for Backend {
|
|||
}
|
||||
|
||||
impl backend::Text for Backend {
|
||||
const ICON_FONT: Font = font::ICONS;
|
||||
const CHECKMARK_ICON: char = font::CHECKMARK_ICON;
|
||||
const ARROW_DOWN_ICON: char = font::ARROW_DOWN_ICON;
|
||||
const ICON_FONT: Font = Font::Default; // TODO
|
||||
const CHECKMARK_ICON: char = '✓';
|
||||
const ARROW_DOWN_ICON: char = '▼';
|
||||
|
||||
fn default_size(&self) -> f32 {
|
||||
self.default_text_size
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue