Execute positioned TeX specials through native PDF devices
This commit is contained in:
1 parent
05e633bb14
commit
ce8a780031
21 files changed
+519
-29
No files matched your search
@@ -437,3 +437,33 @@ pub(super) fn rule(
|
||||
}
|
||||
out.push_str("Q\n");
|
||||
}
|
||||
|
||||
|
||||
pub(super) fn xdv_rule(
|
||||
out: &mut PageContent,
|
||||
x: i64,
|
||||
y: i64,
|
||||
width: i64,
|
||||
height: i64,
|
||||
digits: u8,
|
||||
) {
|
||||
if width <= 0 || height <= 0 {
|
||||
return;
|
||||
}
|
||||
out.push_str("q\n");
|
||||
// The XDV driver strokes rules up to 5 bp wide and fills thicker rules.
|
||||
if width.min(height) <= 5 * 6_578_176 / 100 {
|
||||
let (thickness, points) = if width > height {
|
||||
(height, [x, y + height / 2, x + width, y + height / 2])
|
||||
} else {
|
||||
(width, [x + width / 2, y, x + width / 2, y + height])
|
||||
};
|
||||
let [x1, y1, x2, y2] = points.map(|value| print_sp(value, digits));
|
||||
let thickness = print_sp(thickness, digits + 1);
|
||||
out.push_str(&format!("{thickness} w {x1} {y1} m {x2} {y2} l S\n"));
|
||||
} else {
|
||||
let [x, y, width, height] = [x, y, width, height].map(|value| print_sp(value, digits));
|
||||
out.push_str(&format!("{x} {y} {width} {height} re f\n"));
|
||||
}
|
||||
out.push_str("Q\n");
|
||||
}
|
||||
Reference in new issue
Block a user