Add text selection (semi-functional); save as PDF; fix width issues (different vscale/wscale)
This commit is contained in:
@@ -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)),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user