mirror of
https://github.com/typst/typst
synced 2025-08-12 06:07:54 +08:00
Fix "Bézier" everywhere
This commit is contained in:
parent
50f6b90fe8
commit
5efb33e504
@ -1281,7 +1281,7 @@ impl ControlPoints {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper to draw arcs with bezier curves.
|
/// Helper to draw arcs with Bézier curves.
|
||||||
trait CurveExt {
|
trait CurveExt {
|
||||||
fn arc(&mut self, start: Point, center: Point, end: Point);
|
fn arc(&mut self, start: Point, center: Point, end: Point);
|
||||||
fn arc_move(&mut self, start: Point, center: Point, end: Point);
|
fn arc_move(&mut self, start: Point, center: Point, end: Point);
|
||||||
@ -1305,7 +1305,7 @@ impl CurveExt for Curve {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the control points for a bezier curve that approximates a circular arc for
|
/// Get the control points for a Bézier curve that approximates a circular arc for
|
||||||
/// a start point, an end point and a center of the circle whose arc connects
|
/// a start point, an end point and a center of the circle whose arc connects
|
||||||
/// the two.
|
/// the two.
|
||||||
fn bezier_arc_control(start: Point, center: Point, end: Point) -> [Point; 2] {
|
fn bezier_arc_control(start: Point, center: Point, end: Point) -> [Point; 2] {
|
||||||
|
@ -10,12 +10,12 @@ use crate::foundations::{
|
|||||||
use crate::layout::{Abs, Axes, BlockElem, Length, Point, Rel, Size};
|
use crate::layout::{Abs, Axes, BlockElem, Length, Point, Rel, Size};
|
||||||
use crate::visualize::{FillRule, Paint, Stroke};
|
use crate::visualize::{FillRule, Paint, Stroke};
|
||||||
|
|
||||||
/// A curve consisting of movements, lines, and Beziér segments.
|
/// A curve consisting of movements, lines, and Bézier segments.
|
||||||
///
|
///
|
||||||
/// At any point in time, there is a conceptual pen or cursor.
|
/// At any point in time, there is a conceptual pen or cursor.
|
||||||
/// - Move elements move the cursor without drawing.
|
/// - Move elements move the cursor without drawing.
|
||||||
/// - Line/Quadratic/Cubic elements draw a segment from the cursor to a new
|
/// - Line/Quadratic/Cubic elements draw a segment from the cursor to a new
|
||||||
/// position, potentially with control point for a Beziér curve.
|
/// position, potentially with control point for a Bézier curve.
|
||||||
/// - Close elements draw a straight or smooth line back to the start of the
|
/// - Close elements draw a straight or smooth line back to the start of the
|
||||||
/// curve or the latest preceding move segment.
|
/// curve or the latest preceding move segment.
|
||||||
///
|
///
|
||||||
@ -26,7 +26,7 @@ use crate::visualize::{FillRule, Paint, Stroke};
|
|||||||
/// or relative to the current pen/cursor position, that is, the position where
|
/// or relative to the current pen/cursor position, that is, the position where
|
||||||
/// the previous segment ended.
|
/// the previous segment ended.
|
||||||
///
|
///
|
||||||
/// Beziér curve control points can be skipped by passing `{none}` or
|
/// Bézier curve control points can be skipped by passing `{none}` or
|
||||||
/// automatically mirrored from the preceding segment by passing `{auto}`.
|
/// automatically mirrored from the preceding segment by passing `{auto}`.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
@ -88,7 +88,7 @@ pub struct CurveElem {
|
|||||||
#[fold]
|
#[fold]
|
||||||
pub stroke: Smart<Option<Stroke>>,
|
pub stroke: Smart<Option<Stroke>>,
|
||||||
|
|
||||||
/// The components of the curve, in the form of moves, line and Beziér
|
/// The components of the curve, in the form of moves, line and Bézier
|
||||||
/// segment, and closes.
|
/// segment, and closes.
|
||||||
#[variadic]
|
#[variadic]
|
||||||
pub components: Vec<CurveComponent>,
|
pub components: Vec<CurveComponent>,
|
||||||
@ -225,7 +225,7 @@ pub struct CurveLine {
|
|||||||
pub relative: bool,
|
pub relative: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a quadratic Beziér curve segment from the last point to `end`, using
|
/// Adds a quadratic Bézier curve segment from the last point to `end`, using
|
||||||
/// `control` as the control point.
|
/// `control` as the control point.
|
||||||
///
|
///
|
||||||
/// ```example
|
/// ```example
|
||||||
@ -245,9 +245,9 @@ pub struct CurveLine {
|
|||||||
/// ```
|
/// ```
|
||||||
#[elem(name = "quad", title = "Curve Quadratic Segment")]
|
#[elem(name = "quad", title = "Curve Quadratic Segment")]
|
||||||
pub struct CurveQuad {
|
pub struct CurveQuad {
|
||||||
/// The control point of the quadratic Beziér curve.
|
/// The control point of the quadratic Bézier curve.
|
||||||
///
|
///
|
||||||
/// - If `{auto}` and this segment follows another quadratic Beziér curve,
|
/// - If `{auto}` and this segment follows another quadratic Bézier curve,
|
||||||
/// the previous control point will be mirrored.
|
/// the previous control point will be mirrored.
|
||||||
/// - If `{none}`, the control point defaults to `end`, and the curve will
|
/// - If `{none}`, the control point defaults to `end`, and the curve will
|
||||||
/// be a straight line.
|
/// be a straight line.
|
||||||
@ -272,7 +272,7 @@ pub struct CurveQuad {
|
|||||||
pub relative: bool,
|
pub relative: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a cubic Beziér curve segment from the last point to `end`, using
|
/// Adds a cubic Bézier curve segment from the last point to `end`, using
|
||||||
/// `control-start` and `control-end` as the control points.
|
/// `control-start` and `control-end` as the control points.
|
||||||
///
|
///
|
||||||
/// ```example
|
/// ```example
|
||||||
@ -388,7 +388,7 @@ pub enum CloseMode {
|
|||||||
Straight,
|
Straight,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A curve consisting of movements, lines, and Beziér segments.
|
/// A curve consisting of movements, lines, and Bézier segments.
|
||||||
#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)]
|
#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)]
|
||||||
pub struct Curve(pub Vec<CurveItem>);
|
pub struct Curve(pub Vec<CurveItem>);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ use crate::foundations::{
|
|||||||
use crate::layout::{Axes, BlockElem, Length, Rel};
|
use crate::layout::{Axes, BlockElem, Length, Rel};
|
||||||
use crate::visualize::{FillRule, Paint, Stroke};
|
use crate::visualize::{FillRule, Paint, Stroke};
|
||||||
|
|
||||||
/// A path through a list of points, connected by Bezier curves.
|
/// A path through a list of points, connected by Bézier curves.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
/// ```example
|
/// ```example
|
||||||
@ -59,8 +59,8 @@ pub struct PathElem {
|
|||||||
#[fold]
|
#[fold]
|
||||||
pub stroke: Smart<Option<Stroke>>,
|
pub stroke: Smart<Option<Stroke>>,
|
||||||
|
|
||||||
/// Whether to close this path with one last bezier curve. This curve will
|
/// Whether to close this path with one last Bézier curve. This curve will
|
||||||
/// takes into account the adjacent control points. If you want to close
|
/// take into account the adjacent control points. If you want to close
|
||||||
/// with a straight line, simply add one last point that's the same as the
|
/// with a straight line, simply add one last point that's the same as the
|
||||||
/// start point.
|
/// start point.
|
||||||
#[default(false)]
|
#[default(false)]
|
||||||
|
@ -412,7 +412,7 @@ pub enum Geometry {
|
|||||||
Line(Point),
|
Line(Point),
|
||||||
/// A rectangle with its origin in the topleft corner.
|
/// A rectangle with its origin in the topleft corner.
|
||||||
Rect(Size),
|
Rect(Size),
|
||||||
/// A curve consisting of movements, lines, and Bezier segments.
|
/// A curve consisting of movements, lines, and Bézier segments.
|
||||||
Curve(Curve),
|
Curve(Curve),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user