Add text selection (semi-functional); save as PDF; fix width issues (different vscale/wscale)

This commit is contained in:
bluepython508
2025-11-04 14:03:12 +00:00
parent c023daf180
commit 75754935be
6 changed files with 386 additions and 118 deletions

View File

@@ -1,5 +1,6 @@
#![allow(warnings)]
pub use cairo::ffi::*;
use typst::layout::{Abs, Point, Rect};
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
@@ -21,3 +22,26 @@ pub enum ZathuraResult {
/// The provided password is invalid
InvalidPassword = 5,
}
impl From<zathura_rectangle_s> for Rect {
fn from(rect: zathura_rectangle_s) -> Self {
fn min(a: f64, b: f64) -> f64 {
if a < b { a } else { b }
}
fn max(a: f64, b: f64) -> f64 {
if a > b { a } else { b }
}
Rect::new(
Point::new(
Abs::pt(min(rect.x1, rect.x2)),
Abs::pt(min(rect.y1, rect.y2)),
),
Point::new(
Abs::pt(max(rect.x1, rect.x2)),
Abs::pt(max(rect.y1, rect.y2)),
),
)
}
}