Merge branch 'master' into explicit-text-caching

This commit is contained in:
Héctor Ramón Jiménez 2023-09-10 00:34:21 +02:00
commit b8e5693a30
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
178 changed files with 1768 additions and 1388 deletions

View file

@ -63,7 +63,7 @@ pub trait Compositor: Sized {
/// Screenshots the current [`Renderer`] primitives to an offscreen texture, and returns the bytes of
/// the texture ordered as `RGBA` in the sRGB color space.
///
/// [`Renderer`]: Self::Renderer;
/// [`Renderer`]: Self::Renderer
fn screenshot<T: AsRef<str>>(
&mut self,
renderer: &mut Self::Renderer,

View file

@ -14,11 +14,11 @@ pub use text::Text;
pub use crate::gradient::{self, Gradient};
/// A renderer capable of drawing some [`Geometry`].
/// A renderer capable of drawing some [`Self::Geometry`].
pub trait Renderer: crate::core::Renderer {
/// The kind of geometry this renderer can draw.
type Geometry;
/// Draws the given layers of [`Geometry`].
/// Draws the given layers of [`Self::Geometry`].
fn draw(&mut self, layers: Vec<Self::Geometry>);
}

View file

@ -1,4 +1,6 @@
//! Fill [crate::widget::canvas::Geometry] with a certain style.
//! Fill [`Geometry`] with a certain style.
//!
//! [`Geometry`]: super::Renderer::Geometry
pub use crate::geometry::Style;
use crate::core::Color;

View file

@ -1,4 +1,6 @@
//! Create lines from a [crate::widget::canvas::Path] and assigns them various attributes/styles.
//! Create lines from a [`Path`] and assigns them various attributes/styles.
//!
//! [`Path`]: super::Path
pub use crate::geometry::Style;
use iced_core::Color;

View file

@ -1,8 +1,6 @@
//! A gradient that can be used as a [`Fill`] for some geometry.
//! A gradient that can be used as a fill for some geometry.
//!
//! For a gradient that you can use as a background variant for a widget, see [`Gradient`].
//!
//! [`Gradient`]: crate::core::Gradient;
use crate::color;
use crate::core::gradient::ColorStop;
use crate::core::{self, Color, Point, Rectangle};
@ -36,10 +34,7 @@ impl Gradient {
}
}
/// A linear gradient that can be used in the style of [`Fill`] or [`Stroke`].
///
/// [`Fill`]: crate::geometry::Fill;
/// [`Stroke`]: crate::geometry::Stroke;
/// A linear gradient.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Linear {
/// The absolute starting position of the gradient.
@ -53,7 +48,7 @@ pub struct Linear {
}
impl Linear {
/// Creates a new [`Builder`].
/// Creates a new [`Linear`] builder.
pub fn new(start: Point, end: Point) -> Self {
Self {
start,

View file

@ -7,6 +7,7 @@
#![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)]
#![forbid(rust_2018_idioms)]
#![deny(
missing_debug_implementations,
//missing_docs,
@ -16,9 +17,9 @@
clippy::from_over_into,
clippy::needless_borrow,
clippy::new_without_default,
clippy::useless_conversion
clippy::useless_conversion,
rustdoc::broken_intra_doc_links
)]
#![forbid(rust_2018_idioms)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
mod antialiasing;

View file

@ -41,7 +41,7 @@ impl Damage for Mesh {
}
}
/// A set of [`Vertex2D`] and indices representing a list of triangles.
/// A set of vertices and indices representing a list of triangles.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Indexed<T> {
/// The vertices of the mesh

View file

@ -43,7 +43,10 @@ impl Cache {
}
if let hash_map::Entry::Vacant(entry) = self.entries.entry(hash) {
let metrics = cosmic_text::Metrics::new(key.size, key.line_height);
let metrics = cosmic_text::Metrics::new(
key.size,
key.line_height.max(f32::MIN_POSITIVE),
);
let mut buffer = cosmic_text::Buffer::new(font_system, metrics);
buffer.set_size(