Skip to content

Commit 789e4a1

Browse files
Allow custom rotation in degrees, for backends that supports it (e.g. SVG)
Add comments
1 parent b804891 commit 789e4a1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

plotters-svg/src/svg.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ use plotters_backend::{
88
FontStyle, FontTransform,
99
};
1010

11+
use std::fmt::Write as _;
1112
use std::fs::File;
1213
#[allow(unused_imports)]
1314
use std::io::Cursor;
1415
use std::io::{BufWriter, Error, Write};
1516
use std::path::Path;
16-
use std::fmt::Write as _;
1717

1818
fn make_svg_color(color: BackendColor) -> String {
1919
let (r, g, b) = color.rgb;
@@ -459,6 +459,9 @@ impl<'a> DrawingBackend for SVGBackend<'a> {
459459
FontTransform::Rotate270 => {
460460
attrs.push(("transform", format!("rotate(270, {}, {})", x0, y0)));
461461
}
462+
FontTransform::RotateAngle(deg) => {
463+
attrs.push(("transform", format!("rotate({deg}, {x0}, {y0})")))
464+
}
462465
_ => {}
463466
}
464467

0 commit comments

Comments
 (0)