mirror of
https://github.com/typst/typst
synced 2025-06-08 13:16:24 +08:00
Put trait into primitive
This commit is contained in:
parent
f2d4db286c
commit
6761cbc622
@ -1,5 +1,5 @@
|
||||
use crate::primitive::{PointExt, SizeExt, TransformExt};
|
||||
use crate::{paint, AbsExt, PdfOptions};
|
||||
use crate::primitive::{AbsExt, PointExt, SizeExt, TransformExt};
|
||||
use crate::{paint, PdfOptions};
|
||||
use bytemuck::TransparentWrapper;
|
||||
use ecow::EcoString;
|
||||
use krilla::action::{Action, LinkAction};
|
||||
|
@ -50,15 +50,3 @@ pub struct PdfOptions<'a> {
|
||||
/// A standard the PDF should conform to.
|
||||
pub validator: Validator,
|
||||
}
|
||||
|
||||
/// Additional methods for [`Abs`].
|
||||
trait AbsExt {
|
||||
/// Convert an to a number of points.
|
||||
fn to_f32(self) -> f32;
|
||||
}
|
||||
|
||||
impl AbsExt for Abs {
|
||||
fn to_f32(self) -> f32 {
|
||||
self.to_pt() as f32
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
//! Convert paint types from typst to krilla.
|
||||
|
||||
use crate::krilla::{process_frame, FrameContext, GlobalContext, Transforms};
|
||||
use crate::primitive::{FillRuleExt, LineCapExt, LineJoinExt, TransformExt};
|
||||
use crate::AbsExt;
|
||||
use crate::primitive::{AbsExt, FillRuleExt, LineCapExt, LineJoinExt, TransformExt};
|
||||
use krilla::geom::NormalizedF32;
|
||||
use krilla::page::{NumberingStyle, PageLabel};
|
||||
use krilla::paint::SpreadMethod;
|
||||
|
@ -1,9 +1,8 @@
|
||||
//! Convert basic primitive types from typst to krilla.
|
||||
|
||||
use typst_library::layout::{Point, Size, Transform};
|
||||
use typst_library::layout::{Abs, Point, Size, Transform};
|
||||
use typst_library::visualize::{FillRule, LineCap, LineJoin};
|
||||
|
||||
use crate::AbsExt;
|
||||
|
||||
pub(crate) trait SizeExt {
|
||||
fn as_krilla(&self) -> krilla::geom::Size;
|
||||
@ -82,3 +81,15 @@ impl FillRuleExt for FillRule {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Additional methods for [`Abs`].
|
||||
pub(crate) trait AbsExt {
|
||||
/// Convert an to a number of points.
|
||||
fn to_f32(self) -> f32;
|
||||
}
|
||||
|
||||
impl AbsExt for Abs {
|
||||
fn to_f32(self) -> f32 {
|
||||
self.to_pt() as f32
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user